typefind: Fix mp3 typefinding with multiple different headers
(yes, this has never worked since it was introduced, don't worry) If we want to actually detect layer/channels/samplerate changes, it would be better to: * not reset the various prev_* variables at every iteration. * and actually store the values when they change CID #206079 CID #206080 CID #206081
This commit is contained in:
parent
7cc1431a56
commit
384d27002c
@ -1443,12 +1443,12 @@ mp3_type_find_at_offset (GstTypeFind * tf, guint64 start_off,
|
|||||||
guint found = 0; /* number of valid headers found */
|
guint found = 0; /* number of valid headers found */
|
||||||
guint64 offset = skipped;
|
guint64 offset = skipped;
|
||||||
gboolean changed = FALSE;
|
gboolean changed = FALSE;
|
||||||
|
guint prev_layer = 0;
|
||||||
|
guint prev_channels = 0, prev_samplerate = 0;
|
||||||
|
|
||||||
while (found < GST_MP3_TYPEFIND_TRY_HEADERS) {
|
while (found < GST_MP3_TYPEFIND_TRY_HEADERS) {
|
||||||
guint32 head;
|
guint32 head;
|
||||||
guint length;
|
guint length;
|
||||||
guint prev_layer = 0;
|
|
||||||
guint prev_channels = 0, prev_samplerate = 0;
|
|
||||||
gboolean free = FALSE;
|
gboolean free = FALSE;
|
||||||
|
|
||||||
if ((gint64) (offset - skipped + 4) >= 0 &&
|
if ((gint64) (offset - skipped + 4) >= 0 &&
|
||||||
@ -1495,15 +1495,16 @@ mp3_type_find_at_offset (GstTypeFind * tf, guint64 start_off,
|
|||||||
* this header*/
|
* this header*/
|
||||||
if (prev_layer)
|
if (prev_layer)
|
||||||
changed = TRUE;
|
changed = TRUE;
|
||||||
prev_layer = layer;
|
|
||||||
prev_channels = channels;
|
|
||||||
prev_samplerate = samplerate;
|
|
||||||
} else {
|
} else {
|
||||||
found++;
|
found++;
|
||||||
GST_LOG ("found %d. header at offset %" G_GUINT64_FORMAT " (0x%"
|
GST_LOG ("found %d. header at offset %" G_GUINT64_FORMAT " (0x%"
|
||||||
G_GINT64_MODIFIER "X)", found, start_off + offset,
|
G_GINT64_MODIFIER "X)", found, start_off + offset,
|
||||||
start_off + offset);
|
start_off + offset);
|
||||||
}
|
}
|
||||||
|
prev_layer = layer;
|
||||||
|
prev_channels = channels;
|
||||||
|
prev_samplerate = samplerate;
|
||||||
|
|
||||||
offset += length;
|
offset += length;
|
||||||
}
|
}
|
||||||
g_assert (found <= GST_MP3_TYPEFIND_TRY_HEADERS);
|
g_assert (found <= GST_MP3_TYPEFIND_TRY_HEADERS);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user