Skip to content

Commit 76b5f72

Browse files
not-implementedcus
authored andcommitted
avcodec/dv_profile: PAL DV files with dsf flag 0 - detect via pal flag and buf_size
Some old DV AVI files have the DSF-Flag of frames set to 0, although it is PAL (maybe rendered with an old Ulead Media Studio Pro) ... this causes ffmpeg/VLC-player to produce/play corrupted video (other players/editors like VirtualDub work fine). Fixes ticket #8333 and replaces/extends hack for ticket #2177 Signed-off-by: Marton Balint <cus@passwd.hu> (cherry picked from commit 6ef5d8c)
1 parent 6a7a398 commit 76b5f72

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

libavcodec/dv_profile.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -261,24 +261,22 @@ const AVDVProfile* ff_dv_frame_profile(AVCodecContext* codec, const AVDVProfile
261261
const uint8_t *frame, unsigned buf_size)
262262
{
263263
#if CONFIG_DVPROFILE
264-
int i, dsf, stype;
264+
int i, dsf, stype, pal;
265265

266266
if(buf_size < DV_PROFILE_BYTES)
267267
return NULL;
268268

269269
dsf = (frame[3] & 0x80) >> 7;
270270
stype = frame[80 * 5 + 48 + 3] & 0x1f;
271+
pal = !!(frame[80 * 5 + 48 + 3] & 0x20);
271272

272273
/* 576i50 25Mbps 4:1:1 is a special case */
273274
if ((dsf == 1 && stype == 0 && frame[4] & 0x07 /* the APT field */) ||
274275
(stype == 31 && codec && codec->codec_tag==AV_RL32("SL25") && codec->coded_width==720 && codec->coded_height==576))
275276
return &dv_profiles[2];
276277

277-
if( stype == 0
278-
&& codec
279-
&& (codec->codec_tag==AV_RL32("dvsd") || codec->codec_tag==AV_RL32("CDVC"))
280-
&& codec->coded_width ==720
281-
&& codec->coded_height==576)
278+
/* hack for trac issues #8333 and #2177, PAL DV files with dsf flag 0 - detect via pal flag and buf_size */
279+
if (dsf == 0 && pal == 1 && stype == dv_profiles[1].video_stype && buf_size == dv_profiles[1].frame_size)
282280
return &dv_profiles[1];
283281

284282
for (i = 0; i < FF_ARRAY_ELEMS(dv_profiles); i++)

0 commit comments

Comments
 (0)