aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/mpeg_extractor.c26
-rw-r--r--src/plugins/test_mpeg.c7
2 files changed, 15 insertions, 18 deletions
diff --git a/src/plugins/mpeg_extractor.c b/src/plugins/mpeg_extractor.c
index dfc7ecb..7e97487 100644
--- a/src/plugins/mpeg_extractor.c
+++ b/src/plugins/mpeg_extractor.c
@@ -52,7 +52,8 @@ EXTRACTOR_mpeg_extract_method (struct EXTRACTOR_ExtractContext *ec)
52 ssize_t avail; 52 ssize_t avail;
53 mpeg2_state_t state; 53 mpeg2_state_t state;
54 char format[256]; 54 char format[256];
55 int finished; 55 char gop_format[256];
56 int have_gop;
56 57
57 if (NULL == (handle = mpeg2_init ())) 58 if (NULL == (handle = mpeg2_init ()))
58 return; 59 return;
@@ -61,8 +62,8 @@ EXTRACTOR_mpeg_extract_method (struct EXTRACTOR_ExtractContext *ec)
61 mpeg2_close (handle); 62 mpeg2_close (handle);
62 return; 63 return;
63 } 64 }
64 finished = 3; 65 have_gop = 0;
65 while (0 != finished) 66 while (1)
66 { 67 {
67 state = mpeg2_parse (handle); 68 state = mpeg2_parse (handle);
68 switch (state) 69 switch (state)
@@ -101,19 +102,16 @@ EXTRACTOR_mpeg_extract_method (struct EXTRACTOR_ExtractContext *ec)
101 ADD ("MPEG2", EXTRACTOR_METATYPE_FORMAT_VERSION); 102 ADD ("MPEG2", EXTRACTOR_METATYPE_FORMAT_VERSION);
102 else 103 else
103 ADD ("MPEG1", EXTRACTOR_METATYPE_FORMAT_VERSION); 104 ADD ("MPEG1", EXTRACTOR_METATYPE_FORMAT_VERSION);
104 finished &= ~2;
105 break; 105 break;
106 case STATE_GOP: 106 case STATE_GOP:
107 if ( (NULL != info->gop) && 107 if (NULL != info->gop)
108 (0 != info->gop->pictures) )
109 { 108 {
110 snprintf (format, 109 snprintf (gop_format,
111 sizeof(format), 110 sizeof (gop_format),
112 "%u:%u:%u (%u frames)", 111 "%02u:%02u:%02u (%u frames)",
113 info->gop->hours, 112 info->gop->hours, info->gop->minutes, info->gop->seconds,
114 info->gop->minutes, info->gop->seconds, info->gop->pictures); 113 info->gop->pictures);
115 ADD (format, EXTRACTOR_METATYPE_DURATION); 114 have_gop = 1;
116 finished &= ~1;
117 } 115 }
118 break; 116 break;
119 case STATE_SLICE: 117 case STATE_SLICE:
@@ -127,6 +125,8 @@ EXTRACTOR_mpeg_extract_method (struct EXTRACTOR_ExtractContext *ec)
127 } 125 }
128 } 126 }
129 EXIT: 127 EXIT:
128 if (1 == have_gop)
129 ADD (gop_format, EXTRACTOR_METATYPE_DURATION);
130 mpeg2_close (handle); 130 mpeg2_close (handle);
131} 131}
132 132
diff --git a/src/plugins/test_mpeg.c b/src/plugins/test_mpeg.c
index 88d8bd6..ab92f5e 100644
--- a/src/plugins/test_mpeg.c
+++ b/src/plugins/test_mpeg.c
@@ -63,17 +63,14 @@ main (int argc, char *argv[])
63 strlen ("MPEG1") + 1, 63 strlen ("MPEG1") + 1,
64 0 64 0
65 }, 65 },
66#if 0
67 /* GOP is somehow not working for this example */
68 { 66 {
69 EXTRACTOR_METATYPE_DURATION, 67 EXTRACTOR_METATYPE_DURATION,
70 EXTRACTOR_METAFORMAT_UTF8, 68 EXTRACTOR_METAFORMAT_UTF8,
71 "text/plain", 69 "text/plain",
72 "0:0:0 (0 frames)", /* FIXME: this is obviously the wrong answer */ 70 "00:00:03 (22 frames)",
73 strlen ("0:0:0 (0 frames)") + 1, 71 strlen ("00:00:03 (22 frames)") + 1,
74 0 72 0
75 }, 73 },
76#endif
77 { 0, 0, NULL, NULL, 0, -1 } 74 { 0, 0, NULL, NULL, 0, -1 }
78 }; 75 };
79 struct ProblemSet ps[] = 76 struct ProblemSet ps[] =