diff options
Diffstat (limited to 'libavcodec/dvdata.c')
-rw-r--r-- | libavcodec/dvdata.c | 41 |
1 files changed, 32 insertions, 9 deletions
diff --git a/libavcodec/dvdata.c b/libavcodec/dvdata.c index 353ecd5..fc526e3 100644 --- a/libavcodec/dvdata.c +++ b/libavcodec/dvdata.c @@ -2,20 +2,20 @@ * Constants for DV codec * Copyright (c) 2002 Fabrice Bellard * - * This file is part of Libav. + * This file is part of FFmpeg. * - * Libav is free software; you can redistribute it and/or + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * Libav is distributed in the hope that it will be useful, + * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -25,6 +25,7 @@ */ #include "libavutil/rational.h" +#include "libavutil/intreadwrite.h" #include "libavutil/pixdesc.h" #include "avcodec.h" #include "dvdata.h" @@ -377,12 +378,12 @@ static const DVprofile dv_profiles[] = { } }; -const DVprofile* avpriv_dv_frame_profile(const DVprofile *sys, +const DVprofile* avpriv_dv_frame_profile2(AVCodecContext* codec, const DVprofile *sys, const uint8_t* frame, unsigned buf_size) { int i, dsf, stype; - if (buf_size < 80 * 5 + 48 + 4) + if(buf_size < DV_PROFILE_BYTES) return NULL; dsf = (frame[3] & 0x80) >> 7; @@ -393,6 +394,9 @@ const DVprofile* avpriv_dv_frame_profile(const DVprofile *sys, return &dv_profiles[2]; } + if(stype == 0 && codec && codec->codec_tag==AV_RL32("dvsd") && codec->coded_width==720 && codec->coded_height==576) + return &dv_profiles[1]; + for (i = 0; i < FF_ARRAY_ELEMS(dv_profiles); i++) if (dsf == dv_profiles[i].dsf && stype == dv_profiles[i].video_stype) return &dv_profiles[i]; @@ -401,17 +405,36 @@ const DVprofile* avpriv_dv_frame_profile(const DVprofile *sys, if (sys && buf_size == sys->frame_size) return sys; + /* hack for trac issue #217, dv files created with QuickTime 3 */ + if ((frame[3] & 0x7f) == 0x3f && frame[80 * 5 + 48 + 3] == 0xff) + return &dv_profiles[dsf]; + return NULL; } +const DVprofile* avpriv_dv_frame_profile(const DVprofile *sys, + const uint8_t* frame, unsigned buf_size) +{ + return avpriv_dv_frame_profile2(NULL, sys, frame, buf_size); +} + const DVprofile* avpriv_dv_codec_profile(AVCodecContext* codec) { int i; + int w, h; + + if (codec->coded_width || codec->coded_height) { + w = codec->coded_width; + h = codec->coded_height; + } else { + w = codec->width; + h = codec->height; + } for (i=0; i<FF_ARRAY_ELEMS(dv_profiles); i++) - if (codec->height == dv_profiles[i].height && - codec->pix_fmt == dv_profiles[i].pix_fmt && - codec->width == dv_profiles[i].width) + if (h == dv_profiles[i].height && + codec->pix_fmt == dv_profiles[i].pix_fmt && + w == dv_profiles[i].width) return &dv_profiles[i]; return NULL; |