mirror of https://git.ffmpeg.org/ffmpeg.git
avformat/dv: implement fallback in dv_extract_pack()
Fixes Ticket2340
Fixes Ticket2341
Based-on mail from Dave Rice <dave@dericed.com>
Tested-by: Dave Rice <dave@dericed.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 88f038ac97
)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
b7638af942
commit
eb1e5cf818
|
@ -72,30 +72,33 @@ static inline uint16_t dv_audio_12to16(uint16_t sample)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* This is the dumbest implementation of all -- it simply looks at
|
|
||||||
* a fixed offset and if pack isn't there -- fails. We might want
|
|
||||||
* to have a fallback mechanism for complete search of missing packs.
|
|
||||||
*/
|
|
||||||
static const uint8_t *dv_extract_pack(uint8_t *frame, enum dv_pack_type t)
|
static const uint8_t *dv_extract_pack(uint8_t *frame, enum dv_pack_type t)
|
||||||
{
|
{
|
||||||
int offs;
|
int offs;
|
||||||
|
int c;
|
||||||
|
|
||||||
switch (t) {
|
for (c = 0; c < 10; c++) {
|
||||||
case dv_audio_source:
|
switch (t) {
|
||||||
offs = (80 * 6 + 80 * 16 * 3 + 3);
|
case dv_audio_source:
|
||||||
break;
|
if (c&1) offs = (80 * 6 + 80 * 16 * 0 + 3 + c*12000);
|
||||||
case dv_audio_control:
|
else offs = (80 * 6 + 80 * 16 * 3 + 3 + c*12000);
|
||||||
offs = (80 * 6 + 80 * 16 * 4 + 3);
|
break;
|
||||||
break;
|
case dv_audio_control:
|
||||||
case dv_video_control:
|
if (c&1) offs = (80 * 6 + 80 * 16 * 1 + 3 + c*12000);
|
||||||
offs = (80 * 5 + 48 + 5);
|
else offs = (80 * 6 + 80 * 16 * 4 + 3 + c*12000);
|
||||||
break;
|
break;
|
||||||
case dv_timecode:
|
case dv_video_control:
|
||||||
offs = (80*1 + 3 + 3);
|
if (c&1) offs = (80 * 3 + 8 + c*12000);
|
||||||
break;
|
else offs = (80 * 5 + 48 + 5 + c*12000);
|
||||||
default:
|
break;
|
||||||
return NULL;
|
case dv_timecode:
|
||||||
|
offs = (80*1 + 3 + 3);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (frame[offs] == t)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return frame[offs] == t ? &frame[offs] : NULL;
|
return frame[offs] == t ? &frame[offs] : NULL;
|
||||||
|
|
Loading…
Reference in New Issue