diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-04-30 21:37:11 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-04-30 22:09:15 +0200 |
commit | ffdc49df25ec275c17e7f3e0ae5893185e3d9b93 (patch) | |
tree | 4362653639c73ec067061a3b9fd1f35bbf958668 | |
parent | 492026209b9b58eaf6d2ea56423f6b1e1a8a76a5 (diff) | |
download | ffmpeg-ffdc49df25ec275c17e7f3e0ae5893185e3d9b93.tar.gz |
AVIDEC: use_odmc demuxer specific option. (mostly an exmaple for demuxer specific options)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/avidec.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 97b392aef4..6a5d1e7a45 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -25,6 +25,7 @@ #include <strings.h> #include "libavutil/intreadwrite.h" #include "libavutil/bswap.h" +#include "libavutil/opt.h" #include "avformat.h" #include "avi.h" #include "dv.h" @@ -59,6 +60,7 @@ typedef struct AVIStream { } AVIStream; typedef struct { + const AVClass *class; int64_t riff_end; int64_t movi_end; int64_t fsize; @@ -70,9 +72,24 @@ typedef struct { int stream_index; DVDemuxContext* dv_demux; int odml_depth; + int use_odml; #define MAX_ODML_DEPTH 1000 } AVIContext; + +static const AVOption options[] = { + { "use_odml", "use odml index", offsetof(AVIContext, use_odml), FF_OPT_TYPE_INT, 1, -1, 1, AV_OPT_FLAG_DECODING_PARAM}, + { NULL }, +}; + +static const AVClass demuxer_class = { + "AVI demuxer", + av_default_item_name, + options, + LIBAVUTIL_VERSION_INT, +}; + + static const char avi_headers[][8] = { { 'R', 'I', 'F', 'F', 'A', 'V', 'I', ' ' }, { 'R', 'I', 'F', 'F', 'A', 'V', 'I', 'X' }, @@ -354,6 +371,8 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) if (get_riff(s, pb) < 0) return -1; + av_log(avi, AV_LOG_DEBUG, "use odml:%d\n", avi->use_odml); + avi->fsize = avio_size(pb); if(avi->fsize<=0) avi->fsize= avi->riff_end == 8 ? INT64_MAX : avi->riff_end; @@ -673,7 +692,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) break; case MKTAG('i', 'n', 'd', 'x'): i= avio_tell(pb); - if(pb->seekable && !(s->flags & AVFMT_FLAG_IGNIDX)){ + if(pb->seekable && !(s->flags & AVFMT_FLAG_IGNIDX) && avi->use_odml){ read_braindead_odml_indx(s, 0); } avio_seek(pb, i+size, SEEK_SET); @@ -1385,4 +1404,5 @@ AVInputFormat ff_avi_demuxer = { avi_read_packet, avi_read_close, avi_read_seek, + .priv_class = &demuxer_class, }; |