aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-02-01 02:08:23 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-02-01 02:36:09 +0100
commita369a6b85819890b21a87af3ce983ce533b7169b (patch)
tree838f9821dc09bd99b59ce4a2d8123d5fd6868b91 /libavformat
parent0a3a69e8d77146b53a1112c715a78e7d293883b1 (diff)
parent52afc9716849e6fb6c2420674d790d374061c663 (diff)
downloadffmpeg-a369a6b85819890b21a87af3ce983ce533b7169b.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: (29 commits) fate: add golomb-test golomb-test: K&R formatting cosmetics h264: Split h264-test off into a separate file - golomb-test.c. h264-test: cleanup: drop timer invocations, commented out code and other cruft h264-test: Remove unused DSP and AVCodec contexts and related init calls. adpcm: Add missing stdint.h #include to fix standalone header compilation. lavf: add functions for accessing the fourcc<->CodecID mapping tables. lavc: set AVCodecContext.codec in avcodec_get_context_defaults3(). lavc: make avcodec_close() work properly on unopened codecs. lavc: add avcodec_is_open(). lavf: rename AVInputFormat.value to raw_codec_id. lavf: remove the pointless value field from flv and iv8 lavc/lavf: remove unnecessary symbols from the symbol version script. lavc: reorder AVCodec fields. lavf: reorder AVInput/OutputFormat fields. mp3dec: Fix a heap-buffer-overflow adpcmenc: remove some unneeded casts adpcmenc: use int16_t and uint8_t instead of short and unsigned char. adpcmenc: fix adpcm_ms extradata allocation adpcmenc: return proper AVERROR codes instead of -1 ... Conflicts: doc/APIchanges libavcodec/Makefile libavcodec/adpcmenc.c libavcodec/avcodec.h libavcodec/h264.c libavcodec/libavcodec.v libavcodec/mpc7.c libavcodec/mpegaudiodec.c libavcodec/options.c libavformat/Makefile libavformat/avformat.h libavformat/flvdec.c libavformat/libavformat.v Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/Makefile56
-rw-r--r--libavformat/aacdec.c4
-rw-r--r--libavformat/ac3dec.c4
-rw-r--r--libavformat/adxdec.c4
-rw-r--r--libavformat/avformat.h133
-rw-r--r--libavformat/dtsdec.c2
-rw-r--r--libavformat/flacdec.c2
-rw-r--r--libavformat/flvdec.c11
-rw-r--r--libavformat/gsmdec.c4
-rw-r--r--libavformat/ingenientdec.c2
-rw-r--r--libavformat/iv8.c1
-rw-r--r--libavformat/loasdec.c4
-rw-r--r--libavformat/mov.c2
-rw-r--r--libavformat/pcmdec.c2
-rw-r--r--libavformat/rawdec.c16
-rw-r--r--libavformat/rawdec.h2
-rw-r--r--libavformat/rawvideodec.c2
-rw-r--r--libavformat/utils.c22
18 files changed, 158 insertions, 115 deletions
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 623cd65234..bd2b17b6cd 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -12,6 +12,7 @@ OBJS = allformats.o \
metadata.o \
options.o \
os_support.o \
+ riff.o \
sdp.o \
seek.o \
utils.o \
@@ -29,8 +30,8 @@ OBJS-$(CONFIG_ADX_DEMUXER) += adxdec.o
OBJS-$(CONFIG_ADX_MUXER) += rawenc.o
OBJS-$(CONFIG_ADTS_MUXER) += adtsenc.o
OBJS-$(CONFIG_AEA_DEMUXER) += aea.o pcm.o
-OBJS-$(CONFIG_AIFF_DEMUXER) += aiffdec.o riff.o pcm.o isom.o
-OBJS-$(CONFIG_AIFF_MUXER) += aiffenc.o riff.o isom.o
+OBJS-$(CONFIG_AIFF_DEMUXER) += aiffdec.o pcm.o isom.o
+OBJS-$(CONFIG_AIFF_MUXER) += aiffenc.o isom.o
OBJS-$(CONFIG_AMR_DEMUXER) += amr.o
OBJS-$(CONFIG_AMR_MUXER) += amr.o
OBJS-$(CONFIG_ANM_DEMUXER) += anm.o
@@ -38,14 +39,14 @@ OBJS-$(CONFIG_APC_DEMUXER) += apc.o
OBJS-$(CONFIG_APE_DEMUXER) += ape.o apetag.o
OBJS-$(CONFIG_APPLEHTTP_DEMUXER) += applehttp.o
OBJS-$(CONFIG_ASF_DEMUXER) += asfdec.o asf.o asfcrypt.o \
- riff.o avlanguage.o
-OBJS-$(CONFIG_ASF_MUXER) += asfenc.o asf.o riff.o
+ avlanguage.o
+OBJS-$(CONFIG_ASF_MUXER) += asfenc.o asf.o
OBJS-$(CONFIG_ASS_DEMUXER) += assdec.o
OBJS-$(CONFIG_ASS_MUXER) += assenc.o
OBJS-$(CONFIG_AU_DEMUXER) += au.o pcm.o
OBJS-$(CONFIG_AU_MUXER) += au.o
-OBJS-$(CONFIG_AVI_DEMUXER) += avidec.o riff.o
-OBJS-$(CONFIG_AVI_MUXER) += avienc.o riff.o
+OBJS-$(CONFIG_AVI_DEMUXER) += avidec.o
+OBJS-$(CONFIG_AVI_MUXER) += avienc.o
OBJS-$(CONFIG_AVISYNTH) += avisynth.o
OBJS-$(CONFIG_AVM2_MUXER) += swfenc.o
OBJS-$(CONFIG_AVS_DEMUXER) += avs.o vocdec.o voc.o
@@ -58,7 +59,7 @@ OBJS-$(CONFIG_BIT_MUXER) += bit.o
OBJS-$(CONFIG_BMV_DEMUXER) += bmv.o
OBJS-$(CONFIG_C93_DEMUXER) += c93.o vocdec.o voc.o
OBJS-$(CONFIG_CAF_DEMUXER) += cafdec.o caf.o mov.o mov_chan.o \
- riff.o isom.o
+ isom.o
OBJS-$(CONFIG_CAF_MUXER) += cafenc.o caf.o riff.o isom.o
OBJS-$(CONFIG_CAVSVIDEO_DEMUXER) += cavsvideodec.o rawdec.o
OBJS-$(CONFIG_CAVSVIDEO_MUXER) += rawenc.o
@@ -76,7 +77,7 @@ OBJS-$(CONFIG_DTS_DEMUXER) += dtsdec.o rawdec.o
OBJS-$(CONFIG_DTS_MUXER) += rawenc.o
OBJS-$(CONFIG_DV_DEMUXER) += dv.o
OBJS-$(CONFIG_DV_MUXER) += dvenc.o
-OBJS-$(CONFIG_DXA_DEMUXER) += dxa.o riff.o
+OBJS-$(CONFIG_DXA_DEMUXER) += dxa.o
OBJS-$(CONFIG_EA_CDATA_DEMUXER) += eacdata.o
OBJS-$(CONFIG_EA_DEMUXER) += electronicarts.o
OBJS-$(CONFIG_EAC3_DEMUXER) += ac3dec.o rawdec.o
@@ -125,7 +126,7 @@ OBJS-$(CONFIG_INGENIENT_DEMUXER) += ingenientdec.o rawdec.o
OBJS-$(CONFIG_IPMOVIE_DEMUXER) += ipmovie.o
OBJS-$(CONFIG_ISS_DEMUXER) += iss.o
OBJS-$(CONFIG_IV8_DEMUXER) += iv8.o
-OBJS-$(CONFIG_IVF_DEMUXER) += ivfdec.o riff.o
+OBJS-$(CONFIG_IVF_DEMUXER) += ivfdec.o
OBJS-$(CONFIG_IVF_MUXER) += ivfenc.o
OBJS-$(CONFIG_JV_DEMUXER) += jvdec.o
OBJS-$(CONFIG_LATM_DEMUXER) += rawdec.o
@@ -136,9 +137,9 @@ OBJS-$(CONFIG_LXF_DEMUXER) += lxfdec.o
OBJS-$(CONFIG_M4V_DEMUXER) += m4vdec.o rawdec.o
OBJS-$(CONFIG_M4V_MUXER) += rawenc.o
OBJS-$(CONFIG_MATROSKA_DEMUXER) += matroskadec.o matroska.o \
- riff.o isom.o rmdec.o rm.o
+ isom.o rmdec.o rm.o
OBJS-$(CONFIG_MATROSKA_MUXER) += matroskaenc.o matroska.o \
- riff.o isom.o avc.o \
+ isom.o avc.o \
flacenc_header.o avlanguage.o
OBJS-$(CONFIG_MD5_MUXER) += md5enc.o
OBJS-$(CONFIG_MICRODVD_DEMUXER) += microdvddec.o
@@ -149,9 +150,9 @@ OBJS-$(CONFIG_MLP_DEMUXER) += rawdec.o
OBJS-$(CONFIG_MLP_MUXER) += rawenc.o
OBJS-$(CONFIG_MM_DEMUXER) += mm.o
OBJS-$(CONFIG_MMF_DEMUXER) += mmf.o pcm.o
-OBJS-$(CONFIG_MMF_MUXER) += mmf.o riff.o
-OBJS-$(CONFIG_MOV_DEMUXER) += mov.o riff.o isom.o mov_chan.o
-OBJS-$(CONFIG_MOV_MUXER) += movenc.o riff.o isom.o avc.o \
+OBJS-$(CONFIG_MMF_MUXER) += mmf.o
+OBJS-$(CONFIG_MOV_DEMUXER) += mov.o isom.o mov_chan.o
+OBJS-$(CONFIG_MOV_MUXER) += movenc.o isom.o avc.o \
movenchint.o rtpenc_chain.o \
mov_chan.o
OBJS-$(CONFIG_MP2_MUXER) += mp3enc.o rawenc.o
@@ -180,9 +181,9 @@ OBJS-$(CONFIG_MXG_DEMUXER) += mxg.o
OBJS-$(CONFIG_NC_DEMUXER) += ncdec.o
OBJS-$(CONFIG_NSV_DEMUXER) += nsvdec.o
OBJS-$(CONFIG_NULL_MUXER) += nullenc.o
-OBJS-$(CONFIG_NUT_DEMUXER) += nutdec.o nut.o riff.o
-OBJS-$(CONFIG_NUT_MUXER) += nutenc.o nut.o riff.o
-OBJS-$(CONFIG_NUV_DEMUXER) += nuv.o riff.o
+OBJS-$(CONFIG_NUT_DEMUXER) += nutdec.o nut.o
+OBJS-$(CONFIG_NUT_MUXER) += nutenc.o nut.o
+OBJS-$(CONFIG_NUV_DEMUXER) += nuv.o
OBJS-$(CONFIG_OGG_DEMUXER) += oggdec.o \
oggparsecelt.o \
oggparsedirac.o \
@@ -192,7 +193,6 @@ OBJS-$(CONFIG_OGG_DEMUXER) += oggdec.o \
oggparsespeex.o \
oggparsetheora.o \
oggparsevorbis.o \
- riff.o \
vorbiscomment.o
OBJS-$(CONFIG_OGG_MUXER) += oggenc.o \
vorbiscomment.o
@@ -319,31 +319,31 @@ OBJS-$(CONFIG_VMD_DEMUXER) += sierravmd.o
OBJS-$(CONFIG_VOC_DEMUXER) += vocdec.o voc.o
OBJS-$(CONFIG_VOC_MUXER) += vocenc.o voc.o
OBJS-$(CONFIG_VQF_DEMUXER) += vqf.o
-OBJS-$(CONFIG_W64_DEMUXER) += wav.o riff.o pcm.o
-OBJS-$(CONFIG_WAV_DEMUXER) += wav.o riff.o pcm.o
-OBJS-$(CONFIG_WAV_MUXER) += wav.o riff.o
+OBJS-$(CONFIG_W64_DEMUXER) += wav.o pcm.o
+OBJS-$(CONFIG_WAV_DEMUXER) += wav.o pcm.o
+OBJS-$(CONFIG_WAV_MUXER) += wav.o
OBJS-$(CONFIG_WC3_DEMUXER) += wc3movie.o
OBJS-$(CONFIG_WEBM_MUXER) += matroskaenc.o matroska.o \
- riff.o isom.o avc.o \
+ isom.o avc.o \
flacenc_header.o avlanguage.o
OBJS-$(CONFIG_WSAUD_DEMUXER) += westwood_aud.o
OBJS-$(CONFIG_WSVQA_DEMUXER) += westwood_vqa.o
OBJS-$(CONFIG_WTV_DEMUXER) += wtvdec.o wtv.o asfdec.o asf.o asfcrypt.o \
- avlanguage.o mpegts.o isom.o riff.o
-OBJS-$(CONFIG_WTV_MUXER) += wtvenc.o wtv.o asf.o asfenc.o riff.o
+ avlanguage.o mpegts.o isom.o
+OBJS-$(CONFIG_WTV_MUXER) += wtvenc.o wtv.o asf.o asfenc.o
OBJS-$(CONFIG_WV_DEMUXER) += wv.o apetag.o
OBJS-$(CONFIG_XA_DEMUXER) += xa.o
OBJS-$(CONFIG_XBIN_DEMUXER) += bintext.o sauce.o
-OBJS-$(CONFIG_XMV_DEMUXER) += xmv.o riff.o
-OBJS-$(CONFIG_XWMA_DEMUXER) += xwma.o riff.o
+OBJS-$(CONFIG_XMV_DEMUXER) += xmv.o
+OBJS-$(CONFIG_XWMA_DEMUXER) += xwma.o
OBJS-$(CONFIG_YOP_DEMUXER) += yop.o
OBJS-$(CONFIG_YUV4MPEGPIPE_MUXER) += yuv4mpeg.o
OBJS-$(CONFIG_YUV4MPEGPIPE_DEMUXER) += yuv4mpeg.o
# external libraries
OBJS-$(CONFIG_LIBMODPLUG_DEMUXER) += libmodplug.o
-OBJS-$(CONFIG_LIBNUT_DEMUXER) += libnut.o riff.o
-OBJS-$(CONFIG_LIBNUT_MUXER) += libnut.o riff.o
+OBJS-$(CONFIG_LIBNUT_DEMUXER) += libnut.o
+OBJS-$(CONFIG_LIBNUT_MUXER) += libnut.o
# protocols I/O
OBJS+= avio.o aviobuf.o
diff --git a/libavformat/aacdec.c b/libavformat/aacdec.c
index ff58c36675..156a3509a4 100644
--- a/libavformat/aacdec.c
+++ b/libavformat/aacdec.c
@@ -71,7 +71,7 @@ static int adts_aac_read_header(AVFormatContext *s)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = s->iformat->value;
+ st->codec->codec_id = s->iformat->raw_codec_id;
st->need_parsing = AVSTREAM_PARSE_FULL;
ff_id3v1_read(s);
@@ -90,5 +90,5 @@ AVInputFormat ff_aac_demuxer = {
.read_packet = ff_raw_read_partial_packet,
.flags= AVFMT_GENERIC_INDEX,
.extensions = "aac",
- .value = CODEC_ID_AAC,
+ .raw_codec_id = CODEC_ID_AAC,
};
diff --git a/libavformat/ac3dec.c b/libavformat/ac3dec.c
index f1421dc058..849b8360f8 100644
--- a/libavformat/ac3dec.c
+++ b/libavformat/ac3dec.c
@@ -80,7 +80,7 @@ AVInputFormat ff_ac3_demuxer = {
.read_packet = ff_raw_read_partial_packet,
.flags= AVFMT_GENERIC_INDEX,
.extensions = "ac3",
- .value = CODEC_ID_AC3,
+ .raw_codec_id = CODEC_ID_AC3,
};
#endif
@@ -98,6 +98,6 @@ AVInputFormat ff_eac3_demuxer = {
.read_packet = ff_raw_read_partial_packet,
.flags= AVFMT_GENERIC_INDEX,
.extensions = "eac3",
- .value = CODEC_ID_EAC3,
+ .raw_codec_id = CODEC_ID_EAC3,
};
#endif
diff --git a/libavformat/adxdec.c b/libavformat/adxdec.c
index 243160940c..305c67431b 100644
--- a/libavformat/adxdec.c
+++ b/libavformat/adxdec.c
@@ -94,7 +94,7 @@ static int adx_read_header(AVFormatContext *s)
return ret;
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = s->iformat->value;
+ st->codec->codec_id = s->iformat->raw_codec_id;
avpriv_set_pts_info(st, 64, BLOCK_SAMPLES, avctx->sample_rate);
@@ -108,6 +108,6 @@ AVInputFormat ff_adx_demuxer = {
.read_header = adx_read_header,
.read_packet = adx_read_packet,
.extensions = "adx",
- .value = CODEC_ID_ADPCM_ADX,
+ .raw_codec_id = CODEC_ID_ADPCM_ADX,
.flags = AVFMT_GENERIC_INDEX,
};
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 55616a8010..dae0c07ffb 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -312,13 +312,39 @@ typedef struct AVOutputFormat {
const char *long_name;
const char *mime_type;
const char *extensions; /**< comma-separated filename extensions */
+ /* output support */
+ enum CodecID audio_codec; /**< default audio codec */
+ enum CodecID video_codec; /**< default video codec */
+ enum CodecID subtitle_codec; /**< default subtitle codec */
+ /**
+ * can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_RAWPICTURE,
+ * AVFMT_GLOBALHEADER, AVFMT_NOTIMESTAMPS, AVFMT_VARIABLE_FPS,
+ * AVFMT_NODIMENSIONS, AVFMT_NOSTREAMS, AVFMT_ALLOW_FLUSH
+ */
+ int flags;
+
+ /**
+ * List of supported codec_id-codec_tag pairs, ordered by "better
+ * choice first". The arrays are all terminated by CODEC_ID_NONE.
+ */
+ const struct AVCodecTag * const *codec_tag;
+
+
+ const AVClass *priv_class; ///< AVClass for the private context
+
+ /*****************************************************************
+ * No fields below this line are part of the public API. They
+ * may not be used outside of libavformat and can be changed and
+ * removed at will.
+ * New public fields should be added right above.
+ *****************************************************************
+ */
+ struct AVOutputFormat *next;
/**
* size of private data so that it can be allocated in the wrapper
*/
int priv_data_size;
- /* output support */
- enum CodecID audio_codec; /**< default audio codec */
- enum CodecID video_codec; /**< default video codec */
+
int (*write_header)(struct AVFormatContext *);
/**
* Write a packet. If AVFMT_ALLOW_FLUSH is set in flags,
@@ -330,24 +356,10 @@ typedef struct AVOutputFormat {
int (*write_packet)(struct AVFormatContext *, AVPacket *pkt);
int (*write_trailer)(struct AVFormatContext *);
/**
- * can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_RAWPICTURE,
- * AVFMT_GLOBALHEADER, AVFMT_NOTIMESTAMPS, AVFMT_VARIABLE_FPS,
- * AVFMT_NODIMENSIONS, AVFMT_NOSTREAMS, AVFMT_ALLOW_FLUSH
+ * Currently only used to set pixel format if not YUV420P.
*/
- int flags;
int (*interleave_packet)(struct AVFormatContext *, AVPacket *out,
AVPacket *in, int flush);
-
- /**
- * List of supported codec_id-codec_tag pairs, ordered by "better
- * choice first". The arrays are all terminated by CODEC_ID_NONE.
- */
- const struct AVCodecTag * const *codec_tag;
-
- enum CodecID subtitle_codec; /**< default subtitle codec */
-
- const AVClass *priv_class; ///< AVClass for the private context
-
/**
* Test if the given codec can be stored in this container.
*
@@ -358,9 +370,6 @@ typedef struct AVOutputFormat {
void (*get_output_timestamp)(struct AVFormatContext *s, int stream,
int64_t *dts, int64_t *wall);
-
- /* private fields */
- struct AVOutputFormat *next;
} AVOutputFormat;
/**
* @}
@@ -385,6 +394,38 @@ typedef struct AVInputFormat {
const char *long_name;
/**
+ * Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS,
+ * AVFMT_GENERIC_INDEX, AVFMT_TS_DISCONT, AVFMT_NOBINSEARCH,
+ * AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK.
+ */
+ int flags;
+
+ /**
+ * If extensions are defined, then no probe is done. You should
+ * usually not use extension format guessing because it is not
+ * reliable enough
+ */
+ const char *extensions;
+
+ const struct AVCodecTag * const *codec_tag;
+
+ const AVClass *priv_class; ///< AVClass for the private context
+
+ /*****************************************************************
+ * No fields below this line are part of the public API. They
+ * may not be used outside of libavformat and can be changed and
+ * removed at will.
+ * New public fields should be added right above.
+ *****************************************************************
+ */
+ struct AVInputFormat *next;
+
+ /**
+ * Raw demuxers store their codec ID here.
+ */
+ int raw_codec_id;
+
+ /**
* Size of private data so that it can be allocated in the wrapper.
*/
int priv_data_size;
@@ -440,25 +481,6 @@ typedef struct AVInputFormat {
int64_t *pos, int64_t pos_limit);
/**
- * Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS,
- * AVFMT_GENERIC_INDEX, AVFMT_TS_DISCONT, AVFMT_NOBINSEARCH,
- * AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK.
- */
- int flags;
-
- /**
- * If extensions are defined, then no probe is done. You should
- * usually not use extension format guessing because it is not
- * reliable enough
- */
- const char *extensions;
-
- /**
- * General purpose read-only value that the format can use.
- */
- int value;
-
- /**
* Start/resume playing - only meaningful if using a network-based format
* (RTSP).
*/
@@ -470,8 +492,6 @@ typedef struct AVInputFormat {
*/
int (*read_pause)(struct AVFormatContext *);
- const struct AVCodecTag * const *codec_tag;
-
/**
* Seek to timestamp ts.
* Seeking will be done so that the point from which all active streams
@@ -479,11 +499,6 @@ typedef struct AVInputFormat {
* Active streams are all streams that have AVStream.discard < AVDISCARD_ALL.
*/
int (*read_seek2)(struct AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags);
-
- const AVClass *priv_class; ///< AVClass for the private context
-
- /* private fields */
- struct AVInputFormat *next;
} AVInputFormat;
/**
* @}
@@ -1775,6 +1790,30 @@ int av_match_ext(const char *filename, const char *extensions);
int avformat_query_codec(AVOutputFormat *ofmt, enum CodecID codec_id, int std_compliance);
/**
+ * @defgroup riff_fourcc RIFF FourCCs
+ * @{
+ * Get the tables mapping RIFF FourCCs to libavcodec CodecIDs. The tables are
+ * meant to be passed to av_codec_get_id()/av_codec_get_tag() as in the
+ * following code:
+ * @code
+ * uint32_t tag = MKTAG('H', '2', '6', '4');
+ * const struct AVCodecTag *table[] = { avformat_get_riff_video_tags(), 0 };
+ * enum CodecID id = av_codec_get_id(table, tag);
+ * @endcode
+ */
+/**
+ * @return the table mapping RIFF FourCCs for video to libavcodec CodecID.
+ */
+const struct AVCodecTag *avformat_get_riff_video_tags(void);
+/**
+ * @return the table mapping RIFF FourCCs for audio to CodecID.
+ */
+const struct AVCodecTag *avformat_get_riff_audio_tags(void);
+/**
+ * @}
+ */
+
+/**
* @}
*/
diff --git a/libavformat/dtsdec.c b/libavformat/dtsdec.c
index e762b85e19..7395d79f91 100644
--- a/libavformat/dtsdec.c
+++ b/libavformat/dtsdec.c
@@ -73,5 +73,5 @@ AVInputFormat ff_dts_demuxer = {
.read_packet = ff_raw_read_partial_packet,
.flags= AVFMT_GENERIC_INDEX,
.extensions = "dts",
- .value = CODEC_ID_DTS,
+ .raw_codec_id = CODEC_ID_DTS,
};
diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c
index 65a75b2c48..95362922ed 100644
--- a/libavformat/flacdec.c
+++ b/libavformat/flacdec.c
@@ -157,5 +157,5 @@ AVInputFormat ff_flac_demuxer = {
.read_packet = ff_raw_read_partial_packet,
.flags= AVFMT_GENERIC_INDEX,
.extensions = "flac",
- .value = CODEC_ID_FLAC,
+ .raw_codec_id = CODEC_ID_FLAC,
};
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 1f1424e949..ffb84e9794 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -233,22 +233,18 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst
if(amf_get_string(ioc, str_val, sizeof(str_val)) < 0)
return -1;
break;
- case AMF_DATA_TYPE_OBJECT: {
- unsigned int keylen;
-
+ case AMF_DATA_TYPE_OBJECT:
if ((vstream || astream) && ioc->seekable && key && !strcmp(KEYFRAMES_TAG, key) && depth == 1)
if (parse_keyframes_index(s, ioc, vstream ? vstream : astream,
max_pos) < 0)
av_log(s, AV_LOG_ERROR, "Keyframe index parsing failed\n");
- while(avio_tell(ioc) < max_pos - 2 && (keylen = avio_rb16(ioc))) {
- avio_skip(ioc, keylen); //skip key string
- if(amf_parse_object(s, NULL, NULL, NULL, max_pos, depth + 1) < 0)
+ while (avio_tell(ioc) < max_pos - 2 && amf_get_string(ioc, str_val, sizeof(str_val)) > 0) {
+ if (amf_parse_object(s, astream, vstream, str_val, max_pos, depth + 1) < 0)
return -1; //if we couldn't skip, bomb out.
}
if(avio_r8(ioc) != AMF_END_OF_OBJECT)
return -1;
- }
break;
case AMF_DATA_TYPE_NULL:
case AMF_DATA_TYPE_UNDEFINED:
@@ -697,5 +693,4 @@ AVInputFormat ff_flv_demuxer = {
#endif
.read_close = flv_read_close,
.extensions = "flv",
- .value = CODEC_ID_FLV1,
};
diff --git a/libavformat/gsmdec.c b/libavformat/gsmdec.c
index 5d6495860a..3525a038c7 100644
--- a/libavformat/gsmdec.c
+++ b/libavformat/gsmdec.c
@@ -62,7 +62,7 @@ static int gsm_read_header(AVFormatContext *s)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = s->iformat->value;
+ st->codec->codec_id = s->iformat->raw_codec_id;
st->codec->channels = 1;
st->codec->sample_rate = c->sample_rate;
st->codec->bit_rate = GSM_BLOCK_SIZE * 8 * c->sample_rate / GSM_BLOCK_SAMPLES;
@@ -94,6 +94,6 @@ AVInputFormat ff_gsm_demuxer = {
.read_packet = gsm_read_packet,
.flags = AVFMT_GENERIC_INDEX,
.extensions = "gsm",
- .value = CODEC_ID_GSM,
+ .raw_codec_id = CODEC_ID_GSM,
.priv_class = &class,
};
diff --git a/libavformat/ingenientdec.c b/libavformat/ingenientdec.c
index 97774abbcd..0ce2b5718c 100644
--- a/libavformat/ingenientdec.c
+++ b/libavformat/ingenientdec.c
@@ -68,6 +68,6 @@ AVInputFormat ff_ingenient_demuxer = {
.read_packet = ingenient_read_packet,
.flags= AVFMT_GENERIC_INDEX,
.extensions = "cgi", // FIXME
- .value = CODEC_ID_MJPEG,
+ .raw_codec_id = CODEC_ID_MJPEG,
.priv_class = &ingenient_demuxer_class,
};
diff --git a/libavformat/iv8.c b/libavformat/iv8.c
index e431c342db..21f70d504a 100644
--- a/libavformat/iv8.c
+++ b/libavformat/iv8.c
@@ -115,5 +115,4 @@ AVInputFormat ff_iv8_demuxer = {
.read_header = read_header,
.read_packet = read_packet,
.flags= AVFMT_GENERIC_INDEX,
- .value = CODEC_ID_MPEG4,
};
diff --git a/libavformat/loasdec.c b/libavformat/loasdec.c
index 5c8a8be573..4b4e04fff9 100644
--- a/libavformat/loasdec.c
+++ b/libavformat/loasdec.c
@@ -68,7 +68,7 @@ static int loas_read_header(AVFormatContext *s)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = s->iformat->value;
+ st->codec->codec_id = s->iformat->raw_codec_id;
st->need_parsing = AVSTREAM_PARSE_FULL;
//LCM of all possible AAC sample rates
@@ -84,5 +84,5 @@ AVInputFormat ff_loas_demuxer = {
.read_header = loas_read_header,
.read_packet = ff_raw_read_partial_packet,
.flags= AVFMT_GENERIC_INDEX,
- .value = CODEC_ID_AAC_LATM,
+ .raw_codec_id = CODEC_ID_AAC_LATM,
};
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 0968da264a..851997ca61 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2341,7 +2341,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
sc->ctts_data[sc->ctts_count].duration = (flags & 0x800) ? avio_rb32(pb) : 0;
sc->ctts_count++;
if ((keyframe = st->codec->codec_type == AVMEDIA_TYPE_AUDIO ||
- (flags & 0x004 && !i && !sample_flags) || sample_flags & 0x2000000))
+ (flags & 0x004 && !i && !(sample_flags & 0xffff0000)) || sample_flags & 0x2000000))
distance = 0;
av_add_index_entry(st, offset, dts, sample_size, distance,
keyframe ? AVINDEX_KEYFRAME : 0);
diff --git a/libavformat/pcmdec.c b/libavformat/pcmdec.c
index 542ee17749..e27a6b908c 100644
--- a/libavformat/pcmdec.c
+++ b/libavformat/pcmdec.c
@@ -70,7 +70,7 @@ AVInputFormat ff_pcm_ ## name_ ## _demuxer = { \
.read_seek = pcm_read_seek, \
.flags = AVFMT_GENERIC_INDEX, \
.extensions = ext, \
- .value = codec, \
+ .raw_codec_id = codec, \
.priv_class = &name_ ## _demuxer_class, \
};
diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c
index f7c0de8c25..34e4ae05b5 100644
--- a/libavformat/rawdec.c
+++ b/libavformat/rawdec.c
@@ -38,7 +38,7 @@ int ff_raw_read_header(AVFormatContext *s)
if (!st)
return AVERROR(ENOMEM);
- id = s->iformat->value;
+ id = s->iformat->raw_codec_id;
if (id == CODEC_ID_RAWVIDEO) {
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
} else {
@@ -132,7 +132,7 @@ int ff_raw_audio_read_header(AVFormatContext *s)
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = s->iformat->value;
+ st->codec->codec_id = s->iformat->raw_codec_id;
st->need_parsing = AVSTREAM_PARSE_FULL;
st->start_time = 0;
/* the parameters will be extracted from the compressed bitstream */
@@ -156,7 +156,7 @@ int ff_raw_video_read_header(AVFormatContext *s)
}
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = s->iformat->value;
+ st->codec->codec_id = s->iformat->raw_codec_id;
st->need_parsing = AVSTREAM_PARSE_FULL;
if ((ret = av_parse_video_rate(&framerate, s1->framerate)) < 0) {
@@ -188,7 +188,7 @@ AVInputFormat ff_g722_demuxer = {
.read_packet = ff_raw_read_partial_packet,
.flags= AVFMT_GENERIC_INDEX,
.extensions = "g722,722",
- .value = CODEC_ID_ADPCM_G722,
+ .raw_codec_id = CODEC_ID_ADPCM_G722,
};
#endif
@@ -200,7 +200,7 @@ AVInputFormat ff_latm_demuxer = {
.read_packet = ff_raw_read_partial_packet,
.flags= AVFMT_GENERIC_INDEX,
.extensions = "latm",
- .value = CODEC_ID_AAC_LATM,
+ .raw_codec_id = CODEC_ID_AAC_LATM,
};
#endif
@@ -216,7 +216,7 @@ AVInputFormat ff_mlp_demuxer = {
.read_packet = ff_raw_read_partial_packet,
.flags= AVFMT_GENERIC_INDEX,
.extensions = "mlp",
- .value = CODEC_ID_MLP,
+ .raw_codec_id = CODEC_ID_MLP,
};
#endif
@@ -228,7 +228,7 @@ AVInputFormat ff_truehd_demuxer = {
.read_packet = ff_raw_read_partial_packet,
.flags= AVFMT_GENERIC_INDEX,
.extensions = "thd",
- .value = CODEC_ID_TRUEHD,
+ .raw_codec_id = CODEC_ID_TRUEHD,
};
#endif
@@ -240,7 +240,7 @@ AVInputFormat ff_shorten_demuxer = {
.read_packet = ff_raw_read_partial_packet,
.flags = AVFMT_NOBINSEARCH | AVFMT_NOGENSEARCH | AVFMT_NO_BYTE_SEEK,
.extensions = "shn",
- .value = CODEC_ID_SHORTEN,
+ .raw_codec_id = CODEC_ID_SHORTEN,
};
#endif
diff --git a/libavformat/rawdec.h b/libavformat/rawdec.h
index 844a28824d..5812e5019b 100644
--- a/libavformat/rawdec.h
+++ b/libavformat/rawdec.h
@@ -67,7 +67,7 @@ AVInputFormat ff_ ## shortname ## _demuxer = {\
.read_packet = ff_raw_read_partial_packet,\
.extensions = ext,\
.flags = AVFMT_GENERIC_INDEX,\
- .value = id,\
+ .raw_codec_id = id,\
.priv_data_size = sizeof(FFRawVideoDemuxerContext),\
.priv_class = &shortname ## _demuxer_class,\
};
diff --git a/libavformat/rawvideodec.c b/libavformat/rawvideodec.c
index 8bd0dc92f0..7750eb2880 100644
--- a/libavformat/rawvideodec.c
+++ b/libavformat/rawvideodec.c
@@ -68,6 +68,6 @@ AVInputFormat ff_rawvideo_demuxer = {
.read_packet = rawvideo_read_packet,
.flags= AVFMT_GENERIC_INDEX,
.extensions = "yuv,cif,qcif,rgb",
- .value = CODEC_ID_RAWVIDEO,
+ .raw_codec_id = CODEC_ID_RAWVIDEO,
.priv_class = &rawvideo_demuxer_class,
};
diff --git a/libavformat/utils.c b/libavformat/utils.c
index f6010fdb31..d974ccd0cd 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2106,10 +2106,12 @@ static int try_decode_frame(AVStream *st, AVPacket *avpkt, AVDictionary **option
AVFrame picture;
AVPacket pkt = *avpkt;
- if(!st->codec->codec){
+ if (!avcodec_is_open(st->codec)) {
AVDictionary *thread_opt = NULL;
- codec = avcodec_find_decoder(st->codec->codec_id);
+ codec = st->codec->codec ? st->codec->codec :
+ avcodec_find_decoder(st->codec->codec_id);
+
if (!codec)
return -1;
@@ -2272,8 +2274,8 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
st->parser->flags |= PARSER_FLAG_COMPLETE_FRAMES;
}
}
- assert(!st->codec->codec);
- codec = avcodec_find_decoder(st->codec->codec_id);
+ codec = st->codec->codec ? st->codec->codec :
+ avcodec_find_decoder(st->codec->codec_id);
/* force thread count to 1 since the h264 decoder will not extract SPS
* and PPS to extradata during multi-threaded decoding */
@@ -2470,8 +2472,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
// close codecs which were opened in try_decode_frame()
for(i=0;i<ic->nb_streams;i++) {
st = ic->streams[i];
- if(st->codec->codec)
- avcodec_close(st->codec);
+ avcodec_close(st->codec);
}
for(i=0;i<ic->nb_streams;i++) {
st = ic->streams[i];
@@ -4184,3 +4185,12 @@ int ff_add_param_change(AVPacket *pkt, int32_t channels,
}
return 0;
}
+
+const struct AVCodecTag *avformat_get_riff_video_tags(void)
+{
+ return ff_codec_bmp_tags;
+}
+const struct AVCodecTag *avformat_get_riff_audio_tags(void)
+{
+ return ff_codec_wav_tags;
+}