aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/old/qt_extractor.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-03-03 12:55:36 +0100
committerChristian Grothoff <christian@grothoff.org>2020-03-03 12:55:36 +0100
commitf22abb4d1339fe55f5c10545de4b80fe3ac6aebe (patch)
treead9ebbbeb6584d64310088b9769704f048f9daa4 /src/plugins/old/qt_extractor.c
parent0f3f4f01cce39f83f029caa4c285035c409c0ced (diff)
downloadlibextractor-f22abb4d1339fe55f5c10545de4b80fe3ac6aebe.tar.gz
libextractor-f22abb4d1339fe55f5c10545de4b80fe3ac6aebe.zip
uncrustifying indentation
Diffstat (limited to 'src/plugins/old/qt_extractor.c')
-rw-r--r--src/plugins/old/qt_extractor.c272
1 files changed, 148 insertions, 124 deletions
diff --git a/src/plugins/old/qt_extractor.c b/src/plugins/old/qt_extractor.c
index f3420bb..2db3306 100644
--- a/src/plugins/old/qt_extractor.c
+++ b/src/plugins/old/qt_extractor.c
@@ -178,7 +178,7 @@ static const char *const genre_names[] = {
178}; 178};
179 179
180#define GENRE_NAME_COUNT \ 180#define GENRE_NAME_COUNT \
181 ((unsigned int)(sizeof genre_names / sizeof (const char *const))) 181 ((unsigned int) (sizeof genre_names / sizeof (const char *const)))
182 182
183 183
184static const char *languages[] = { 184static const char *languages[] = {
@@ -299,7 +299,7 @@ typedef struct
299 const char *mime; 299 const char *mime;
300} C2M; 300} C2M;
301 301
302/* see http://www.mp4ra.org/filetype.html 302/* see http://www.mp4ra.org/filetype.html
303 * http://www.ftyps.com/ */ 303 * http://www.ftyps.com/ */
304static C2M ftMap[] = { 304static C2M ftMap[] = {
305 {"qt ", "video/quicktime"}, 305 {"qt ", "video/quicktime"},
@@ -356,7 +356,7 @@ static CHE cHm[] = {
356 {"src", EXTRACTOR_METATYPE_CONTRIBUTOR_NAME}, 356 {"src", EXTRACTOR_METATYPE_CONTRIBUTOR_NAME},
357 {"prf", EXTRACTOR_METATYPE_PERFORMER }, 357 {"prf", EXTRACTOR_METATYPE_PERFORMER },
358 {"prd", EXTRACTOR_METATYPE_PRODUCER}, 358 {"prd", EXTRACTOR_METATYPE_PRODUCER},
359 {"PRD", EXTRACTOR_METATYPE_PRODUCT_VERSION}, 359 {"PRD", EXTRACTOR_METATYPE_PRODUCT_VERSION},
360 {"swr", EXTRACTOR_METATYPE_PRODUCED_BY_SOFTWARE}, 360 {"swr", EXTRACTOR_METATYPE_PRODUCED_BY_SOFTWARE},
361 {"isr", EXTRACTOR_METATYPE_ISRC}, 361 {"isr", EXTRACTOR_METATYPE_ISRC},
362 {"wrt", EXTRACTOR_METATYPE_WRITER}, 362 {"wrt", EXTRACTOR_METATYPE_WRITER},
@@ -396,7 +396,7 @@ static ITTagConversionEntry it_to_extr_table[] = {
396 {"keyw", EXTRACTOR_METATYPE_KEYWORDS}, 396 {"keyw", EXTRACTOR_METATYPE_KEYWORDS},
397 {"desc", EXTRACTOR_METATYPE_DESCRIPTION}, 397 {"desc", EXTRACTOR_METATYPE_DESCRIPTION},
398 {"tvnn", EXTRACTOR_METATYPE_NETWORK_NAME}, 398 {"tvnn", EXTRACTOR_METATYPE_NETWORK_NAME},
399 {"tvsh", EXTRACTOR_METATYPE_SHOW_NAME}, 399 {"tvsh", EXTRACTOR_METATYPE_SHOW_NAME},
400 {"tven", EXTRACTOR_METATYPE_NETWORK_NAME}, 400 {"tven", EXTRACTOR_METATYPE_NETWORK_NAME},
401 {NULL, EXTRACTOR_METATYPE_RESERVED} 401 {NULL, EXTRACTOR_METATYPE_RESERVED}
402}; 402};
@@ -441,25 +441,26 @@ checkAtomValid (const char *buffer, size_t size, size_t pos)
441 return 0; 441 return 0;
442 atom = (const Atom *) &buffer[pos]; 442 atom = (const Atom *) &buffer[pos];
443 if (ntohl (atom->size) == 1) 443 if (ntohl (atom->size) == 1)
444 { 444 {
445 if ((pos + sizeof (LongAtom) > size) || (pos + sizeof (LongAtom) < pos)) 445 if ((pos + sizeof (LongAtom) > size) || (pos + sizeof (LongAtom) < pos))
446 return 0; 446 return 0;
447 latom = (const LongAtom *) &buffer[pos]; 447 latom = (const LongAtom *) &buffer[pos];
448 atomSize = ntohll (latom->size); 448 atomSize = ntohll (latom->size);
449 if ((atomSize < sizeof (LongAtom)) || 449 if ((atomSize < sizeof (LongAtom)) ||
450 (atomSize + pos > size) || (atomSize + pos < atomSize)) 450 (atomSize + pos > size) || (atomSize + pos < atomSize))
451 return 0; 451 return 0;
452 } 452 }
453 else 453 else
454 { 454 {
455 atomSize = ntohl (atom->size); 455 atomSize = ntohl (atom->size);
456 if ((atomSize < sizeof (Atom)) || 456 if ((atomSize < sizeof (Atom)) ||
457 (atomSize + pos > size) || (atomSize + pos < atomSize)) 457 (atomSize + pos > size) || (atomSize + pos < atomSize))
458 return 0; 458 return 0;
459 } 459 }
460 return 1; 460 return 1;
461} 461}
462 462
463
463/** 464/**
464 * Assumes that checkAtomValid has already been called. 465 * Assumes that checkAtomValid has already been called.
465 */ 466 */
@@ -470,13 +471,14 @@ getAtomSize (const char *buf)
470 const LongAtom *latom; 471 const LongAtom *latom;
471 atom = (const Atom *) buf; 472 atom = (const Atom *) buf;
472 if (ntohl (atom->size) == 1) 473 if (ntohl (atom->size) == 1)
473 { 474 {
474 latom = (const LongAtom *) buf; 475 latom = (const LongAtom *) buf;
475 return ntohll (latom->size); 476 return ntohll (latom->size);
476 } 477 }
477 return ntohl (atom->size); 478 return ntohl (atom->size);
478} 479}
479 480
481
480/** 482/**
481 * Assumes that checkAtomValid has already been called. 483 * Assumes that checkAtomValid has already been called.
482 */ 484 */
@@ -491,6 +493,7 @@ getAtomHeaderSize (const char *buf)
491 return sizeof (Atom); 493 return sizeof (Atom);
492} 494}
493 495
496
494struct ExtractContext 497struct ExtractContext
495{ 498{
496 EXTRACTOR_MetaDataProcessor proc; 499 EXTRACTOR_MetaDataProcessor proc;
@@ -500,22 +503,21 @@ struct ExtractContext
500 503
501static void 504static void
502addKeyword (enum EXTRACTOR_MetaType type, 505addKeyword (enum EXTRACTOR_MetaType type,
503 const char *str, 506 const char *str,
504 struct ExtractContext *ec) 507 struct ExtractContext *ec)
505{ 508{
506 if (ec->ret != 0) 509 if (ec->ret != 0)
507 return; 510 return;
508 ec->ret = ec->proc (ec->proc_cls, 511 ec->ret = ec->proc (ec->proc_cls,
509 "qt", 512 "qt",
510 type, 513 type,
511 EXTRACTOR_METAFORMAT_UTF8, 514 EXTRACTOR_METAFORMAT_UTF8,
512 "text/plain", 515 "text/plain",
513 str, 516 str,
514 strlen(str)+1); 517 strlen (str) + 1);
515} 518}
516 519
517 520
518
519/** 521/**
520 * Assumes that checkAtomValid has already been called. 522 * Assumes that checkAtomValid has already been called.
521 */ 523 */
@@ -538,8 +540,8 @@ typedef struct
538static int handleAtom (HandlerEntry *handlers, 540static int handleAtom (HandlerEntry *handlers,
539 const char *input, 541 const char *input,
540 size_t size, 542 size_t size,
541 size_t pos, 543 size_t pos,
542 struct ExtractContext *ec); 544 struct ExtractContext *ec);
543 545
544static HandlerEntry all_handlers[]; 546static HandlerEntry all_handlers[];
545static HandlerEntry ilst_handlers[]; 547static HandlerEntry ilst_handlers[];
@@ -550,7 +552,7 @@ static HandlerEntry ilst_handlers[];
550 */ 552 */
551static int 553static int
552processAtoms (HandlerEntry *handlers, const char *input, 554processAtoms (HandlerEntry *handlers, const char *input,
553 size_t size, struct ExtractContext *ec) 555 size_t size, struct ExtractContext *ec)
554{ 556{
555 size_t pos; 557 size_t pos;
556 558
@@ -558,14 +560,15 @@ processAtoms (HandlerEntry *handlers, const char *input,
558 return 1; 560 return 1;
559 pos = 0; 561 pos = 0;
560 while (pos < size - sizeof (Atom)) 562 while (pos < size - sizeof (Atom))
561 { 563 {
562 if (0 == handleAtom (handlers, input, size, pos, ec)) 564 if (0 == handleAtom (handlers, input, size, pos, ec))
563 return 0; 565 return 0;
564 pos += getAtomSize (&input[pos]); 566 pos += getAtomSize (&input[pos]);
565 } 567 }
566 return 1; 568 return 1;
567} 569}
568 570
571
569/** 572/**
570 * Process all atoms. 573 * Process all atoms.
571 * @return 0 on error, 1 for success, -1 for unknown atom type 574 * @return 0 on error, 1 for success, -1 for unknown atom type
@@ -574,9 +577,10 @@ static int
574processAllAtoms (const char *input, 577processAllAtoms (const char *input,
575 size_t size, struct ExtractContext *ec) 578 size_t size, struct ExtractContext *ec)
576{ 579{
577 return processAtoms(all_handlers, input, size, ec); 580 return processAtoms (all_handlers, input, size, ec);
578} 581}
579 582
583
580/** 584/**
581 * Handle the moov atom. 585 * Handle the moov atom.
582 * @return 0 on error, 1 for success, -1 for unknown atom type 586 * @return 0 on error, 1 for success, -1 for unknown atom type
@@ -590,6 +594,7 @@ moovHandler (const char *input,
590 getAtomSize (&input[pos]) - hdr, ec); 594 getAtomSize (&input[pos]) - hdr, ec);
591} 595}
592 596
597
593/* see http://developer.apple.com/documentation/QuickTime/QTFF/QTFFChap1/chapter_2_section_5.html */ 598/* see http://developer.apple.com/documentation/QuickTime/QTFF/QTFFChap1/chapter_2_section_5.html */
594typedef struct 599typedef struct
595{ 600{
@@ -609,7 +614,8 @@ ftypHandler (const char *input,
609 const FileType *ft; 614 const FileType *ft;
610 int i; 615 int i;
611 616
612 if (getAtomSize (&input[pos]) < sizeof (FileType)) { 617 if (getAtomSize (&input[pos]) < sizeof (FileType))
618 {
613 return 0; 619 return 0;
614 } 620 }
615 ft = (const FileType *) &input[pos]; 621 ft = (const FileType *) &input[pos];
@@ -622,6 +628,7 @@ ftypHandler (const char *input,
622 return 1; 628 return 1;
623} 629}
624 630
631
625typedef struct 632typedef struct
626{ 633{
627 Atom hdr; 634 Atom hdr;
@@ -662,13 +669,14 @@ mvhdHandler (const char *input,
662 return 0; 669 return 0;
663 m = (const MovieHeaderAtom *) &input[pos]; 670 m = (const MovieHeaderAtom *) &input[pos];
664 snprintf (duration, 671 snprintf (duration,
665 sizeof(duration), 672 sizeof(duration),
666 "%us", 673 "%us",
667 ntohl (m->duration) / ntohl (m->timeScale)); 674 ntohl (m->duration) / ntohl (m->timeScale));
668 addKeyword (EXTRACTOR_METATYPE_DURATION, duration, ec); 675 addKeyword (EXTRACTOR_METATYPE_DURATION, duration, ec);
669 return 1; 676 return 1;
670} 677}
671 678
679
672typedef struct 680typedef struct
673{ 681{
674 Atom cmovAtom; 682 Atom cmovAtom;
@@ -699,9 +707,9 @@ cmovHandler (const char *input,
699 (0 != memcmp (&c->cmvdAtom.type, "cmvd", 4)) || 707 (0 != memcmp (&c->cmvdAtom.type, "cmvd", 4)) ||
700 (ntohl (c->cmvdAtom.size) != 708 (ntohl (c->cmvdAtom.size) !=
701 getAtomSize (&input[pos]) - sizeof (Atom) * 2 - 4)) 709 getAtomSize (&input[pos]) - sizeof (Atom) * 2 - 4))
702 { 710 {
703 return 0; /* dcom must be 12 bytes */ 711 return 0; /* dcom must be 12 bytes */
704 } 712 }
705 s = ntohl (c->decompressedSize); 713 s = ntohl (c->decompressedSize);
706 if (s > 16 * 1024 * 1024) 714 if (s > 16 * 1024 * 1024)
707 return 1; /* ignore, too big! */ 715 return 1; /* ignore, too big! */
@@ -718,27 +726,28 @@ cmovHandler (const char *input,
718 z_state.opaque = (voidpf) 0; 726 z_state.opaque = (voidpf) 0;
719 z_ret_code = inflateInit (&z_state); 727 z_ret_code = inflateInit (&z_state);
720 if (Z_OK != z_ret_code) 728 if (Z_OK != z_ret_code)
721 { 729 {
722 free (buf); 730 free (buf);
723 return 0; /* crc error? */ 731 return 0; /* crc error? */
724 } 732 }
725 z_ret_code = inflate (&z_state, Z_NO_FLUSH); 733 z_ret_code = inflate (&z_state, Z_NO_FLUSH);
726 if ((z_ret_code != Z_OK) && (z_ret_code != Z_STREAM_END)) 734 if ((z_ret_code != Z_OK) && (z_ret_code != Z_STREAM_END))
727 { 735 {
728 free (buf); 736 free (buf);
729 return 0; /* decode error? */ 737 return 0; /* decode error? */
730 } 738 }
731 z_ret_code = inflateEnd (&z_state); 739 z_ret_code = inflateEnd (&z_state);
732 if (Z_OK != z_ret_code) 740 if (Z_OK != z_ret_code)
733 { 741 {
734 free (buf); 742 free (buf);
735 return 0; /* decode error? */ 743 return 0; /* decode error? */
736 } 744 }
737 ret = handleAtom (all_handlers, buf, s, 0, ec); 745 ret = handleAtom (all_handlers, buf, s, 0, ec);
738 free (buf); 746 free (buf);
739 return ret; 747 return ret;
740} 748}
741 749
750
742typedef struct 751typedef struct
743{ 752{
744 short integer; 753 short integer;
@@ -780,18 +789,19 @@ tkhdHandler (const char *input,
780 return 0; 789 return 0;
781 m = (const TrackAtom *) &input[pos]; 790 m = (const TrackAtom *) &input[pos];
782 if (ntohs (m->track_width.integer) != 0) 791 if (ntohs (m->track_width.integer) != 0)
783 { 792 {
784 /* if actually a/the video track */ 793 /* if actually a/the video track */
785 snprintf (dimensions, 794 snprintf (dimensions,
786 sizeof(dimensions), 795 sizeof(dimensions),
787 "%dx%d", 796 "%dx%d",
788 ntohs (m->track_width.integer), 797 ntohs (m->track_width.integer),
789 ntohs (m->track_height.integer)); 798 ntohs (m->track_height.integer));
790 addKeyword (EXTRACTOR_METATYPE_IMAGE_DIMENSIONS, dimensions, ec); 799 addKeyword (EXTRACTOR_METATYPE_IMAGE_DIMENSIONS, dimensions, ec);
791 } 800 }
792 return 1; 801 return 1;
793} 802}
794 803
804
795static int 805static int
796trakHandler (const char *input, 806trakHandler (const char *input,
797 size_t size, size_t pos, struct ExtractContext *ec) 807 size_t size, size_t pos, struct ExtractContext *ec)
@@ -801,6 +811,7 @@ trakHandler (const char *input,
801 getAtomSize (&input[pos]) - hdr, ec); 811 getAtomSize (&input[pos]) - hdr, ec);
802} 812}
803 813
814
804static int 815static int
805metaHandler (const char *input, 816metaHandler (const char *input,
806 size_t size, size_t pos, struct ExtractContext *ec) 817 size_t size, size_t pos, struct ExtractContext *ec)
@@ -812,6 +823,7 @@ metaHandler (const char *input,
812 getAtomSize (&input[pos]) - hdr - 4, ec); 823 getAtomSize (&input[pos]) - hdr - 4, ec);
813} 824}
814 825
826
815typedef struct 827typedef struct
816{ 828{
817 Atom header; 829 Atom header;
@@ -873,13 +885,14 @@ c_Handler (const char *input,
873 int i; 885 int i;
874 886
875 i = 0; 887 i = 0;
876 while ((cHm[i].pfx != NULL) && (0 != memcmp (&input[pos+5], cHm[i].pfx, 3))) 888 while ((cHm[i].pfx != NULL) && (0 != memcmp (&input[pos + 5], cHm[i].pfx, 3)))
877 i++; 889 i++;
878 if (cHm[i].pfx != NULL) 890 if (cHm[i].pfx != NULL)
879 return processTextTag (input, size, pos, cHm[i].type, ec); 891 return processTextTag (input, size, pos, cHm[i].type, ec);
880 return -1; /* not found */ 892 return -1; /* not found */
881} 893}
882 894
895
883static int 896static int
884udtaHandler (const char *input, 897udtaHandler (const char *input,
885 size_t size, size_t pos, struct ExtractContext *ec) 898 size_t size, size_t pos, struct ExtractContext *ec)
@@ -889,13 +902,14 @@ udtaHandler (const char *input,
889 getAtomSize (&input[pos]) - hdr, ec); 902 getAtomSize (&input[pos]) - hdr, ec);
890} 903}
891 904
905
892static int 906static int
893processDataAtom (const char *input, 907processDataAtom (const char *input,
894 size_t size, /* parent atom size */ 908 size_t size, /* parent atom size */
895 size_t pos, 909 size_t pos,
896 const char *patom, 910 const char *patom,
897 enum EXTRACTOR_MetaType type, 911 enum EXTRACTOR_MetaType type,
898 struct ExtractContext *ec) 912 struct ExtractContext *ec)
899{ 913{
900 char *meta; 914 char *meta;
901 unsigned char version; 915 unsigned char version;
@@ -907,55 +921,62 @@ processDataAtom (const char *input,
907 921
908 hdr = getAtomHeaderSize (&input[pos]); 922 hdr = getAtomHeaderSize (&input[pos]);
909 asize = getAtomSize (&input[pos]); 923 asize = getAtomSize (&input[pos]);
910 if (memcmp(&input[pos+4], "data", 4) != 0) 924 if (memcmp (&input[pos + 4], "data", 4) != 0)
911 return -1; 925 return -1;
912 926
913 if (asize < hdr + 8 || /* header + u32 flags + u32 reserved */ 927 if ((asize < hdr + 8) || /* header + u32 flags + u32 reserved */
914 asize > (getAtomSize(&patom[0]) - 8)) 928 (asize > (getAtomSize (&patom[0]) - 8)) )
915 return 0; 929 return 0;
916 930
917 len = (unsigned int)(asize - (hdr + 8)); 931 len = (unsigned int) (asize - (hdr + 8));
918 932
919 version = input[pos+8]; 933 version = input[pos + 8];
920 flags = ((unsigned char)input[pos+9]<<16) | 934 flags = ((unsigned char) input[pos + 9] << 16)
921 ((unsigned char)input[pos+10]<<8) | 935 | ((unsigned char) input[pos + 10] << 8)
922 (unsigned char)input[pos+11]; 936 | (unsigned char) input[pos + 11];
923#if DEBUG 937#if DEBUG
924 printf("[data] version:%02x flags:%08x txtlen:%d\n", version, flags, len); 938 printf ("[data] version:%02x flags:%08x txtlen:%d\n", version, flags, len);
925#endif 939#endif
926 940
927 if (version != 0) 941 if (version != 0)
928 return -1; 942 return -1;
929 943
930 if (flags == 0x0) { /* binary data */ 944 if (flags == 0x0) /* binary data */
931 if (memcmp(&patom[4], "gnre", 4) == 0) { 945 {
932 if (len >= 2) { 946 if (memcmp (&patom[4], "gnre", 4) == 0)
933 unsigned short genre = ((unsigned char)input[pos+16] << 8) | 947 {
934 (unsigned char)input[pos+17]; 948 if (len >= 2)
935 if (genre > 0 && genre < GENRE_NAME_COUNT) 949 {
936 addKeyword(type, genre_names[genre-1], ec); 950 unsigned short genre = ((unsigned char) input[pos + 16] << 8)
951 | (unsigned char) input[pos + 17];
952 if ((genre > 0) && (genre < GENRE_NAME_COUNT))
953 addKeyword (type, genre_names[genre - 1], ec);
937 } 954 }
938 return 1; 955 return 1;
939 } 956 }
940 else if ((memcmp(&patom[4], "trkn", 4) == 0) || 957 else if ((memcmp (&patom[4], "trkn", 4) == 0) ||
941 (memcmp(&patom[4], "disk", 4) == 0)) { 958 (memcmp (&patom[4], "disk", 4) == 0))
942 if (len >= 4) { 959 {
943 unsigned short n = ((unsigned char)input[pos+18] << 8) | 960 if (len >= 4)
944 (unsigned char)input[pos+19]; 961 {
962 unsigned short n = ((unsigned char) input[pos + 18] << 8)
963 | (unsigned char) input[pos + 19];
945 char s[8]; 964 char s[8];
946 snprintf(s, 8, "%d", n); 965 snprintf (s, 8, "%d", n);
947 addKeyword(type, s, ec); 966 addKeyword (type, s, ec);
948 } 967 }
949 } 968 }
950 else { 969 else
970 {
951 return -1; 971 return -1;
952 } 972 }
953 } 973 }
954 else if (flags == 0x1) { /* text data */ 974 else if (flags == 0x1) /* text data */
975 {
955 meta = malloc (len + 1); 976 meta = malloc (len + 1);
956 if (meta == NULL) 977 if (meta == NULL)
957 return 0; 978 return 0;
958 memcpy (meta, &input[pos+16], len); 979 memcpy (meta, &input[pos + 16], len);
959 meta[len] = '\0'; 980 meta[len] = '\0';
960 for (i = 0; i < len; i++) 981 for (i = 0; i < len; i++)
961 if (meta[i] == '\r') 982 if (meta[i] == '\r')
@@ -968,12 +989,13 @@ processDataAtom (const char *input,
968 return -1; 989 return -1;
969} 990}
970 991
992
971/* NOTE: iTunes tag processing should, in theory, be limited to iTunes 993/* NOTE: iTunes tag processing should, in theory, be limited to iTunes
972 * file types (from ftyp), but, in reality, it seems that there are other 994 * file types (from ftyp), but, in reality, it seems that there are other
973 * files, like 3gpp, out in the wild with iTunes tags. */ 995 * files, like 3gpp, out in the wild with iTunes tags. */
974static int 996static int
975iTunesTagHandler (const char *input, 997iTunesTagHandler (const char *input,
976 size_t size, size_t pos, struct ExtractContext *ec) 998 size_t size, size_t pos, struct ExtractContext *ec)
977{ 999{
978 unsigned long long asize; 1000 unsigned long long asize;
979 unsigned int hdr; 1001 unsigned int hdr;
@@ -986,24 +1008,24 @@ iTunesTagHandler (const char *input,
986 return 0; 1008 return 0;
987 1009
988 i = 0; 1010 i = 0;
989 while ((it_to_extr_table[i].atom_type != NULL) && 1011 while ((it_to_extr_table[i].atom_type != NULL) &&
990 (0 != memcmp (&input[pos+4], it_to_extr_table[i].atom_type, 4))) 1012 (0 != memcmp (&input[pos + 4], it_to_extr_table[i].atom_type, 4)))
991 i++; 1013 i++;
992 if (it_to_extr_table[i].atom_type != NULL) 1014 if (it_to_extr_table[i].atom_type != NULL)
993 return processDataAtom(input, asize, pos+hdr, &input[pos], 1015 return processDataAtom (input, asize, pos + hdr, &input[pos],
994 it_to_extr_table[i].type, ec); 1016 it_to_extr_table[i].type, ec);
995 1017
996 return -1; 1018 return -1;
997} 1019}
998 1020
999 1021
1000static int 1022static int
1001ilstHandler (const char *input, 1023ilstHandler (const char *input,
1002 size_t size, size_t pos, struct ExtractContext *ec) 1024 size_t size, size_t pos, struct ExtractContext *ec)
1003{ 1025{
1004 unsigned int hdr = getAtomHeaderSize (&input[pos]); 1026 unsigned int hdr = getAtomHeaderSize (&input[pos]);
1005 return processAtoms(ilst_handlers, &input[pos + hdr], 1027 return processAtoms (ilst_handlers, &input[pos + hdr],
1006 getAtomSize(&input[pos]) - hdr, ec); 1028 getAtomSize (&input[pos]) - hdr, ec);
1007} 1029}
1008 1030
1009 1031
@@ -1099,23 +1121,23 @@ handleAtom (HandlerEntry *handlers, const char *input,
1099{ 1121{
1100 int i; 1122 int i;
1101 if (0 == checkAtomValid (input, size, pos)) 1123 if (0 == checkAtomValid (input, size, pos))
1102 { 1124 {
1103 return 0; 1125 return 0;
1104 } 1126 }
1105 i = 0; 1127 i = 0;
1106 while ((handlers[i].name != NULL) && 1128 while ((handlers[i].name != NULL) &&
1107 (0 != memcmp (&input[pos + 4], handlers[i].name, 4))) 1129 (0 != memcmp (&input[pos + 4], handlers[i].name, 4)))
1108 i++; 1130 i++;
1109 if (handlers[i].name == NULL) 1131 if (handlers[i].name == NULL)
1110 { 1132 {
1111#if DEBUG 1133#if DEBUG
1112 char b[5]; 1134 char b[5];
1113 memcpy (b, &input[pos + 4], 4); 1135 memcpy (b, &input[pos + 4], 4);
1114 b[4] = '\0'; 1136 b[4] = '\0';
1115 printf ("No handler for `%s'\n", b); 1137 printf ("No handler for `%s'\n", b);
1116#endif 1138#endif
1117 return -1; 1139 return -1;
1118 } 1140 }
1119 i = handlers[i].handler (input, size, pos, ec); 1141 i = handlers[i].handler (input, size, pos, ec);
1120#if DEBUG 1142#if DEBUG
1121 printf ("Running handler for `%4s' at %u completed with result %d\n", 1143 printf ("Running handler for `%4s' at %u completed with result %d\n",
@@ -1124,18 +1146,19 @@ handleAtom (HandlerEntry *handlers, const char *input,
1124 return i; 1146 return i;
1125} 1147}
1126 1148
1149
1127/* mimetypes: 1150/* mimetypes:
1128 video/quicktime: mov,qt: Quicktime animation; 1151 video/quicktime: mov,qt: Quicktime animation;
1129 video/x-quicktime: mov,qt: Quicktime animation; 1152 video/x-quicktime: mov,qt: Quicktime animation;
1130 application/x-quicktimeplayer: qtl: Quicktime list; 1153 application/x-quicktimeplayer: qtl: Quicktime list;
1131 */ 1154 */
1132 1155
1133int 1156int
1134EXTRACTOR_qt_extract (const char *data, 1157EXTRACTOR_qt_extract (const char *data,
1135 size_t size, 1158 size_t size,
1136 EXTRACTOR_MetaDataProcessor proc, 1159 EXTRACTOR_MetaDataProcessor proc,
1137 void *proc_cls, 1160 void *proc_cls,
1138 const char *options) 1161 const char *options)
1139{ 1162{
1140 struct ExtractContext ec; 1163 struct ExtractContext ec;
1141 ec.proc = proc; 1164 ec.proc = proc;
@@ -1145,4 +1168,5 @@ EXTRACTOR_qt_extract (const char *data,
1145 return ec.ret; 1168 return ec.ret;
1146} 1169}
1147 1170
1171
1148/* end of qt_extractor.c */ 1172/* end of qt_extractor.c */