diff options
author | Mark Plomer <not-implemented@mark-plomer.de> | 2021-03-18 13:19:16 +0100 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2021-03-30 19:57:34 +0200 |
commit | 6ef5d8ca86c1d17e486300daa476dc6e0799f2f6 (patch) | |
tree | bb8937fa1c04fd6ec6eff62dc3b32c9c8c384553 /libavcodec/dv_profile.c | |
parent | 62f486e7930c5f1c8e4bfe342eb6a2bbd8cfd177 (diff) | |
download | ffmpeg-6ef5d8ca86c1d17e486300daa476dc6e0799f2f6.tar.gz |
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>
Diffstat (limited to 'libavcodec/dv_profile.c')
-rw-r--r-- | libavcodec/dv_profile.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/libavcodec/dv_profile.c b/libavcodec/dv_profile.c index 66505c886b..0fc227dd04 100644 --- a/libavcodec/dv_profile.c +++ b/libavcodec/dv_profile.c @@ -261,24 +261,22 @@ const AVDVProfile* ff_dv_frame_profile(AVCodecContext* codec, const AVDVProfile const uint8_t *frame, unsigned buf_size) { #if CONFIG_DVPROFILE - int i, dsf, stype; + int i, dsf, stype, pal; if(buf_size < DV_PROFILE_BYTES) return NULL; dsf = (frame[3] & 0x80) >> 7; stype = frame[80 * 5 + 48 + 3] & 0x1f; + pal = !!(frame[80 * 5 + 48 + 3] & 0x20); /* 576i50 25Mbps 4:1:1 is a special case */ if ((dsf == 1 && stype == 0 && frame[4] & 0x07 /* the APT field */) || (stype == 31 && codec && codec->codec_tag==AV_RL32("SL25") && codec->coded_width==720 && codec->coded_height==576)) return &dv_profiles[2]; - if( stype == 0 - && codec - && (codec->codec_tag==AV_RL32("dvsd") || codec->codec_tag==AV_RL32("CDVC")) - && codec->coded_width ==720 - && codec->coded_height==576) + /* hack for trac issues #8333 and #2177, PAL DV files with dsf flag 0 - detect via pal flag and buf_size */ + if (dsf == 0 && pal == 1 && stype == dv_profiles[1].video_stype && buf_size == dv_profiles[1].frame_size) return &dv_profiles[1]; for (i = 0; i < FF_ARRAY_ELEMS(dv_profiles); i++) |