summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Changelog1
-rw-r--r--Makefile2
-rw-r--r--avconv.c5
-rw-r--r--doc/APIchanges3
-rw-r--r--doc/avconv.texi2
-rw-r--r--doc/examples/muxing.c2
-rw-r--r--doc/ffmpeg.texi2
-rw-r--r--doc/general.texi1
-rw-r--r--ffmpeg.c5
-rw-r--r--ffpresets/libx264-ipod320.ffpreset8
-rw-r--r--ffpresets/libx264-ipod640.ffpreset9
-rw-r--r--ffserver.c1
-rw-r--r--libavcodec/Makefile1
-rw-r--r--libavcodec/allcodecs.c1
-rw-r--r--libavcodec/avcodec.h17
-rw-r--r--libavcodec/options.c48
-rw-r--r--libavcodec/utvideo.c460
-rw-r--r--libavcodec/vc1dec.c20
-rw-r--r--libavcodec/version.h2
-rw-r--r--libavdevice/alsa-audio-dec.c2
-rw-r--r--libavdevice/bktr.c2
-rw-r--r--libavdevice/fbdev.c2
-rw-r--r--libavdevice/jack_audio.c2
-rw-r--r--libavdevice/libcdio.c2
-rw-r--r--libavdevice/libdc1394.c2
-rw-r--r--libavdevice/oss_audio.c2
-rw-r--r--libavdevice/sndio_dec.c2
-rw-r--r--libavdevice/v4l.c2
-rw-r--r--libavdevice/v4l2.c2
-rw-r--r--libavdevice/vfwcap.c2
-rw-r--r--libavdevice/x11grab.c2
-rw-r--r--libavfilter/avfilter.h2
-rw-r--r--libavfilter/vsrc_testsrc.c14
-rw-r--r--libavformat/4xm.c5
-rw-r--r--libavformat/aacdec.c2
-rw-r--r--libavformat/aea.c2
-rw-r--r--libavformat/aiffdec.c2
-rw-r--r--libavformat/amr.c2
-rw-r--r--libavformat/anm.c2
-rw-r--r--libavformat/apc.c2
-rw-r--r--libavformat/ape.c2
-rw-r--r--libavformat/applehttp.c3
-rw-r--r--libavformat/asfdec.c2
-rw-r--r--libavformat/assdec.c2
-rw-r--r--libavformat/au.c2
-rw-r--r--libavformat/avformat.h21
-rw-r--r--libavformat/avidec.c3
-rw-r--r--libavformat/avisynth.c6
-rw-r--r--libavformat/avs.c4
-rw-r--r--libavformat/bethsoftvid.c4
-rw-r--r--libavformat/bfi.c4
-rw-r--r--libavformat/bink.c4
-rw-r--r--libavformat/c93.c4
-rw-r--r--libavformat/cafdec.c2
-rw-r--r--libavformat/cdg.c2
-rw-r--r--libavformat/daud.c2
-rw-r--r--libavformat/dfa.c2
-rw-r--r--libavformat/dsicin.c4
-rw-r--r--libavformat/dv.c4
-rw-r--r--libavformat/dxa.c4
-rw-r--r--libavformat/eacdata.c2
-rw-r--r--libavformat/electronicarts.c4
-rw-r--r--libavformat/ffmdec.c2
-rw-r--r--libavformat/ffmetadec.c2
-rw-r--r--libavformat/filmstripdec.c2
-rw-r--r--libavformat/flacdec.c2
-rw-r--r--libavformat/flic.c4
-rw-r--r--libavformat/flvdec.c3
-rw-r--r--libavformat/gxf.c3
-rw-r--r--libavformat/idcin.c4
-rw-r--r--libavformat/idroqdec.c4
-rw-r--r--libavformat/iff.c2
-rw-r--r--libavformat/img2.c2
-rw-r--r--libavformat/ipmovie.c4
-rw-r--r--libavformat/iss.c2
-rw-r--r--libavformat/iv8.c2
-rw-r--r--libavformat/ivfdec.c2
-rw-r--r--libavformat/jvdec.c4
-rw-r--r--libavformat/libnut.c2
-rw-r--r--libavformat/lmlm4.c4
-rw-r--r--libavformat/lxfdec.c4
-rw-r--r--libavformat/matroskadec.c4
-rw-r--r--libavformat/mm.c4
-rw-r--r--libavformat/mmf.c2
-rw-r--r--libavformat/mov.c3
-rw-r--r--libavformat/mp3dec.c2
-rw-r--r--libavformat/mpc.c2
-rw-r--r--libavformat/mpc8.c2
-rw-r--r--libavformat/mpeg.c3
-rw-r--r--libavformat/mpegts.c20
-rw-r--r--libavformat/msnwc_tcp.c2
-rw-r--r--libavformat/mtv.c10
-rw-r--r--libavformat/mvi.c4
-rw-r--r--libavformat/mxfdec.c3
-rw-r--r--libavformat/mxg.c10
-rw-r--r--libavformat/ncdec.c2
-rw-r--r--libavformat/nsvdec.c6
-rw-r--r--libavformat/nutdec.c2
-rw-r--r--libavformat/nuv.c4
-rw-r--r--libavformat/oggdec.c3
-rw-r--r--libavformat/oma.c2
-rw-r--r--libavformat/psxstr.c4
-rw-r--r--libavformat/pva.c4
-rw-r--r--libavformat/qcp.c2
-rw-r--r--libavformat/r3d.c4
-rw-r--r--libavformat/rawdec.c6
-rw-r--r--libavformat/rdt.c3
-rw-r--r--libavformat/riff.c4
-rw-r--r--libavformat/rl2.c4
-rw-r--r--libavformat/rmdec.c4
-rw-r--r--libavformat/rpl.c4
-rw-r--r--libavformat/rsodec.c2
-rw-r--r--libavformat/rtpenc_chain.c2
-rw-r--r--libavformat/rtsp.c3
-rw-r--r--libavformat/sapdec.c6
-rw-r--r--libavformat/segafilm.c4
-rw-r--r--libavformat/sierravmd.c4
-rw-r--r--libavformat/siff.c4
-rw-r--r--libavformat/smacker.c4
-rw-r--r--libavformat/sol.c2
-rw-r--r--libavformat/soxdec.c2
-rw-r--r--libavformat/spdifdec.c2
-rw-r--r--libavformat/srtdec.c2
-rw-r--r--libavformat/swfdec.c9
-rw-r--r--libavformat/thp.c4
-rw-r--r--libavformat/tiertexseq.c4
-rw-r--r--libavformat/tmv.c4
-rw-r--r--libavformat/tta.c2
-rw-r--r--libavformat/tty.c2
-rw-r--r--libavformat/txd.c2
-rw-r--r--libavformat/utils.c13
-rw-r--r--libavformat/vc1test.c2
-rw-r--r--libavformat/version.h7
-rw-r--r--libavformat/vocdec.c2
-rw-r--r--libavformat/vqf.c2
-rw-r--r--libavformat/wav.c4
-rw-r--r--libavformat/wc3movie.c4
-rw-r--r--libavformat/westwood.c6
-rw-r--r--libavformat/wtvdec.c5
-rw-r--r--libavformat/wv.c2
-rw-r--r--libavformat/xa.c2
-rw-r--r--libavformat/xmv.c4
-rw-r--r--libavformat/xwma.c2
-rw-r--r--libavformat/yop.c4
-rw-r--r--libavformat/yuv4mpeg.c2
-rw-r--r--libavutil/opt.h183
-rw-r--r--presets/libvpx-1080p.ffpreset (renamed from ffpresets/libvpx-1080p.avpreset)0
-rw-r--r--presets/libvpx-1080p50_60.ffpreset (renamed from ffpresets/libvpx-1080p50_60.avpreset)0
-rw-r--r--presets/libvpx-360p.ffpreset (renamed from ffpresets/libvpx-360p.avpreset)0
-rw-r--r--presets/libvpx-720p.ffpreset (renamed from ffpresets/libvpx-720p.avpreset)0
-rw-r--r--presets/libvpx-720p50_60.ffpreset (renamed from ffpresets/libvpx-720p50_60.avpreset)0
-rw-r--r--presets/libx264-baseline.ffpreset1
-rw-r--r--presets/libx264-fast.ffpreset1
-rw-r--r--presets/libx264-fast_firstpass.ffpreset2
-rw-r--r--presets/libx264-faster.ffpreset1
-rw-r--r--presets/libx264-faster_firstpass.ffpreset2
-rw-r--r--presets/libx264-ipod320.ffpreset4
-rw-r--r--presets/libx264-ipod640.ffpreset4
-rw-r--r--presets/libx264-lossless_fast.ffpreset2
-rw-r--r--presets/libx264-lossless_max.ffpreset2
-rw-r--r--presets/libx264-lossless_medium.ffpreset2
-rw-r--r--presets/libx264-lossless_slow.ffpreset2
-rw-r--r--presets/libx264-lossless_slower.ffpreset2
-rw-r--r--presets/libx264-lossless_ultrafast.ffpreset2
-rw-r--r--presets/libx264-main.ffpreset1
-rw-r--r--presets/libx264-medium.ffpreset1
-rw-r--r--presets/libx264-medium_firstpass.ffpreset2
-rw-r--r--presets/libx264-placebo.ffpreset1
-rw-r--r--presets/libx264-placebo_firstpass.ffpreset2
-rw-r--r--presets/libx264-slow.ffpreset1
-rw-r--r--presets/libx264-slow_firstpass.ffpreset2
-rw-r--r--presets/libx264-slower.ffpreset1
-rw-r--r--presets/libx264-slower_firstpass.ffpreset2
-rw-r--r--presets/libx264-superfast.ffpreset1
-rw-r--r--presets/libx264-superfast_firstpass.ffpreset2
-rw-r--r--presets/libx264-ultrafast.ffpreset1
-rw-r--r--presets/libx264-ultrafast_firstpass.ffpreset2
-rw-r--r--presets/libx264-veryfast.ffpreset1
-rw-r--r--presets/libx264-veryfast_firstpass.ffpreset2
-rw-r--r--presets/libx264-veryslow.ffpreset1
-rw-r--r--presets/libx264-veryslow_firstpass.ffpreset2
181 files changed, 1021 insertions, 256 deletions
diff --git a/Changelog b/Changelog
index 103b668..9360030 100644
--- a/Changelog
+++ b/Changelog
@@ -65,6 +65,7 @@ easier to use. The changes are:
- VC-1 interlaced decoding
- libutvideo wrapper (--enable-libutvideo)
- aevalsrc audio source added
+- Ut Video decoder
version 0.8:
diff --git a/Makefile b/Makefile
index 167dd32..94fb830 100644
--- a/Makefile
+++ b/Makefile
@@ -38,7 +38,7 @@ FFLIBS-$(CONFIG_SWSCALE) += swscale
FFLIBS := avutil
-DATA_FILES := $(wildcard $(SRC_PATH)/ffpresets/*.ffpreset)
+DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.ffpreset)
SKIPHEADERS = cmdutils_common_opts.h
diff --git a/avconv.c b/avconv.c
index 9fccbae..e8fd7ea 100644
--- a/avconv.c
+++ b/avconv.c
@@ -3137,7 +3137,7 @@ static int get_preset_file_2(const char *preset_name, const char *codec_name, AV
static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type)
{
OutputStream *ost;
- AVStream *st = av_new_stream(oc, oc->nb_streams < o->nb_streamid_map ? o->streamid_map[oc->nb_streams] : 0);
+ AVStream *st = avformat_new_stream(oc, NULL);
int idx = oc->nb_streams - 1, ret = 0;
int64_t max_frames = INT64_MAX;
char *bsf = NULL, *next, *codec_tag = NULL;
@@ -3151,6 +3151,9 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
exit_program(1);
}
+ if (oc->nb_streams - 1 < o->nb_streamid_map)
+ st->id = o->streamid_map[oc->nb_streams - 1];
+
output_streams = grow_array(output_streams, sizeof(*output_streams), &nb_output_streams,
nb_output_streams + 1);
ost = &output_streams[nb_output_streams - 1];
diff --git a/doc/APIchanges b/doc/APIchanges
index a31be4b..c2415f0 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -16,6 +16,9 @@ API changes, most recent first:
2011-10-20 - b35e9e1 - lavu 51.22.0
Add av_strtok() to avstring.h.
+2011-10-xx - xxxxxxx - lavf 53.10.0
+ Add avformat_new_stream(). Deprecate av_new_stream().
+
2011-xx-xx - xxxxxxx - lavf 53.9.0
Add AVFMT_NO_BYTE_SEEK AVInputFormat flag.
diff --git a/doc/avconv.texi b/doc/avconv.texi
index 2b61dfb..056b9cd 100644
--- a/doc/avconv.texi
+++ b/doc/avconv.texi
@@ -778,7 +778,7 @@ A preset file contains a sequence of @var{option=value} pairs, one for
each line, specifying a sequence of options which can be specified also on
the command line. Lines starting with the hash ('#') character are ignored and
are used to provide comments. Empty lines are also ignored. Check the
-@file{ffpresets} directory in the Libav source tree for examples.
+@file{presets} directory in the Libav source tree for examples.
Preset files are specified with the @code{pre} option, this option takes a
preset name as input. Avconv searches for a file named @var{preset_name}.avpreset in
diff --git a/doc/examples/muxing.c b/doc/examples/muxing.c
index d681438..0cdc895 100644
--- a/doc/examples/muxing.c
+++ b/doc/examples/muxing.c
@@ -199,7 +199,7 @@ static AVStream *add_video_stream(AVFormatContext *oc, enum CodecID codec_id)
AVCodecContext *c;
AVStream *st;
- st = av_new_stream(oc, 0);
+ st = avformat_new_stream(oc, NULL);
if (!st) {
fprintf(stderr, "Could not alloc stream\n");
exit(1);
diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index 39fb27c..c59c757 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -873,7 +873,7 @@ A preset file contains a sequence of @var{option}=@var{value} pairs,
one for each line, specifying a sequence of options which would be
awkward to specify on the command line. Lines starting with the hash
('#') character are ignored and are used to provide comments. Check
-the @file{ffpresets} directory in the FFmpeg source tree for examples.
+the @file{presets} directory in the FFmpeg source tree for examples.
Preset files are specified with the @code{vpre}, @code{apre},
@code{spre}, and @code{fpre} options. The @code{fpre} option takes the
diff --git a/doc/general.texi b/doc/general.texi
index 65f9efe..3ba3c58 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -527,6 +527,7 @@ following image formats are supported:
@tab encoding supported through external library libtheora
@item Tiertex Limited SEQ video @tab @tab X
@tab Codec used in DOS CD-ROM FlashBack game.
+@item Ut Video @tab @tab X
@item V210 Quicktime Uncompressed 4:2:2 10-bit @tab X @tab X
@item VMware Screen Codec / VMware Video @tab @tab X
@tab Codec used in videos captured by VMware.
diff --git a/ffmpeg.c b/ffmpeg.c
index 788fb59..347c324 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -3252,7 +3252,7 @@ static int get_preset_file_2(const char *preset_name, const char *codec_name, AV
static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type)
{
OutputStream *ost;
- AVStream *st = av_new_stream(oc, oc->nb_streams < o->nb_streamid_map ? o->streamid_map[oc->nb_streams] : 0);
+ AVStream *st = avformat_new_stream(oc, NULL);
int idx = oc->nb_streams - 1, ret = 0;
int64_t max_frames = INT64_MAX;
char *bsf = NULL, *next, *codec_tag = NULL;
@@ -3266,6 +3266,9 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
exit_program(1);
}
+ if (oc->nb_streams - 1 < o->nb_streamid_map)
+ st->id = o->streamid_map[oc->nb_streams - 1];
+
output_streams = grow_array(output_streams, sizeof(*output_streams), &nb_output_streams,
nb_output_streams + 1);
ost = &output_streams[nb_output_streams - 1];
diff --git a/ffpresets/libx264-ipod320.ffpreset b/ffpresets/libx264-ipod320.ffpreset
deleted file mode 100644
index a7fd87a..0000000
--- a/ffpresets/libx264-ipod320.ffpreset
+++ /dev/null
@@ -1,8 +0,0 @@
-coder=0
-bf=0
-weightb=0
-8x8dct=0
-level=13
-maxrate=768000
-bufsize=3000000
-weightp=0
diff --git a/ffpresets/libx264-ipod640.ffpreset b/ffpresets/libx264-ipod640.ffpreset
deleted file mode 100644
index dfa2453..0000000
--- a/ffpresets/libx264-ipod640.ffpreset
+++ /dev/null
@@ -1,9 +0,0 @@
-coder=0
-bf=0
-refs=1
-weightb=0
-8x8dct=0
-level=30
-maxrate=10000000
-bufsize=10000000
-weightp=0
diff --git a/ffserver.c b/ffserver.c
index 6823ceb..788755d 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -4236,6 +4236,7 @@ static int parse_ffconfig(const char *filename)
stream->fmt = ffserver_guess_format(NULL, stream->filename, NULL);
avcodec_get_context_defaults2(&video_enc, AVMEDIA_TYPE_VIDEO);
avcodec_get_context_defaults2(&audio_enc, AVMEDIA_TYPE_AUDIO);
+
audio_id = CODEC_ID_NONE;
video_id = CODEC_ID_NONE;
if (stream->fmt) {
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 6232737..c369a3d 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -401,6 +401,7 @@ OBJS-$(CONFIG_TTA_DECODER) += tta.o
OBJS-$(CONFIG_TWINVQ_DECODER) += twinvq.o celp_math.o
OBJS-$(CONFIG_TXD_DECODER) += txd.o s3tc.o
OBJS-$(CONFIG_ULTI_DECODER) += ulti.o
+OBJS-$(CONFIG_UTVIDEO_DECODER) += utvideo.o
OBJS-$(CONFIG_V210_DECODER) += v210dec.o
OBJS-$(CONFIG_V210_ENCODER) += v210enc.o
OBJS-$(CONFIG_V210X_DECODER) += v210x.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index a613ced..fb63038 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -208,6 +208,7 @@ void avcodec_register_all(void)
REGISTER_DECODER (TSCC, tscc);
REGISTER_DECODER (TXD, txd);
REGISTER_DECODER (ULTI, ulti);
+ REGISTER_DECODER (UTVIDEO, utvideo);
REGISTER_ENCDEC (V210, v210);
REGISTER_DECODER (V210X, v210x);
REGISTER_DECODER (VB, vb);
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 23bb52c..9a24da7 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -212,6 +212,7 @@ enum CodecID {
CODEC_ID_VC1IMAGE,
CODEC_ID_8SVX_RAW,
CODEC_ID_G2M,
+ CODEC_ID_UTVIDEO_DEPRECATED,
CODEC_ID_UTVIDEO = 0x800,
/* various PCM "codecs" */
@@ -3707,19 +3708,31 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
*/
const char *av_get_profile_name(const AVCodec *codec, int profile);
+#if FF_API_ALLOC_CONTEXT
/**
* Set the fields of the given AVCodecContext to default values.
*
* @param s The AVCodecContext of which the fields should be set to default values.
+ * @deprecated use avcodec_get_context_defaults3
*/
+attribute_deprecated
void avcodec_get_context_defaults(AVCodecContext *s);
/** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API!
* we WILL change its arguments and name a few times! */
+attribute_deprecated
void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType);
+#endif
-/** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API!
- * we WILL change its arguments and name a few times! */
+/**
+ * Set the fields of the given AVCodecContext to default values corresponding
+ * to the given codec (defaults may be codec-dependent).
+ *
+ * Do not call this function if a non-NULL codec has been passed
+ * to avcodec_alloc_context3() that allocated this AVCodecContext.
+ * If codec is non-NULL, it is illegal to call avcodec_open2() with a
+ * different codec on this AVCodecContext.
+ */
int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec);
#if FF_API_ALLOC_CONTEXT
diff --git a/libavcodec/options.c b/libavcodec/options.c
index 4f7609d..d494efe 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -532,37 +532,41 @@ static const AVClass av_codec_context_class = {
.child_class_next = codec_child_class_next,
};
+#if FF_API_ALLOC_CONTEXT
void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType codec_type){
+ AVCodec c= {0};
+ c.type= codec_type;
+ avcodec_get_context_defaults3(s, &c);
+}
+#endif
+
+int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec){
int flags=0;
memset(s, 0, sizeof(AVCodecContext));
- s->av_class= &av_codec_context_class;
+ s->av_class = &av_codec_context_class;
- s->codec_type = codec_type;
- if(codec_type == AVMEDIA_TYPE_AUDIO)
+ s->codec_type = codec ? codec->type : AVMEDIA_TYPE_UNKNOWN;
+ if(s->codec_type == AVMEDIA_TYPE_AUDIO)
flags= AV_OPT_FLAG_AUDIO_PARAM;
- else if(codec_type == AVMEDIA_TYPE_VIDEO)
+ else if(s->codec_type == AVMEDIA_TYPE_VIDEO)
flags= AV_OPT_FLAG_VIDEO_PARAM;
- else if(codec_type == AVMEDIA_TYPE_SUBTITLE)
+ else if(s->codec_type == AVMEDIA_TYPE_SUBTITLE)
flags= AV_OPT_FLAG_SUBTITLE_PARAM;
av_opt_set_defaults2(s, flags, flags);
- s->time_base= (AVRational){0,1};
- s->get_buffer= avcodec_default_get_buffer;
- s->release_buffer= avcodec_default_release_buffer;
- s->get_format= avcodec_default_get_format;
- s->execute= avcodec_default_execute;
- s->execute2= avcodec_default_execute2;
- s->sample_aspect_ratio= (AVRational){0,1};
- s->pix_fmt= PIX_FMT_NONE;
- s->sample_fmt= AV_SAMPLE_FMT_NONE;
-
- s->reget_buffer= avcodec_default_reget_buffer;
- s->reordered_opaque= AV_NOPTS_VALUE;
-}
-
-int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec){
- avcodec_get_context_defaults2(s, codec ? codec->type : AVMEDIA_TYPE_UNKNOWN);
+ s->time_base = (AVRational){0,1};
+ s->get_buffer = avcodec_default_get_buffer;
+ s->release_buffer = avcodec_default_release_buffer;
+ s->get_format = avcodec_default_get_format;
+ s->execute = avcodec_default_execute;
+ s->execute2 = avcodec_default_execute2;
+ s->sample_aspect_ratio = (AVRational){0,1};
+ s->pix_fmt = PIX_FMT_NONE;
+ s->sample_fmt = AV_SAMPLE_FMT_NONE;
+
+ s->reget_buffer = avcodec_default_reget_buffer;
+ s->reordered_opaque = AV_NOPTS_VALUE;
if(codec && codec->priv_data_size){
if(!s->priv_data){
s->priv_data= av_mallocz(codec->priv_data_size);
@@ -610,13 +614,11 @@ AVCodecContext *avcodec_alloc_context2(enum AVMediaType codec_type){
return avctx;
}
-#endif
void avcodec_get_context_defaults(AVCodecContext *s){
avcodec_get_context_defaults2(s, AVMEDIA_TYPE_UNKNOWN);
}
-#if FF_API_ALLOC_CONTEXT
AVCodecContext *avcodec_alloc_context(void){
return avcodec_alloc_context2(AVMEDIA_TYPE_UNKNOWN);
}
diff --git a/libavcodec/utvideo.c b/libavcodec/utvideo.c
new file mode 100644
index 0000000..aac3969
--- /dev/null
+++ b/libavcodec/utvideo.c
@@ -0,0 +1,460 @@
+/*
+ * Ut Video decoder
+ * Copyright (c) 2011 Konstantin Shishkov
+ *
+ * This file is part of Libav.
+ *
+ * Libav 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,
+ * 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
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * Ut Video decoder
+ */
+
+#include <stdlib.h>
+
+#include "libavutil/intreadwrite.h"
+#include "avcodec.h"
+#include "bytestream.h"
+#include "get_bits.h"
+#include "dsputil.h"
+
+enum {
+ PRED_NONE = 0,
+ PRED_LEFT,
+ PRED_GRADIENT,
+ PRED_MEDIAN,
+};
+
+typedef struct UtvideoContext {
+ AVCodecContext *avctx;
+ AVFrame pic;
+ DSPContext dsp;
+
+ uint32_t frame_info_size, flags, frame_info;
+ int planes;
+ int slices;
+ int compression;
+ int interlaced;
+ int frame_pred;
+
+ uint8_t *slice_bits;
+ int slice_bits_size;
+} UtvideoContext;
+
+typedef struct HuffEntry {
+ uint8_t sym;
+ uint8_t len;
+} HuffEntry;
+
+static int huff_cmp(const void *a, const void *b)
+{
+ const HuffEntry *aa = a, *bb = b;
+ return (aa->len - bb->len)*256 + aa->sym - bb->sym;
+}
+
+static int build_huff(const uint8_t *src, VLC *vlc)
+{
+ int i;
+ HuffEntry he[256];
+ int last;
+ uint32_t codes[256];
+ uint8_t bits[256];
+ uint8_t syms[256];
+ uint32_t code;
+
+ for (i = 0; i < 256; i++) {
+ he[i].sym = i;
+ he[i].len = *src++;
+ }
+ qsort(he, 256, sizeof(*he), huff_cmp);
+
+ if (!he[0].len || he[0].len > 32)
+ return -1;
+
+ last = 255;
+ while (he[last].len == 255 && last)
+ last--;
+
+ code = 1;
+ for (i = last; i >= 0; i--) {
+ codes[i] = code >> (32 - he[i].len);
+ bits[i] = he[i].len;
+ syms[i] = he[i].sym;
+ code += 0x80000000u >> (he[i].len - 1);
+ }
+
+ return init_vlc_sparse(vlc, FFMIN(he[last].len, 9), last + 1,
+ bits, sizeof(*bits), sizeof(*bits),
+ codes, sizeof(*codes), sizeof(*codes),
+ syms, sizeof(*syms), sizeof(*syms), 0);
+}
+
+static int decode_plane(UtvideoContext *c, int plane_no,
+ uint8_t *dst, int step, int stride,
+ int width, int height,
+ const uint8_t *src, int src_size, int use_pred)
+{
+ int i, j, slice, pix;
+ int sstart, send;
+ VLC vlc;
+ GetBitContext gb;
+ int prev;
+
+ if (build_huff(src, &vlc)) {
+ av_log(c->avctx, AV_LOG_ERROR, "Cannot build Huffman codes\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ src += 256;
+ src_size -= 256;
+
+ send = 0;
+ for (slice = 0; slice < c->slices; slice++) {
+ uint8_t *dest;
+ int slice_data_start, slice_data_end, slice_size;
+
+ sstart = send;
+ send = height * (slice + 1) / c->slices;
+ dest = dst + sstart * stride;
+
+ // slice offset and size validation was done earlier
+ slice_data_start = slice ? AV_RL32(src + slice * 4 - 4) : 0;
+ slice_data_end = AV_RL32(src + slice * 4);
+ slice_size = slice_data_end - slice_data_start;
+
+ if (!slice_size) {
+ for (j = sstart; j < send; j++) {
+ for (i = 0; i < width * step; i += step)
+ dest[i] = 0x80;
+ dest += stride;
+ }
+ continue;
+ }
+
+ memcpy(c->slice_bits, src + slice_data_start + c->slices * 4, slice_size);
+ memset(c->slice_bits + slice_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
+ c->dsp.bswap_buf((uint32_t*)c->slice_bits, (uint32_t*)c->slice_bits,
+ (slice_data_end - slice_data_start + 3) >> 2);
+ init_get_bits(&gb, c->slice_bits, slice_size * 8);
+
+ prev = 0x80;
+ for (j = sstart; j < send; j++) {
+ for (i = 0; i < width * step; i += step) {
+ if (get_bits_left(&gb) <= 0) {
+ av_log(c->avctx, AV_LOG_ERROR, "Slice decoding ran out of bits\n");
+ goto fail;
+ }
+ pix = get_vlc2(&gb, vlc.table, vlc.bits, 4);
+ if (pix < 0) {
+ av_log(c->avctx, AV_LOG_ERROR, "Decoding error\n");
+ goto fail;
+ }
+ if (use_pred) {
+ prev += pix;
+ pix = prev;
+ }
+ dest[i] = pix;
+ }
+ dest += stride;
+ }
+ if (get_bits_left(&gb) > 32)
+ av_log(c->avctx, AV_LOG_WARNING, "%d bits left after decoding slice\n",
+ get_bits_left(&gb));
+ }
+
+ free_vlc(&vlc);
+
+ return 0;
+fail:
+ free_vlc(&vlc);
+ return AVERROR_INVALIDDATA;
+}
+
+static const int rgb_order[4] = { 1, 2, 0, 3 };
+
+static void restore_rgb_planes(uint8_t *src, int step, int stride, int width, int height)
+{
+ int i, j;
+ uint8_t r, g, b;
+
+ for (j = 0; j < height; j++) {
+ for (i = 0; i < width * step; i += step) {
+ r = src[i];
+ g = src[i + 1];
+ b = src[i + 2];
+ src[i] = r + g - 0x80;
+ src[i + 2] = b + g - 0x80;
+ }
+ src += stride;
+ }
+}
+
+static void restore_median(uint8_t *src, int step, int stride,
+ int width, int height, int slices)
+{
+ int i, j, slice;
+ int A, B, C;
+ uint8_t *bsrc;
+ int slice_start, slice_height;
+
+ for (slice = 0; slice < slices; slice++) {
+ slice_start = (slice * height) / slices;
+ slice_height = ((slice + 1) * height) / slices - slice_start;
+
+ bsrc = src + slice_start * stride;
+
+ // first line - left neighbour prediction
+ bsrc[0] += 0x80;
+ A = bsrc[0];
+ for (i = step; i < width * step; i += step) {
+ bsrc[i] += A;
+ A = bsrc[i];
+ }
+ bsrc += stride;
+ if (slice_height == 1)
+ continue;
+ // second line - first element has top predition, the rest uses median
+ C = bsrc[-stride];
+ bsrc[0] += C;
+ A = bsrc[0];
+ for (i = step; i < width * step; i += step) {
+ B = bsrc[i - stride];
+ bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C));
+ C = B;
+ A = bsrc[i];
+ }
+ bsrc += stride;
+ // the rest of lines use continuous median prediction
+ for (j = 2; j < slice_height; j++) {
+ for (i = 0; i < width * step; i += step) {
+ B = bsrc[i - stride];
+ bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C));
+ C = B;
+ A = bsrc[i];
+ }
+ bsrc += stride;
+ }
+ }
+}
+
+static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
+{
+ const uint8_t *buf = avpkt->data;
+ int buf_size = avpkt->size;
+ const uint8_t *buf_end = buf + buf_size;
+ UtvideoContext *c = avctx->priv_data;
+ const uint8_t *ptr;
+ int i, j;
+ const uint8_t *plane_start[5];
+ int plane_size, max_slice_size = 0, slice_start, slice_end, slice_size;
+ int ret;
+
+ if (c->pic.data[0])
+ avctx->release_buffer(avctx, &c->pic);
+
+ c->pic.reference = 1;
+ c->pic.buffer_hints = FF_BUFFER_HINTS_VALID;
+ if ((ret = avctx->get_buffer(avctx, &c->pic)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+ return ret;
+ }
+
+ /* parse plane structure to retrieve frame flags and validate slice offsets */
+ ptr = buf;
+ for (i = 0; i < c->planes; i++) {
+ plane_start[i] = ptr;
+ if (buf_end - ptr < 256 + 4 * c->slices) {
+ av_log(avctx, AV_LOG_ERROR, "Insufficient data for a plane\n");
+ return AVERROR_INVALIDDATA;
+ }
+ ptr += 256;
+ slice_start = 0;
+ slice_end = 0;
+ for (j = 0; j < c->slices; j++) {
+ slice_end = bytestream_get_le32(&ptr);
+ slice_size = slice_end - slice_start;
+ if (slice_size < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Incorrect slice size\n");
+ return AVERROR_INVALIDDATA;
+ }
+ slice_start = slice_end;
+ max_slice_size = FFMAX(max_slice_size, slice_size);
+ }
+ plane_size = slice_end;
+ if (buf_end - ptr < plane_size) {
+ av_log(avctx, AV_LOG_ERROR, "Plane size is bigger than available data\n");
+ return AVERROR_INVALIDDATA;
+ }
+ ptr += plane_size;
+ }
+ plane_start[c->planes] = ptr;
+ if (buf_end - ptr < c->frame_info_size) {
+ av_log(avctx, AV_LOG_ERROR, "Not enough data for frame information\n");
+ return AVERROR_INVALIDDATA;
+ }
+ c->frame_info = AV_RL32(ptr);
+ av_log(avctx, AV_LOG_DEBUG, "frame information flags %X\n", c->frame_info);
+
+ c->frame_pred = (c->frame_info >> 8) & 3;
+
+ if (c->frame_pred == PRED_GRADIENT) {
+ av_log_ask_for_sample(avctx, "Frame uses gradient prediction\n");
+ return AVERROR_PATCHWELCOME;
+ }
+
+ av_fast_malloc(&c->slice_bits, &c->slice_bits_size,
+ max_slice_size + FF_INPUT_BUFFER_PADDING_SIZE);
+
+ if (!c->slice_bits) {
+ av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer\n");
+ return AVERROR(ENOMEM);
+ }
+
+ switch (c->avctx->pix_fmt) {
+ case PIX_FMT_RGB24:
+ case PIX_FMT_RGBA:
+ for (i = 0; i < c->planes; i++) {
+ ret = decode_plane(c, i, c->pic.data[0] + rgb_order[i], c->planes,
+ c->pic.linesize[0], avctx->width, avctx->height,
+ plane_start[i], plane_start[i + 1] - plane_start[i],
+ c->frame_pred == PRED_LEFT);
+ if (ret)
+ return ret;
+ if (c->frame_pred == PRED_MEDIAN)
+ restore_median(c->pic.data[0] + rgb_order[i], c->planes,
+ c->pic.linesize[0], avctx->width, avctx->height,
+ c->slices);
+ }
+ restore_rgb_planes(c->pic.data[0], c->planes, c->pic.linesize[0],
+ avctx->width, avctx->height);
+ break;
+ case PIX_FMT_YUV420P:
+ for (i = 0; i < 3; i++) {
+ ret = decode_plane(c, i, c->pic.data[i], 1,
+ c->pic.linesize[i], avctx->width >> !!i, avctx->height >> !!i,
+ plane_start[i], plane_start[i + 1] - plane_start[i],
+ c->frame_pred == PRED_LEFT);
+ if (ret)
+ return ret;
+ if (c->frame_pred == PRED_MEDIAN)
+ restore_median(c->pic.data[i], 1, c->pic.linesize[i],
+ avctx->width >> !!i, avctx->height >> !!i,
+ c->slices);
+ }
+ break;
+ case PIX_FMT_YUV422P:
+ for (i = 0; i < 3; i++) {
+ ret = decode_plane(c, i, c->pic.data[i], 1,
+ c->pic.linesize[i], avctx->width >> !!i, avctx->height,
+ plane_start[i], plane_start[i + 1] - plane_start[i],
+ c->frame_pred == PRED_LEFT);
+ if (ret)
+ return ret;
+ if (c->frame_pred == PRED_MEDIAN)
+ restore_median(c->pic.data[i], 1, c->pic.linesize[i],
+ avctx->width >> !!i, avctx->height, c->slices);
+ }
+ break;
+ }
+
+ *data_size = sizeof(AVFrame);
+ *(AVFrame*)data = c->pic;
+
+ /* always report that the buffer was completely consumed */
+ return buf_size;
+}
+
+static av_cold int decode_init(AVCodecContext *avctx)
+{
+ UtvideoContext * const c = avctx->priv_data;
+
+ c->avctx = avctx;
+
+ dsputil_init(&c->dsp, avctx);
+
+ if (avctx->extradata_size < 16) {
+ av_log(avctx, AV_LOG_ERROR, "Insufficient extradata size %d, should be at least 16\n",
+ avctx->extradata_size);
+ return AVERROR_INVALIDDATA;
+ }
+
+ av_log(avctx, AV_LOG_DEBUG, "Encoder version %d.%d.%d.%d\n",
+ avctx->extradata[3], avctx->extradata[2],
+ avctx->extradata[1], avctx->extradata[0]);
+ av_log(avctx, AV_LOG_DEBUG, "Original format %X\n", AV_RB32(avctx->extradata + 4));
+ c->frame_info_size = AV_RL32(avctx->extradata + 8);
+ c->flags = AV_RL32(avctx->extradata + 12);
+
+ if (c->frame_info_size != 4)
+ av_log_ask_for_sample(avctx, "Frame info is not 4 bytes\n");
+ av_log(avctx, AV_LOG_DEBUG, "Encoding parameters %08X\n", c->flags);
+ c->slices = (c->flags >> 24) + 1;
+ c->compression = c->flags & 1;
+ c->interlaced = c->flags & 0x800;
+
+ c->slice_bits_size = 0;
+
+ switch (avctx->codec_tag) {
+ case MKTAG('U', 'L', 'R', 'G'):
+ c->planes = 3;
+ avctx->pix_fmt = PIX_FMT_RGB24;
+ break;
+ case MKTAG('U', 'L', 'R', 'A'):
+ c->planes = 4;
+ avctx->pix_fmt = PIX_FMT_RGBA;
+ break;
+ case MKTAG('U', 'L', 'Y', '0'):
+ c->planes = 3;
+ avctx->pix_fmt = PIX_FMT_YUV420P;
+ break;
+ case MKTAG('U', 'L', 'Y', '2'):
+ c->planes = 3;
+ avctx->pix_fmt = PIX_FMT_YUV422P;
+ break;
+ default:
+ av_log(avctx, AV_LOG_ERROR, "Unknown Ut Video FOURCC provided (%08X)\n",
+ avctx->codec_tag);
+ return AVERROR_INVALIDDATA;
+ }
+
+ return 0;
+}
+
+static av_cold int decode_end(AVCodecContext *avctx)
+{
+ UtvideoContext * const c = avctx->priv_data;
+
+ if (c->pic.data[0])
+ avctx->release_buffer(avctx, &c->pic);
+
+ av_freep(&c->slice_bits);
+
+ return 0;
+}
+
+AVCodec ff_utvideo_decoder = {
+ .name = "utvideo",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = CODEC_ID_UTVIDEO,
+ .priv_data_size = sizeof(UtvideoContext),
+ .init = decode_init,
+ .close = decode_end,
+ .decode = decode_frame,
+ .capabilities = CODEC_CAP_DR1,
+ .long_name = NULL_IF_CONFIG_SMALL("Ut Video"),
+};
+
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index d23d04c..69fd5be 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -1291,6 +1291,7 @@ static av_always_inline int scaleforsame_x(VC1Context *v, int n /* MV */, int di
int scaledvalue, refdist;
int scalesame1, scalesame2;
int scalezone1_x, zone1offset_x;
+ int table_index = dir ^ v->second_field;
if (v->s.pict_type != AV_PICTURE_TYPE_B)
refdist = v->refdist;
@@ -1298,10 +1299,10 @@ static av_always_inline int scaleforsame_x(VC1Context *v, int n /* MV */, int di
refdist = dir ? v->brfd : v->frfd;
if (refdist > 3)
refdist = 3;
- scalesame1 = vc1_field_mvpred_scales[v->second_field][1][refdist];
- scalesame2 = vc1_field_mvpred_scales[v->second_field][2][refdist];
- scalezone1_x = vc1_field_mvpred_scales[v->second_field][3][refdist];
- zone1offset_x = vc1_field_mvpred_scales[v->second_field][5][refdist];
+ scalesame1 = vc1_field_mvpred_scales[table_index][1][refdist];
+ scalesame2 = vc1_field_mvpred_scales[table_index][2][refdist];
+ scalezone1_x = vc1_field_mvpred_scales[table_index][3][refdist];
+ zone1offset_x = vc1_field_mvpred_scales[table_index][5][refdist];
if (FFABS(n) > 255)
scaledvalue = n;
@@ -1323,6 +1324,7 @@ static av_always_inline int scaleforsame_y(VC1Context *v, int i, int n /* MV */,
int scaledvalue, refdist;
int scalesame1, scalesame2;
int scalezone1_y, zone1offset_y;
+ int table_index = dir ^ v->second_field;
if (v->s.pict_type != AV_PICTURE_TYPE_B)
refdist = v->refdist;
@@ -1330,10 +1332,10 @@ static av_always_inline int scaleforsame_y(VC1Context *v, int i, int n /* MV */,
refdist = dir ? v->brfd : v->frfd;
if (refdist > 3)
refdist = 3;
- scalesame1 = vc1_field_mvpred_scales[v->second_field][1][refdist];
- scalesame2 = vc1_field_mvpred_scales[v->second_field][2][refdist];
- scalezone1_y = vc1_field_mvpred_scales[v->second_field][4][refdist];
- zone1offset_y = vc1_field_mvpred_scales[v->second_field][6][refdist];
+ scalesame1 = vc1_field_mvpred_scales[table_index][1][refdist];
+ scalesame2 = vc1_field_mvpred_scales[table_index][2][refdist];
+ scalezone1_y = vc1_field_mvpred_scales[table_index][4][refdist];
+ zone1offset_y = vc1_field_mvpred_scales[table_index][6][refdist];
if (FFABS(n) > 63)
scaledvalue = n;
@@ -1444,7 +1446,7 @@ static av_always_inline int scaleforopp(VC1Context *v, int n /* MV */,
refdist = FFMIN(v->refdist, 3);
else
refdist = dir ? v->brfd : v->frfd;
- scaleopp = vc1_field_mvpred_scales[v->second_field][0][refdist];
+ scaleopp = vc1_field_mvpred_scales[dir ^ v->second_field][0][refdist];
return n * scaleopp >> 8;
}
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 744a645..5fe007b 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -21,7 +21,7 @@
#define AVCODEC_VERSION_H
#define LIBAVCODEC_VERSION_MAJOR 53
-#define LIBAVCODEC_VERSION_MINOR 21
+#define LIBAVCODEC_VERSION_MINOR 22
#define LIBAVCODEC_VERSION_MICRO 0
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
diff --git a/libavdevice/alsa-audio-dec.c b/libavdevice/alsa-audio-dec.c
index 8fe82d9..bd00b15 100644
--- a/libavdevice/alsa-audio-dec.c
+++ b/libavdevice/alsa-audio-dec.c
@@ -61,7 +61,7 @@ static av_cold int audio_read_header(AVFormatContext *s1,
enum CodecID codec_id;
double o;
- st = av_new_stream(s1, 0);
+ st = avformat_new_stream(s1, NULL);
if (!st) {
av_log(s1, AV_LOG_ERROR, "Cannot add stream\n");
diff --git a/libavdevice/bktr.c b/libavdevice/bktr.c
index b16adc9..db917c4 100644
--- a/libavdevice/bktr.c
+++ b/libavdevice/bktr.c
@@ -271,7 +271,7 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
goto out;
}
- st = av_new_stream(s1, 0);
+ st = avformat_new_stream(s1, NULL);
if (!st) {
ret = AVERROR(ENOMEM);
goto out;
diff --git a/libavdevice/fbdev.c b/libavdevice/fbdev.c
index 20c2ab8..494d5f0 100644
--- a/libavdevice/fbdev.c
+++ b/libavdevice/fbdev.c
@@ -108,7 +108,7 @@ av_cold static int fbdev_read_header(AVFormatContext *avctx,
return ret;
}
- if (!(st = av_new_stream(avctx, 0)))
+ if (!(st = avformat_new_stream(avctx, NULL)))
return AVERROR(ENOMEM);
av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in microseconds */
diff --git a/libavdevice/jack_audio.c b/libavdevice/jack_audio.c
index ac84786..72554f0 100644
--- a/libavdevice/jack_audio.c
+++ b/libavdevice/jack_audio.c
@@ -229,7 +229,7 @@ static int audio_read_header(AVFormatContext *context, AVFormatParameters *param
if ((test = start_jack(context)))
return test;
- stream = av_new_stream(context, 0);
+ stream = avformat_new_stream(context, NULL);
if (!stream) {
stop_jack(self);
return AVERROR(ENOMEM);
diff --git a/libavdevice/libcdio.c b/libavdevice/libcdio.c
index 385e295..d7584fc 100644
--- a/libavdevice/libcdio.c
+++ b/libavdevice/libcdio.c
@@ -54,7 +54,7 @@ static av_cold int read_header(AVFormatContext *ctx, AVFormatParameters *ap)
int ret, i;
char *err = NULL;
- if (!(st = av_new_stream(ctx, 0)))
+ if (!(st = avformat_new_stream(ctx, NULL)))
return AVERROR(ENOMEM);
s->drive = cdio_cddap_identify(ctx->filename, CDDA_MESSAGE_LOGIT, &err);
if (!s->drive) {
diff --git a/libavdevice/libdc1394.c b/libavdevice/libdc1394.c
index 684047e..2f3a373 100644
--- a/libavdevice/libdc1394.c
+++ b/libavdevice/libdc1394.c
@@ -253,7 +253,7 @@ static int dc1394_read_header(AVFormatContext *c, AVFormatParameters * ap)
}
/* create a video stream */
- vst = av_new_stream(c, 0);
+ vst = avformat_new_stream(c, NULL);
if (!vst)
goto out_camera;
av_set_pts_info(vst, 64, 1, 1000);
diff --git a/libavdevice/oss_audio.c b/libavdevice/oss_audio.c
index 56b85e1..4432376 100644
--- a/libavdevice/oss_audio.c
+++ b/libavdevice/oss_audio.c
@@ -209,7 +209,7 @@ static int audio_read_header(AVFormatContext *s1, AVFormatParameters *ap)
AVStream *st;
int ret;
- st = av_new_stream(s1, 0);
+ st = avformat_new_stream(s1, NULL);
if (!st) {
return AVERROR(ENOMEM);
}
diff --git a/libavdevice/sndio_dec.c b/libavdevice/sndio_dec.c
index f6417f2..6d6184c 100644
--- a/libavdevice/sndio_dec.c
+++ b/libavdevice/sndio_dec.c
@@ -34,7 +34,7 @@ static av_cold int audio_read_header(AVFormatContext *s1,
AVStream *st;
int ret;
- st = av_new_stream(s1, 0);
+ st = avformat_new_stream(s1, NULL);
if (!st)
return AVERROR(ENOMEM);
diff --git a/libavdevice/v4l.c b/libavdevice/v4l.c
index ec0029a..7c8b397 100644
--- a/libavdevice/v4l.c
+++ b/libavdevice/v4l.c
@@ -98,7 +98,7 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
s->video_win.width = ap->width;
s->video_win.height = ap->height;
- st = av_new_stream(s1, 0);
+ st = avformat_new_stream(s1, NULL);
if (!st)
return AVERROR(ENOMEM);
av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index e14e56c..468d4c1 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -560,7 +560,7 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap)
enum CodecID codec_id;
enum PixelFormat pix_fmt = PIX_FMT_NONE;
- st = av_new_stream(s1, 0);
+ st = avformat_new_stream(s1, NULL);
if (!st) {
res = AVERROR(ENOMEM);
goto out;
diff --git a/libavdevice/vfwcap.c b/libavdevice/vfwcap.c
index 480282a..09330de 100644
--- a/libavdevice/vfwcap.c
+++ b/libavdevice/vfwcap.c
@@ -293,7 +293,7 @@ static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap)
SetWindowLongPtr(ctx->hwnd, GWLP_USERDATA, (LONG_PTR) s);
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if(!st) {
vfw_read_close(s);
return AVERROR(ENOMEM);
diff --git a/libavdevice/x11grab.c b/libavdevice/x11grab.c
index 9125180..c2a67d7 100644
--- a/libavdevice/x11grab.c
+++ b/libavdevice/x11grab.c
@@ -194,7 +194,7 @@ x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
goto out;
}
- st = av_new_stream(s1, 0);
+ st = avformat_new_stream(s1, NULL);
if (!st) {
ret = AVERROR(ENOMEM);
goto out;
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 07c1faa..138cc30 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -30,7 +30,7 @@
#define LIBAVFILTER_VERSION_MAJOR 2
#define LIBAVFILTER_VERSION_MINOR 44
-#define LIBAVFILTER_VERSION_MICRO 0
+#define LIBAVFILTER_VERSION_MICRO 1
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \
diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c
index a593340..2447cb3 100644
--- a/libavfilter/vsrc_testsrc.c
+++ b/libavfilter/vsrc_testsrc.c
@@ -103,7 +103,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
test->nb_frame = 0;
test->pts = 0;
- av_log(ctx, AV_LOG_INFO, "size:%dx%d rate:%d/%d duration:%f sar:%d/%d\n",
+ av_log(ctx, AV_LOG_DEBUG, "size:%dx%d rate:%d/%d duration:%f sar:%d/%d\n",
test->w, test->h, frame_rate_q.num, frame_rate_q.den,
duration < 0 ? -1 : test->max_pts * av_q2d(test->time_base),
test->sar.num, test->sar.den);
@@ -156,9 +156,9 @@ static const char *testsrc_get_name(void *ctx)
}
static const AVClass testsrc_class = {
- "TestSourceContext",
- testsrc_get_name,
- testsrc_options
+ .class_name = "TestSourceContext",
+ .item_name = testsrc_get_name,
+ .option = testsrc_options,
};
/**
@@ -378,9 +378,9 @@ static const char *rgbtestsrc_get_name(void *ctx)
}
static const AVClass rgbtestsrc_class = {
- "RGBTestSourceContext",
- rgbtestsrc_get_name,
- testsrc_options
+ .class_name = "RGBTestSourceContext",
+ .item_name = rgbtestsrc_get_name,
+ .option = testsrc_options,
};
#define R 0
diff --git a/libavformat/4xm.c b/libavformat/4xm.c
index b95eac7..3bb8bbd 100644
--- a/libavformat/4xm.c
+++ b/libavformat/4xm.c
@@ -141,7 +141,7 @@ static int fourxm_read_header(AVFormatContext *s,
fourxm->height = AV_RL32(&header[i + 40]);
/* allocate a new AVStream */
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st){
ret= AVERROR(ENOMEM);
goto fail;
@@ -199,12 +199,13 @@ static int fourxm_read_header(AVFormatContext *s,
i += 8 + size;
/* allocate a new AVStream */
- st = av_new_stream(s, current_track);
+ st = avformat_new_stream(s, NULL);
if (!st){
ret= AVERROR(ENOMEM);
goto fail;
}
+ st->id = current_track;
av_set_pts_info(st, 60, 1, fourxm->tracks[current_track].sample_rate);
fourxm->tracks[current_track].stream_index = st->index;
diff --git a/libavformat/aacdec.c b/libavformat/aacdec.c
index c3a5029..7df11bf 100644
--- a/libavformat/aacdec.c
+++ b/libavformat/aacdec.c
@@ -66,7 +66,7 @@ static int adts_aac_read_header(AVFormatContext *s,
{
AVStream *st;
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
diff --git a/libavformat/aea.c b/libavformat/aea.c
index 42889b9..9fac6c8 100644
--- a/libavformat/aea.c
+++ b/libavformat/aea.c
@@ -57,7 +57,7 @@ static int aea_read_probe(AVProbeData *p)
static int aea_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
- AVStream *st = av_new_stream(s, 0);
+ AVStream *st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c
index 7586344..eee9a1c 100644
--- a/libavformat/aiffdec.c
+++ b/libavformat/aiffdec.c
@@ -198,7 +198,7 @@ static int aiff_read_header(AVFormatContext *s,
filesize -= 4;
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
diff --git a/libavformat/amr.c b/libavformat/amr.c
index 373e454..8c3b141 100644
--- a/libavformat/amr.c
+++ b/libavformat/amr.c
@@ -84,7 +84,7 @@ static int amr_read_header(AVFormatContext *s,
avio_read(pb, header, 6);
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
{
return AVERROR(ENOMEM);
diff --git a/libavformat/anm.c b/libavformat/anm.c
index 09e7dc7..99864f6 100644
--- a/libavformat/anm.c
+++ b/libavformat/anm.c
@@ -97,7 +97,7 @@ static int read_header(AVFormatContext *s,
return AVERROR_INVALIDDATA;
/* video stream */
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
diff --git a/libavformat/apc.c b/libavformat/apc.c
index 19de7f5..5d7bb6f 100644
--- a/libavformat/apc.c
+++ b/libavformat/apc.c
@@ -39,7 +39,7 @@ static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap)
avio_rl32(pb); /* _APC */
avio_rl32(pb); /* 1.20 */
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
diff --git a/libavformat/ape.c b/libavformat/ape.c
index cfac933..93c22af 100644
--- a/libavformat/ape.c
+++ b/libavformat/ape.c
@@ -313,7 +313,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
ape->compressiontype);
/* now we are ready: build format streams */
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return -1;
diff --git a/libavformat/applehttp.c b/libavformat/applehttp.c
index eccef6a..432bf4e 100644
--- a/libavformat/applehttp.c
+++ b/libavformat/applehttp.c
@@ -505,11 +505,12 @@ static int applehttp_read_header(AVFormatContext *s, AVFormatParameters *ap)
snprintf(bitrate_str, sizeof(bitrate_str), "%d", v->bandwidth);
/* Create new AVStreams for each stream in this variant */
for (j = 0; j < v->ctx->nb_streams; j++) {
- AVStream *st = av_new_stream(s, i);
+ AVStream *st = avformat_new_stream(s, NULL);
if (!st) {
ret = AVERROR(ENOMEM);
goto fail;
}
+ st->id = i;
avcodec_copy_context(st->codec, v->ctx->streams[j]->codec);
if (v->bandwidth)
av_dict_set(&st->metadata, "variant_bitrate", bitrate_str,
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index 2054a32..e2acd13 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -224,7 +224,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
pos1 = avio_tell(pb);
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
av_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */
diff --git a/libavformat/assdec.c b/libavformat/assdec.c
index e2cebf8..4f1126c 100644
--- a/libavformat/assdec.c
+++ b/libavformat/assdec.c
@@ -83,7 +83,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
uint8_t *p, **dst[2]={0};
int pos[2]={0};
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return -1;
av_set_pts_info(st, 64, 1, 100);
diff --git a/libavformat/au.c b/libavformat/au.c
index 477bcdb..af00e6d 100644
--- a/libavformat/au.c
+++ b/libavformat/au.c
@@ -156,7 +156,7 @@ static int au_read_header(AVFormatContext *s,
}
/* now we are ready: build format streams */
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return -1;
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 9d17869..441f85d 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1402,6 +1402,7 @@ void av_close_input_file(AVFormatContext *s);
*/
void avformat_free_context(AVFormatContext *s);
+#if FF_API_NEW_STREAM
/**
* Add a new stream to a media file.
*
@@ -1412,7 +1413,27 @@ void avformat_free_context(AVFormatContext *s);
* @param s media file handle
* @param id file-format-dependent stream ID
*/
+attribute_deprecated
AVStream *av_new_stream(AVFormatContext *s, int id);
+#endif
+
+/**
+ * Add a new stream to a media file.
+ *
+ * When demuxing, it is called by the demuxer in read_header(). If the
+ * flag AVFMTCTX_NOHEADER is set in s.ctx_flags, then it may also
+ * be called in read_packet().
+ *
+ * When muxing, should be called by the user before avformat_write_header().
+ *
+ * @param c If non-NULL, the AVCodecContext corresponding to the new stream
+ * will be initialized to use this codec. This is needed for e.g. codec-specific
+ * defaults to be set, so codec should be provided if it is known.
+ *
+ * @return newly created stream or NULL on error.
+ */
+AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c);
+
AVProgram *av_new_program(AVFormatContext *s, int id);
/**
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 345d092..2895d89 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -454,10 +454,11 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
break;
}else{
stream_index++;
- st = av_new_stream(s, stream_index);
+ st = avformat_new_stream(s, NULL);
if (!st)
goto fail;
+ st->id = stream_index;
ast = av_mallocz(sizeof(AVIStream));
if (!ast)
goto fail;
diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
index 32e6d1e..3e7dd46 100644
--- a/libavformat/avisynth.c
+++ b/libavformat/avisynth.c
@@ -84,7 +84,8 @@ static int avisynth_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (AVIStreamReadFormat(stream->handle, 0, &wvfmt, &struct_size) != S_OK)
continue;
- st = av_new_stream(s, id);
+ st = avformat_new_stream(s, NULL);
+ st->id = id;
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->block_align = wvfmt.nBlockAlign;
@@ -110,7 +111,8 @@ static int avisynth_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (AVIStreamReadFormat(stream->handle, 0, &imgfmt, &struct_size) != S_OK)
continue;
- st = av_new_stream(s, id);
+ st = avformat_new_stream(s, NULL);
+ st->id = id;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->r_frame_rate.num = stream->info.dwRate;
st->r_frame_rate.den = stream->info.dwScale;
diff --git a/libavformat/avs.c b/libavformat/avs.c
index ad5ac05..492cb0b 100644
--- a/libavformat/avs.c
+++ b/libavformat/avs.c
@@ -179,7 +179,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt)
case AVS_VIDEO:
if (!avs->st_video) {
- avs->st_video = av_new_stream(s, AVS_VIDEO);
+ avs->st_video = avformat_new_stream(s, NULL);
if (avs->st_video == NULL)
return AVERROR(ENOMEM);
avs->st_video->codec->codec_type = AVMEDIA_TYPE_VIDEO;
@@ -196,7 +196,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt)
case AVS_AUDIO:
if (!avs->st_audio) {
- avs->st_audio = av_new_stream(s, AVS_AUDIO);
+ avs->st_audio = avformat_new_stream(s, NULL);
if (avs->st_audio == NULL)
return AVERROR(ENOMEM);
avs->st_audio->codec->codec_type = AVMEDIA_TYPE_AUDIO;
diff --git a/libavformat/bethsoftvid.c b/libavformat/bethsoftvid.c
index 73d0035..384ac01 100644
--- a/libavformat/bethsoftvid.c
+++ b/libavformat/bethsoftvid.c
@@ -70,7 +70,7 @@ static int vid_read_header(AVFormatContext *s,
avio_skip(pb, 5);
vid->nframes = avio_rl16(pb);
- stream = av_new_stream(s, 0);
+ stream = avformat_new_stream(s, NULL);
if (!stream)
return AVERROR(ENOMEM);
av_set_pts_info(stream, 32, 1, 60); // 16 ms increments, i.e. 60 fps
@@ -83,7 +83,7 @@ static int vid_read_header(AVFormatContext *s,
avio_rl16(pb);
// done with video codec, set up audio codec
- stream = av_new_stream(s, 0);
+ stream = avformat_new_stream(s, NULL);
if (!stream)
return AVERROR(ENOMEM);
stream->codec->codec_type = AVMEDIA_TYPE_AUDIO;
diff --git a/libavformat/bfi.c b/libavformat/bfi.c
index 05ace47..c637104 100644
--- a/libavformat/bfi.c
+++ b/libavformat/bfi.c
@@ -55,12 +55,12 @@ static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap)
int fps, chunk_header;
/* Initialize the video codec... */
- vstream = av_new_stream(s, 0);
+ vstream = avformat_new_stream(s, NULL);
if (!vstream)
return AVERROR(ENOMEM);
/* Initialize the audio codec... */
- astream = av_new_stream(s, 0);
+ astream = avformat_new_stream(s, NULL);
if (!astream)
return AVERROR(ENOMEM);
diff --git a/libavformat/bink.c b/libavformat/bink.c
index 3cd82ac..844498e 100644
--- a/libavformat/bink.c
+++ b/libavformat/bink.c
@@ -78,7 +78,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
uint16_t flags;
int keyframe;
- vst = av_new_stream(s, 0);
+ vst = avformat_new_stream(s, NULL);
if (!vst)
return AVERROR(ENOMEM);
@@ -130,7 +130,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
avio_skip(pb, 4 * bink->num_audio_tracks);
for (i = 0; i < bink->num_audio_tracks; i++) {
- ast = av_new_stream(s, 1);
+ ast = avformat_new_stream(s, NULL);
if (!ast)
return AVERROR(ENOMEM);
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
diff --git a/libavformat/c93.c b/libavformat/c93.c
index adfa876..0f4be89 100644
--- a/libavformat/c93.c
+++ b/libavformat/c93.c
@@ -79,7 +79,7 @@ static int read_header(AVFormatContext *s,
/* Audio streams are added if audio packets are found */
s->ctx_flags |= AVFMTCTX_NOHEADER;
- video = av_new_stream(s, 0);
+ video = avformat_new_stream(s, NULL);
if (!video)
return AVERROR(ENOMEM);
@@ -117,7 +117,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
datasize = avio_rl16(pb);
if (datasize > 42) {
if (!c93->audio) {
- c93->audio = av_new_stream(s, 1);
+ c93->audio = avformat_new_stream(s, NULL);
if (!c93->audio)
return AVERROR(ENOMEM);
c93->audio->codec->codec_type = AVMEDIA_TYPE_AUDIO;
diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c
index a1d2ff7..2b747ce 100644
--- a/libavformat/cafdec.c
+++ b/libavformat/cafdec.c
@@ -61,7 +61,7 @@ static int read_desc_chunk(AVFormatContext *s)
int flags;
/* new audio stream */
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
diff --git a/libavformat/cdg.c b/libavformat/cdg.c
index 1453b63..75f1fb2 100644
--- a/libavformat/cdg.c
+++ b/libavformat/cdg.c
@@ -28,7 +28,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
AVStream *vst;
int ret;
- vst = av_new_stream(s, 0);
+ vst = avformat_new_stream(s, NULL);
if (!vst)
return AVERROR(ENOMEM);
diff --git a/libavformat/daud.c b/libavformat/daud.c
index 34262e0..aa70800 100644
--- a/libavformat/daud.c
+++ b/libavformat/daud.c
@@ -21,7 +21,7 @@
#include "avformat.h"
static int daud_header(AVFormatContext *s, AVFormatParameters *ap) {
- AVStream *st = av_new_stream(s, 0);
+ AVStream *st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
diff --git a/libavformat/dfa.c b/libavformat/dfa.c
index 12ede04..a109a2d 100644
--- a/libavformat/dfa.c
+++ b/libavformat/dfa.c
@@ -45,7 +45,7 @@ static int dfa_read_header(AVFormatContext *s,
avio_skip(pb, 2); // unused
frames = avio_rl16(pb);
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
diff --git a/libavformat/dsicin.c b/libavformat/dsicin.c
index d11e285..09e80e9 100644
--- a/libavformat/dsicin.c
+++ b/libavformat/dsicin.c
@@ -107,7 +107,7 @@ static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap)
cin->audio_buffer_size = 0;
/* initialize the video decoder stream */
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
@@ -120,7 +120,7 @@ static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->height = hdr->video_frame_height;
/* initialize the audio decoder stream */
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
diff --git a/libavformat/dv.c b/libavformat/dv.c
index f495e1e..f0f007a 100644
--- a/libavformat/dv.c
+++ b/libavformat/dv.c
@@ -211,7 +211,7 @@ static int dv_extract_audio_info(DVDemuxContext* c, uint8_t* frame)
/* Dynamic handling of the audio streams in DV */
for (i = 0; i < ach; i++) {
if (!c->ast[i]) {
- c->ast[i] = av_new_stream(c->fctx, 0);
+ c->ast[i] = avformat_new_stream(c->fctx, NULL);
if (!c->ast[i])
break;
av_set_pts_info(c->ast[i], 64, 1, 30000);
@@ -278,7 +278,7 @@ DVDemuxContext* dv_init_demux(AVFormatContext *s)
if (!c)
return NULL;
- c->vst = av_new_stream(s, 0);
+ c->vst = avformat_new_stream(s, NULL);
if (!c->vst) {
av_free(c);
return NULL;
diff --git a/libavformat/dxa.c b/libavformat/dxa.c
index 930ac6f..65a6115 100644
--- a/libavformat/dxa.c
+++ b/libavformat/dxa.c
@@ -87,7 +87,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap)
h = avio_rb16(pb);
c->has_sound = 0;
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return -1;
@@ -100,7 +100,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap)
avio_skip(pb, 16);
fsize = avio_rl32(pb);
- ast = av_new_stream(s, 0);
+ ast = avformat_new_stream(s, NULL);
if (!ast)
return -1;
ret = ff_get_wav_header(pb, ast->codec, fsize);
diff --git a/libavformat/eacdata.c b/libavformat/eacdata.c
index 01acaca..adf48c6 100644
--- a/libavformat/eacdata.c
+++ b/libavformat/eacdata.c
@@ -66,7 +66,7 @@ static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap)
sample_rate = avio_rb16(pb);
avio_skip(pb, (avio_r8(pb) & 0x20) ? 15 : 11);
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c
index f561319..0508a06 100644
--- a/libavformat/electronicarts.c
+++ b/libavformat/electronicarts.c
@@ -408,7 +408,7 @@ static int ea_read_header(AVFormatContext *s,
if (ea->video_codec) {
/* initialize the video decoder stream */
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
ea->video_stream_index = st->index;
@@ -437,7 +437,7 @@ static int ea_read_header(AVFormatContext *s,
}
/* initialize the audio decoder stream */
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
av_set_pts_info(st, 33, 1, ea->sample_rate);
diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c
index 5fa2de3..b8cf119 100644
--- a/libavformat/ffmdec.c
+++ b/libavformat/ffmdec.c
@@ -295,7 +295,7 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
for(i=0;i<nb_streams;i++) {
char rc_eq_buf[128];
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
goto fail;
diff --git a/libavformat/ffmetadec.c b/libavformat/ffmetadec.c
index 4da9dfd..da4dc04 100644
--- a/libavformat/ffmetadec.c
+++ b/libavformat/ffmetadec.c
@@ -132,7 +132,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
get_line(s->pb, line, sizeof(line));
if (!memcmp(line, ID_STREAM, strlen(ID_STREAM))) {
- AVStream *st = av_new_stream(s, 0);
+ AVStream *st = avformat_new_stream(s, NULL);
if (!st)
return -1;
diff --git a/libavformat/filmstripdec.c b/libavformat/filmstripdec.c
index a99dcba..8aa8ee0 100644
--- a/libavformat/filmstripdec.c
+++ b/libavformat/filmstripdec.c
@@ -49,7 +49,7 @@ static int read_header(AVFormatContext *s,
return AVERROR_INVALIDDATA;
}
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c
index 73308f4..7540d33 100644
--- a/libavformat/flacdec.c
+++ b/libavformat/flacdec.c
@@ -31,7 +31,7 @@ static int flac_read_header(AVFormatContext *s,
int ret, metadata_last=0, metadata_type, metadata_size, found_streaminfo=0;
uint8_t header[4];
uint8_t *buffer=NULL;
- AVStream *st = av_new_stream(s, 0);
+ AVStream *st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
diff --git a/libavformat/flic.c b/libavformat/flic.c
index bcef1fd..f4c1a1b 100644
--- a/libavformat/flic.c
+++ b/libavformat/flic.c
@@ -105,7 +105,7 @@ static int flic_read_header(AVFormatContext *s,
speed = FLIC_DEFAULT_SPEED;
/* initialize the decoder streams */
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
flic->video_stream_index = st->index;
@@ -145,7 +145,7 @@ static int flic_read_header(AVFormatContext *s,
*/
if (AV_RL16(&preamble[4]) == FLIC_TFTD_CHUNK_AUDIO) {
/* TFTD videos have an extra 22050 Hz 8-bit mono audio stream */
- ast = av_new_stream(s, 1);
+ ast = avformat_new_stream(s, NULL);
if (!ast)
return AVERROR(ENOMEM);
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 00a455a..9791a19 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -347,9 +347,10 @@ static int flv_read_metabody(AVFormatContext *s, int64_t next_pos) {
}
static AVStream *create_stream(AVFormatContext *s, int stream_type){
- AVStream *st = av_new_stream(s, stream_type);
+ AVStream *st = avformat_new_stream(s, NULL);
if (!st)
return NULL;
+ st->id = stream_type;
switch(stream_type) {
case FLV_STREAM_TYPE_VIDEO: st->codec->codec_type = AVMEDIA_TYPE_VIDEO; break;
case FLV_STREAM_TYPE_AUDIO: st->codec->codec_type = AVMEDIA_TYPE_AUDIO; break;
diff --git a/libavformat/gxf.c b/libavformat/gxf.c
index 898dce7..df99310 100644
--- a/libavformat/gxf.c
+++ b/libavformat/gxf.c
@@ -81,9 +81,10 @@ static int get_sindex(AVFormatContext *s, int id, int format) {
i = ff_find_stream_index(s, id);
if (i >= 0)
return i;
- st = av_new_stream(s, id);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
+ st->id = id;
switch (format) {
case 3:
case 4:
diff --git a/libavformat/idcin.c b/libavformat/idcin.c
index 4a972c9..9d28043 100644
--- a/libavformat/idcin.c
+++ b/libavformat/idcin.c
@@ -153,7 +153,7 @@ static int idcin_read_header(AVFormatContext *s,
bytes_per_sample = avio_rl32(pb);
channels = avio_rl32(pb);
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
av_set_pts_info(st, 33, 1, IDCIN_FPS);
@@ -174,7 +174,7 @@ static int idcin_read_header(AVFormatContext *s,
/* if sample rate is 0, assume no audio */
if (sample_rate) {
idcin->audio_present = 1;
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
av_set_pts_info(st, 33, 1, IDCIN_FPS);
diff --git a/libavformat/idroqdec.c b/libavformat/idroqdec.c
index 5cc32d2..63ba591 100644
--- a/libavformat/idroqdec.c
+++ b/libavformat/idroqdec.c
@@ -84,7 +84,7 @@ static int roq_read_header(AVFormatContext *s,
roq->audio_frame_count = 0;
roq->audio_stream_index = -1;
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
av_set_pts_info(st, 63, 1, framerate);
@@ -166,7 +166,7 @@ static int roq_read_packet(AVFormatContext *s,
case RoQ_SOUND_MONO:
case RoQ_SOUND_STEREO:
if (roq->audio_stream_index == -1) {
- AVStream *st = av_new_stream(s, 1);
+ AVStream *st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
av_set_pts_info(st, 32, 1, RoQ_AUDIO_SAMPLE_RATE);
diff --git a/libavformat/iff.c b/libavformat/iff.c
index ebc4798..2283ed5 100644
--- a/libavformat/iff.c
+++ b/libavformat/iff.c
@@ -135,7 +135,7 @@ static int iff_read_header(AVFormatContext *s,
unsigned transparency = 0;
unsigned masking = 0; // no mask
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
diff --git a/libavformat/img2.c b/libavformat/img2.c
index 1e6fb96..7b89a9c 100644
--- a/libavformat/img2.c
+++ b/libavformat/img2.c
@@ -220,7 +220,7 @@ static int read_header(AVFormatContext *s1, AVFormatParameters *ap)
s1->ctx_flags |= AVFMTCTX_NOHEADER;
- st = av_new_stream(s1, 0);
+ st = avformat_new_stream(s1, NULL);
if (!st) {
return AVERROR(ENOMEM);
}
diff --git a/libavformat/ipmovie.c b/libavformat/ipmovie.c
index c5df1f6..562b19a 100644
--- a/libavformat/ipmovie.c
+++ b/libavformat/ipmovie.c
@@ -559,7 +559,7 @@ static int ipmovie_read_header(AVFormatContext *s,
return AVERROR_INVALIDDATA;
/* initialize the stream decoders */
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
av_set_pts_info(st, 63, 1, 1000000);
@@ -572,7 +572,7 @@ static int ipmovie_read_header(AVFormatContext *s,
st->codec->bits_per_coded_sample = ipmovie->video_bpp;
if (ipmovie->audio_type) {
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
av_set_pts_info(st, 32, 1, ipmovie->audio_sample_rate);
diff --git a/libavformat/iss.c b/libavformat/iss.c
index 9a034c6..4b6314d 100644
--- a/libavformat/iss.c
+++ b/libavformat/iss.c
@@ -88,7 +88,7 @@ static av_cold int iss_read_header(AVFormatContext *s, AVFormatParameters *ap)
iss->sample_start_pos = avio_tell(pb);
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
diff --git a/libavformat/iv8.c b/libavformat/iv8.c
index 1f3dfe2..0359398 100644
--- a/libavformat/iv8.c
+++ b/libavformat/iv8.c
@@ -40,7 +40,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
{
AVStream *st;
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
diff --git a/libavformat/ivfdec.c b/libavformat/ivfdec.c
index 58455d0..cc7687e 100644
--- a/libavformat/ivfdec.c
+++ b/libavformat/ivfdec.c
@@ -40,7 +40,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
avio_rl16(s->pb); // version
avio_rl16(s->pb); // header size
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
diff --git a/libavformat/jvdec.c b/libavformat/jvdec.c
index 42aae6f..7e1a6ce 100644
--- a/libavformat/jvdec.c
+++ b/libavformat/jvdec.c
@@ -69,8 +69,8 @@ static int read_header(AVFormatContext *s,
avio_skip(pb, 80);
- ast = av_new_stream(s, 0);
- vst = av_new_stream(s, 1);
+ ast = avformat_new_stream(s, NULL);
+ vst = avformat_new_stream(s, NULL);
if (!ast || !vst)
return AVERROR(ENOMEM);
diff --git a/libavformat/libnut.c b/libavformat/libnut.c
index 4ed9bb9..7628abd 100644
--- a/libavformat/libnut.c
+++ b/libavformat/libnut.c
@@ -213,7 +213,7 @@ static int nut_read_header(AVFormatContext * avf, AVFormatParameters * ap) {
priv->s = s;
for (i = 0; s[i].type != -1 && i < 2; i++) {
- AVStream * st = av_new_stream(avf, i);
+ AVStream * st = avformat_new_stream(avf, NULL);
int j;
for (j = 0; j < s[i].fourcc_len && j < 8; j++) st->codec->codec_tag |= s[i].fourcc[j]<<(j*8);
diff --git a/libavformat/lmlm4.c b/libavformat/lmlm4.c
index b965d60..96007aa 100644
--- a/libavformat/lmlm4.c
+++ b/libavformat/lmlm4.c
@@ -60,14 +60,14 @@ static int lmlm4_probe(AVProbeData * pd) {
static int lmlm4_read_header(AVFormatContext *s, AVFormatParameters *ap) {
AVStream *st;
- if (!(st = av_new_stream(s, 0)))
+ if (!(st = avformat_new_stream(s, NULL)))
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_MPEG4;
st->need_parsing = AVSTREAM_PARSE_HEADERS;
av_set_pts_info(st, 64, 1001, 30000);
- if (!(st = av_new_stream(s, 1)))
+ if (!(st = avformat_new_stream(s, NULL)))
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_MP2;
diff --git a/libavformat/lxfdec.c b/libavformat/lxfdec.c
index 0907cb7..855e625 100644
--- a/libavformat/lxfdec.c
+++ b/libavformat/lxfdec.c
@@ -217,7 +217,7 @@ static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
if ((ret = avio_read(pb, header_data, LXF_HEADER_DATA_SIZE)) != LXF_HEADER_DATA_SIZE)
return ret < 0 ? ret : AVERROR_EOF;
- if (!(st = av_new_stream(s, 0)))
+ if (!(st = avformat_new_stream(s, NULL)))
return AVERROR(ENOMEM);
st->duration = AV_RL32(&header_data[32]);
@@ -243,7 +243,7 @@ static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
av_log(s, AV_LOG_WARNING, "VBI data not yet supported\n");
if ((lxf->channels = (disk_params >> 2) & 0xF)) {
- if (!(st = av_new_stream(s, 1)))
+ if (!(st = avformat_new_stream(s, NULL)))
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 8faa3cc..207c749 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1444,7 +1444,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
}
}
- st = track->stream = av_new_stream(s, 0);
+ st = track->stream = avformat_new_stream(s, NULL);
if (st == NULL)
return AVERROR(ENOMEM);
@@ -1639,7 +1639,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
attachements[j].bin.data && attachements[j].bin.size > 0)) {
av_log(matroska->ctx, AV_LOG_ERROR, "incomplete attachment\n");
} else {
- AVStream *st = av_new_stream(s, 0);
+ AVStream *st = avformat_new_stream(s, NULL);
if (st == NULL)
break;
av_dict_set(&st->metadata, "filename",attachements[j].filename, 0);
diff --git a/libavformat/mm.c b/libavformat/mm.c
index 2cca7c9..3ad4741 100644
--- a/libavformat/mm.c
+++ b/libavformat/mm.c
@@ -105,7 +105,7 @@ static int read_header(AVFormatContext *s,
avio_skip(pb, length - 10); /* unknown data */
/* video stream */
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
@@ -117,7 +117,7 @@ static int read_header(AVFormatContext *s,
/* audio stream */
if (length == MM_HEADER_LEN_AV) {
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
diff --git a/libavformat/mmf.c b/libavformat/mmf.c
index 0f64b99..956f567 100644
--- a/libavformat/mmf.c
+++ b/libavformat/mmf.c
@@ -241,7 +241,7 @@ static int mmf_read_header(AVFormatContext *s,
}
mmf->data_size = size;
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
diff --git a/libavformat/mov.c b/libavformat/mov.c
index e9f4162..fb60033 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1843,8 +1843,9 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom)
MOVStreamContext *sc;
int ret;
- st = av_new_stream(c->fc, c->fc->nb_streams);
+ st = avformat_new_stream(c->fc, NULL);
if (!st) return AVERROR(ENOMEM);
+ st->id = c->fc->nb_streams;
sc = av_mallocz(sizeof(MOVStreamContext));
if (!sc) return AVERROR(ENOMEM);
diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index 7fe7df2..1210087 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -137,7 +137,7 @@ static int mp3_read_header(AVFormatContext *s,
AVStream *st;
int64_t off;
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
diff --git a/libavformat/mpc.c b/libavformat/mpc.c
index 8027241..f377e1f 100644
--- a/libavformat/mpc.c
+++ b/libavformat/mpc.c
@@ -84,7 +84,7 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap)
c->curbits = 8;
c->frames_noted = 0;
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c
index 6f722d9..22e2adc 100644
--- a/libavformat/mpc8.c
+++ b/libavformat/mpc8.c
@@ -222,7 +222,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap)
c->samples = ffio_read_varlen(pb);
ffio_read_varlen(pb); //silence samples at the beginning
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
index 8a79eca..5b72c93 100644
--- a/libavformat/mpeg.c
+++ b/libavformat/mpeg.c
@@ -537,9 +537,10 @@ static int mpegps_read_packet(AVFormatContext *s,
goto redo;
}
/* no stream found: add a new stream */
- st = av_new_stream(s, startcode);
+ st = avformat_new_stream(s, NULL);
if (!st)
goto skip;
+ st->id = startcode;
st->codec->codec_type = type;
st->codec->codec_id = codec_id;
st->request_probe = request_probe;
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index ea4c535..65cae04 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -620,12 +620,13 @@ static int mpegts_set_stream_info(AVStream *st, PESContext *pes,
return AVERROR(ENOMEM);
memcpy(sub_pes, pes, sizeof(*sub_pes));
- sub_st = av_new_stream(pes->stream, pes->pid);
+ sub_st = avformat_new_stream(pes->stream, NULL);
if (!sub_st) {
av_free(sub_pes);
return AVERROR(ENOMEM);
}
+ sub_st->id = pes->pid;
av_set_pts_info(sub_st, 33, 1, 90000);
sub_st->priv_data = sub_pes;
sub_st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
@@ -726,9 +727,10 @@ static int mpegts_push_data(MpegTSFilter *filter,
/* stream not present in PMT */
if (!pes->st) {
- pes->st = av_new_stream(ts->stream, pes->pid);
+ pes->st = avformat_new_stream(ts->stream, NULL);
if (!pes->st)
return AVERROR(ENOMEM);
+ pes->st->id = pes->pid;
mpegts_set_stream_info(pes->st, pes, 0, 0);
}
@@ -1120,14 +1122,18 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
/* now create ffmpeg stream */
if (ts->pids[pid] && ts->pids[pid]->type == MPEGTS_PES) {
pes = ts->pids[pid]->u.pes_filter.opaque;
- if (!pes->st)
- pes->st = av_new_stream(pes->stream, pes->pid);
+ if (!pes->st) {
+ pes->st = avformat_new_stream(pes->stream, NULL);
+ st->id = pes->pid;
+ }
st = pes->st;
} else {
if (ts->pids[pid]) mpegts_close_filter(ts, ts->pids[pid]); //wrongly added sdt filter probably
pes = add_pes_stream(ts, pid, pcr_pid);
- if (pes)
- st = av_new_stream(pes->stream, pes->pid);
+ if (pes) {
+ st = avformat_new_stream(pes->stream, NULL);
+ st->id = pes->pid;
+ }
}
if (!st)
@@ -1594,7 +1600,7 @@ static int mpegts_read_header(AVFormatContext *s,
/* only read packets */
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
goto fail;
av_set_pts_info(st, 60, 1, 27000000);
diff --git a/libavformat/msnwc_tcp.c b/libavformat/msnwc_tcp.c
index a08938a..b394b87 100644
--- a/libavformat/msnwc_tcp.c
+++ b/libavformat/msnwc_tcp.c
@@ -75,7 +75,7 @@ static int msnwc_tcp_read_header(AVFormatContext *ctx, AVFormatParameters *ap)
AVCodecContext *codec;
AVStream *st;
- st = av_new_stream(ctx, 0);
+ st = avformat_new_stream(ctx, NULL);
if(!st)
return AVERROR(ENOMEM);
diff --git a/libavformat/mtv.c b/libavformat/mtv.c
index 2fa48cc..966e9bb 100644
--- a/libavformat/mtv.c
+++ b/libavformat/mtv.c
@@ -32,8 +32,6 @@
#define MTV_HEADER_SIZE 512
#define MTV_AUDIO_PADDING_SIZE 12
#define AUDIO_SAMPLING_RATE 44100
-#define VIDEO_SID 0
-#define AUDIO_SID 1
typedef struct MTVDemuxContext {
@@ -118,7 +116,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap)
// video - raw rgb565
- st = av_new_stream(s, VIDEO_SID);
+ st = avformat_new_stream(s, NULL);
if(!st)
return AVERROR(ENOMEM);
@@ -134,7 +132,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap)
// audio - mp3
- st = av_new_stream(s, AUDIO_SID);
+ st = avformat_new_stream(s, NULL);
if(!st)
return AVERROR(ENOMEM);
@@ -171,7 +169,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt)
return ret;
pkt->pos -= MTV_AUDIO_PADDING_SIZE;
- pkt->stream_index = AUDIO_SID;
+ pkt->stream_index = 1;
}else
{
@@ -190,7 +188,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt)
for(i=0;i<mtv->img_segment_size/2;i++)
*((uint16_t *)pkt->data+i) = av_bswap16(*((uint16_t *)pkt->data+i));
#endif
- pkt->stream_index = VIDEO_SID;
+ pkt->stream_index = 0;
}
return ret;
diff --git a/libavformat/mvi.c b/libavformat/mvi.c
index 846af8d..8586d10 100644
--- a/libavformat/mvi.c
+++ b/libavformat/mvi.c
@@ -42,11 +42,11 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
AVStream *ast, *vst;
unsigned int version, frames_count, msecs_per_frame, player_version;
- ast = av_new_stream(s, 0);
+ ast = avformat_new_stream(s, NULL);
if (!ast)
return AVERROR(ENOMEM);
- vst = av_new_stream(s, 0);
+ vst = avformat_new_stream(s, NULL);
if (!vst)
return AVERROR(ENOMEM);
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 5967df0..e1fec3d 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -852,11 +852,12 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
if (!source_track)
continue;
- st = av_new_stream(mxf->fc, source_track->track_id);
+ st = avformat_new_stream(mxf->fc, NULL);
if (!st) {
av_log(mxf->fc, AV_LOG_ERROR, "could not allocate stream\n");
return -1;
}
+ st->id = source_track->track_id;
st->priv_data = source_track;
st->duration = component->duration;
if (st->duration == -1)
diff --git a/libavformat/mxg.c b/libavformat/mxg.c
index e884311..04991b3 100644
--- a/libavformat/mxg.c
+++ b/libavformat/mxg.c
@@ -24,8 +24,6 @@
#include "avformat.h"
#include "avio.h"
-#define VIDEO_STREAM_INDEX 0
-#define AUDIO_STREAM_INDEX 1
#define DEFAULT_PACKET_SIZE 1024
#define OVERREAD_SIZE 3
@@ -44,14 +42,14 @@ static int mxg_read_header(AVFormatContext *s, AVFormatParameters *ap)
MXGContext *mxg = s->priv_data;
/* video parameters will be extracted from the compressed bitstream */
- video_st = av_new_stream(s, VIDEO_STREAM_INDEX);
+ video_st = avformat_new_stream(s, NULL);
if (!video_st)
return AVERROR(ENOMEM);
video_st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
video_st->codec->codec_id = CODEC_ID_MXPEG;
av_set_pts_info(video_st, 64, 1, 1000000);
- audio_st = av_new_stream(s, AUDIO_STREAM_INDEX);
+ audio_st = avformat_new_stream(s, NULL);
if (!audio_st)
return AVERROR(ENOMEM);
audio_st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
@@ -166,7 +164,7 @@ static int mxg_read_packet(AVFormatContext *s, AVPacket *pkt)
}
pkt->pts = pkt->dts = mxg->dts;
- pkt->stream_index = VIDEO_STREAM_INDEX;
+ pkt->stream_index = 0;
pkt->destruct = NULL;
pkt->size = mxg->buffer_ptr - mxg->soi_ptr;
pkt->data = mxg->soi_ptr;
@@ -204,7 +202,7 @@ static int mxg_read_packet(AVFormatContext *s, AVPacket *pkt)
if (marker == APP13 && size >= 16) { /* audio data */
/* time (GMT) of first sample in usec since 1970, little-endian */
pkt->pts = pkt->dts = AV_RL64(startmarker_ptr + 8);
- pkt->stream_index = AUDIO_STREAM_INDEX;
+ pkt->stream_index = 1;
pkt->destruct = NULL;
pkt->size = size - 14;
pkt->data = startmarker_ptr + 16;
diff --git a/libavformat/ncdec.c b/libavformat/ncdec.c
index e04a6aa..3430035 100644
--- a/libavformat/ncdec.c
+++ b/libavformat/ncdec.c
@@ -45,7 +45,7 @@ static int nc_probe(AVProbeData *probe_packet)
static int nc_read_header(AVFormatContext *s, AVFormatParameters *ap)
{
- AVStream *st = av_new_stream(s, 0);
+ AVStream *st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c
index b3bb31f..5de7512 100644
--- a/libavformat/nsvdec.c
+++ b/libavformat/nsvdec.c
@@ -438,10 +438,11 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap)
nsv->vheight = vwidth;
if (vtag != T_NONE) {
int i;
- st = av_new_stream(s, NSV_ST_VIDEO);
+ st = avformat_new_stream(s, NULL);
if (!st)
goto fail;
+ st->id = NSV_ST_VIDEO;
nst = av_mallocz(sizeof(NSVStream));
if (!nst)
goto fail;
@@ -469,10 +470,11 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap)
}
if (atag != T_NONE) {
#ifndef DISABLE_AUDIO
- st = av_new_stream(s, NSV_ST_AUDIO);
+ st = avformat_new_stream(s, NULL);
if (!st)
goto fail;
+ st->id = NSV_ST_AUDIO;
nst = av_mallocz(sizeof(NSVStream));
if (!nst)
goto fail;
diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index a9a992a..c48f503 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -288,7 +288,7 @@ static int decode_main_header(NUTContext *nut){
nut->stream = av_mallocz(sizeof(StreamContext)*stream_count);
for(i=0; i<stream_count; i++){
- av_new_stream(s, i);
+ avformat_new_stream(s, NULL);
}
return 0;
diff --git a/libavformat/nuv.c b/libavformat/nuv.c
index 2444a50..caf85b0 100644
--- a/libavformat/nuv.c
+++ b/libavformat/nuv.c
@@ -153,7 +153,7 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) {
if (v_packs) {
ctx->v_id = stream_nr++;
- vst = av_new_stream(s, ctx->v_id);
+ vst = avformat_new_stream(s, NULL);
if (!vst)
return AVERROR(ENOMEM);
vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
@@ -169,7 +169,7 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) {
if (a_packs) {
ctx->a_id = stream_nr++;
- ast = av_new_stream(s, ctx->a_id);
+ ast = avformat_new_stream(s, NULL);
if (!ast)
return AVERROR(ENOMEM);
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index 62dab85..8e7653c 100644
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -171,10 +171,11 @@ static int ogg_new_stream(AVFormatContext *s, uint32_t serial, int new_avstream)
os->header = -1;
if (new_avstream) {
- st = av_new_stream(s, idx);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
+ st->id = idx;
av_set_pts_info(st, 64, 1, 1000000);
}
diff --git a/libavformat/oma.c b/libavformat/oma.c
index 09fa2ca..eeb9205 100644
--- a/libavformat/oma.c
+++ b/libavformat/oma.c
@@ -307,7 +307,7 @@ static int oma_read_header(AVFormatContext *s,
codec_params = AV_RB24(&buf[33]);
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
diff --git a/libavformat/psxstr.c b/libavformat/psxstr.c
index 398e44e..675a4b1 100644
--- a/libavformat/psxstr.c
+++ b/libavformat/psxstr.c
@@ -196,7 +196,7 @@ static int str_read_packet(AVFormatContext *s,
if(str->channels[channel].video_stream_index < 0){
/* allocate a new AVStream */
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
av_set_pts_info(st, 64, 1, 15);
@@ -244,7 +244,7 @@ static int str_read_packet(AVFormatContext *s,
if(str->channels[channel].audio_stream_index < 0){
int fmt = sector[0x13];
/* allocate a new AVStream */
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
diff --git a/libavformat/pva.c b/libavformat/pva.c
index 1aad6db..7e8fa8e 100644
--- a/libavformat/pva.c
+++ b/libavformat/pva.c
@@ -56,7 +56,7 @@ static int pva_probe(AVProbeData * pd) {
static int pva_read_header(AVFormatContext *s, AVFormatParameters *ap) {
AVStream *st;
- if (!(st = av_new_stream(s, 0)))
+ if (!(st = avformat_new_stream(s, NULL)))
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_MPEG2VIDEO;
@@ -64,7 +64,7 @@ static int pva_read_header(AVFormatContext *s, AVFormatParameters *ap) {
av_set_pts_info(st, 32, 1, 90000);
av_add_index_entry(st, 0, 0, 0, 0, AVINDEX_KEYFRAME);
- if (!(st = av_new_stream(s, 1)))
+ if (!(st = avformat_new_stream(s, NULL)))
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_MP2;
diff --git a/libavformat/qcp.c b/libavformat/qcp.c
index 4cff63c..c88c39b 100644
--- a/libavformat/qcp.c
+++ b/libavformat/qcp.c
@@ -84,7 +84,7 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap)
{
AVIOContext *pb = s->pb;
QCPContext *c = s->priv_data;
- AVStream *st = av_new_stream(s, 0);
+ AVStream *st = avformat_new_stream(s, NULL);
uint8_t buf[16];
int i, nb_rates;
diff --git a/libavformat/r3d.c b/libavformat/r3d.c
index d84fd2c..75fc4a4 100644
--- a/libavformat/r3d.c
+++ b/libavformat/r3d.c
@@ -52,7 +52,7 @@ static int read_atom(AVFormatContext *s, Atom *atom)
static int r3d_read_red1(AVFormatContext *s)
{
- AVStream *st = av_new_stream(s, 0);
+ AVStream *st = avformat_new_stream(s, NULL);
char filename[258];
int tmp;
int av_unused tmp2;
@@ -89,7 +89,7 @@ static int r3d_read_red1(AVFormatContext *s)
tmp = avio_r8(s->pb); // audio channels
av_dlog(s, "audio channels %d\n", tmp);
if (tmp > 0) {
- AVStream *ast = av_new_stream(s, 1);
+ AVStream *ast = avformat_new_stream(s, NULL);
if (!ast)
return AVERROR(ENOMEM);
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c
index 7726f02..37e9b0c 100644
--- a/libavformat/rawdec.c
+++ b/libavformat/rawdec.c
@@ -33,7 +33,7 @@ int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
AVStream *st;
enum CodecID id;
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
@@ -122,7 +122,7 @@ int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt)
int ff_raw_audio_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
- AVStream *st = av_new_stream(s, 0);
+ AVStream *st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
@@ -144,7 +144,7 @@ int ff_raw_video_read_header(AVFormatContext *s,
int ret = 0;
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st) {
ret = AVERROR(ENOMEM);
goto fail;
diff --git a/libavformat/rdt.c b/libavformat/rdt.c
index bbdb899..74f9c55 100644
--- a/libavformat/rdt.c
+++ b/libavformat/rdt.c
@@ -459,8 +459,9 @@ add_dstream(AVFormatContext *s, AVStream *orig_st)
{
AVStream *st;
- if (!(st = av_new_stream(s, orig_st->id)))
+ if (!(st = avformat_new_stream(s, NULL)))
return NULL;
+ st->id = orig_st->id;
st->codec->codec_type = orig_st->codec->codec_type;
st->first_dts = orig_st->first_dts;
diff --git a/libavformat/riff.c b/libavformat/riff.c
index 98f0824..7492df7 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -281,10 +281,10 @@ const AVCodecTag ff_codec_bmp_tags[] = {
{ CODEC_ID_G2M, MKTAG('G', '2', 'M', '3') },
{ CODEC_ID_G2M, MKTAG('G', '2', 'M', '4') },
{ CODEC_ID_AMV, MKTAG('A', 'M', 'V', 'F') },
+ { CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'R', 'A') },
+ { CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'R', 'G') },
{ CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'Y', '0') },
{ CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'Y', '2') },
- { CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'R', 'G') },
- { CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'R', 'A') },
{ CODEC_ID_NONE, 0 }
};
diff --git a/libavformat/rl2.c b/libavformat/rl2.c
index b9f38be..743250a 100644
--- a/libavformat/rl2.c
+++ b/libavformat/rl2.c
@@ -110,7 +110,7 @@ static av_cold int rl2_read_header(AVFormatContext *s,
def_sound_size = avio_rl16(pb);
/** setup video stream */
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if(!st)
return AVERROR(ENOMEM);
@@ -140,7 +140,7 @@ static av_cold int rl2_read_header(AVFormatContext *s,
pts_num = def_sound_size;
pts_den = rate;
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index 131345c..b73b51a 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -397,7 +397,7 @@ static int rm_read_header_old(AVFormatContext *s)
AVStream *st;
rm->old_format = 1;
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return -1;
st->priv_data = ff_rm_alloc_rmstream();
@@ -463,7 +463,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
rm_read_metadata(s, 1);
break;
case MKTAG('M', 'D', 'P', 'R'):
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
st->id = avio_rb16(pb);
diff --git a/libavformat/rpl.c b/libavformat/rpl.c
index 009a67f..b8214e3 100644
--- a/libavformat/rpl.c
+++ b/libavformat/rpl.c
@@ -139,7 +139,7 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap)
av_dict_set(&s->metadata, "author" , line, 0);
// video headers
- vst = av_new_stream(s, 0);
+ vst = avformat_new_stream(s, NULL);
if (!vst)
return AVERROR(ENOMEM);
vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
@@ -181,7 +181,7 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap)
// samples, though. This code will ignore additional tracks.
audio_format = read_line_and_int(pb, &error); // audio format ID
if (audio_format) {
- ast = av_new_stream(s, 0);
+ ast = avformat_new_stream(s, NULL);
if (!ast)
return AVERROR(ENOMEM);
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
diff --git a/libavformat/rsodec.c b/libavformat/rsodec.c
index a34be80..14adc04 100644
--- a/libavformat/rsodec.c
+++ b/libavformat/rsodec.c
@@ -54,7 +54,7 @@ static int rso_read_header(AVFormatContext *s, AVFormatParameters *ap)
}
/* now we are ready: build format streams */
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
diff --git a/libavformat/rtpenc_chain.c b/libavformat/rtpenc_chain.c
index df7b995..f4590fa 100644
--- a/libavformat/rtpenc_chain.c
+++ b/libavformat/rtpenc_chain.c
@@ -43,7 +43,7 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st,
return NULL;
rtpctx->oformat = rtp_format;
- if (!av_new_stream(rtpctx, 0)) {
+ if (!avformat_new_stream(rtpctx, NULL)) {
av_free(rtpctx);
return NULL;
}
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index cc47f92..1153396 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -357,9 +357,10 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
if (!strcmp(ff_rtp_enc_name(rtsp_st->sdp_payload_type), "MP2T")) {
/* no corresponding stream */
} else {
- st = av_new_stream(s, rt->nb_rtsp_streams - 1);
+ st = avformat_new_stream(s, NULL);
if (!st)
return;
+ st->id = rt->nb_rtsp_streams - 1;
rtsp_st->stream_index = st->index;
st->codec->codec_type = codec_type;
if (rtsp_st->sdp_payload_type < RTP_PT_PRIVATE) {
diff --git a/libavformat/sapdec.c b/libavformat/sapdec.c
index 5351e98..68e3c5c 100644
--- a/libavformat/sapdec.c
+++ b/libavformat/sapdec.c
@@ -163,11 +163,12 @@ static int sap_read_header(AVFormatContext *s,
if (sap->sdp_ctx->ctx_flags & AVFMTCTX_NOHEADER)
s->ctx_flags |= AVFMTCTX_NOHEADER;
for (i = 0; i < sap->sdp_ctx->nb_streams; i++) {
- AVStream *st = av_new_stream(s, i);
+ AVStream *st = avformat_new_stream(s, NULL);
if (!st) {
ret = AVERROR(ENOMEM);
goto fail;
}
+ st->id = i;
avcodec_copy_context(st->codec, sap->sdp_ctx->streams[i]->codec);
st->time_base = sap->sdp_ctx->streams[i]->time_base;
}
@@ -211,11 +212,12 @@ static int sap_fetch_packet(AVFormatContext *s, AVPacket *pkt)
if (s->ctx_flags & AVFMTCTX_NOHEADER) {
while (sap->sdp_ctx->nb_streams > s->nb_streams) {
int i = s->nb_streams;
- AVStream *st = av_new_stream(s, i);
+ AVStream *st = avformat_new_stream(s, NULL);
if (!st) {
av_free_packet(pkt);
return AVERROR(ENOMEM);
}
+ st->id = i;
avcodec_copy_context(st->codec, sap->sdp_ctx->streams[i]->codec);
st->time_base = sap->sdp_ctx->streams[i]->time_base;
}
diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c
index 15234c7..1ae105e 100644
--- a/libavformat/segafilm.c
+++ b/libavformat/segafilm.c
@@ -134,7 +134,7 @@ static int film_read_header(AVFormatContext *s,
/* initialize the decoder streams */
if (film->video_type) {
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
film->video_stream_index = st->index;
@@ -146,7 +146,7 @@ static int film_read_header(AVFormatContext *s,
}
if (film->audio_type) {
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
film->audio_stream_index = st->index;
diff --git a/libavformat/sierravmd.c b/libavformat/sierravmd.c
index 3b9a9a1..e1367c2 100644
--- a/libavformat/sierravmd.c
+++ b/libavformat/sierravmd.c
@@ -104,7 +104,7 @@ static int vmd_read_header(AVFormatContext *s,
else
vmd->is_indeo3 = 0;
/* start up the decoders */
- vst = av_new_stream(s, 0);
+ vst = avformat_new_stream(s, NULL);
if (!vst)
return AVERROR(ENOMEM);
av_set_pts_info(vst, 33, 1, 10);
@@ -125,7 +125,7 @@ static int vmd_read_header(AVFormatContext *s,
/* if sample rate is 0, assume no audio */
vmd->sample_rate = AV_RL16(&vmd->vmd_header[804]);
if (vmd->sample_rate) {
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
vmd->audio_stream_index = st->index;
diff --git a/libavformat/siff.c b/libavformat/siff.c
index d39655f..77cbc66 100644
--- a/libavformat/siff.c
+++ b/libavformat/siff.c
@@ -71,7 +71,7 @@ static int siff_probe(AVProbeData *p)
static int create_audio_stream(AVFormatContext *s, SIFFContext *c)
{
AVStream *ast;
- ast = av_new_stream(s, 0);
+ ast = avformat_new_stream(s, NULL);
if (!ast)
return -1;
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
@@ -115,7 +115,7 @@ static int siff_parse_vbv1(AVFormatContext *s, SIFFContext *c, AVIOContext *pb)
avio_skip(pb, 16); //zeroes
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return -1;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
diff --git a/libavformat/smacker.c b/libavformat/smacker.c
index c2239b2..3ffb65e 100644
--- a/libavformat/smacker.c
+++ b/libavformat/smacker.c
@@ -154,7 +154,7 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap)
}
/* init video codec */
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return -1;
smk->videoindex = st->index;
@@ -177,7 +177,7 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap)
for(i = 0; i < 7; i++) {
smk->indexes[i] = -1;
if (smk->rates[i]) {
- ast[i] = av_new_stream(s, 0);
+ ast[i] = avformat_new_stream(s, NULL);
smk->indexes[i] = ast[i]->index;
ast[i]->codec->codec_type = AVMEDIA_TYPE_AUDIO;
if (smk->aflags[i] & SMK_AUD_BINKAUD) {
diff --git a/libavformat/sol.c b/libavformat/sol.c
index 1389128..cd5b2d7 100644
--- a/libavformat/sol.c
+++ b/libavformat/sol.c
@@ -110,7 +110,7 @@ static int sol_read_header(AVFormatContext *s,
else id = 0;
/* now we are ready: build format streams */
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return -1;
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
diff --git a/libavformat/soxdec.c b/libavformat/soxdec.c
index af8cfef..dac4bed 100644
--- a/libavformat/soxdec.c
+++ b/libavformat/soxdec.c
@@ -51,7 +51,7 @@ static int sox_read_header(AVFormatContext *s,
double sample_rate, sample_rate_frac;
AVStream *st;
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
diff --git a/libavformat/spdifdec.c b/libavformat/spdifdec.c
index 64960ff..13ec2f0 100644
--- a/libavformat/spdifdec.c
+++ b/libavformat/spdifdec.c
@@ -205,7 +205,7 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt)
if (!s->nb_streams) {
/* first packet, create a stream */
- AVStream *st = av_new_stream(s, 0);
+ AVStream *st = avformat_new_stream(s, NULL);
if (!st) {
av_free_packet(pkt);
return AVERROR(ENOMEM);
diff --git a/libavformat/srtdec.c b/libavformat/srtdec.c
index 0a94a7f..2828cc7 100644
--- a/libavformat/srtdec.c
+++ b/libavformat/srtdec.c
@@ -42,7 +42,7 @@ static int srt_probe(AVProbeData *p)
static int srt_read_header(AVFormatContext *s, AVFormatParameters *ap)
{
- AVStream *st = av_new_stream(s, 0);
+ AVStream *st = avformat_new_stream(s, NULL);
if (!st)
return -1;
av_set_pts_info(st, 64, 1, 1000);
diff --git a/libavformat/swfdec.c b/libavformat/swfdec.c
index e6f659b..175e40e 100644
--- a/libavformat/swfdec.c
+++ b/libavformat/swfdec.c
@@ -106,9 +106,10 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
avio_rl16(pb);
avio_r8(pb);
/* Check for FLV1 */
- vst = av_new_stream(s, ch_id);
+ vst = avformat_new_stream(s, NULL);
if (!vst)
return -1;
+ vst->id = ch_id;
vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
vst->codec->codec_id = ff_codec_get_id(swf_codec_tags, avio_r8(pb));
av_set_pts_info(vst, 16, 256, swf->frame_rate);
@@ -127,9 +128,10 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
avio_r8(pb);
v = avio_r8(pb);
swf->samples_per_frame = avio_rl16(pb);
- ast = av_new_stream(s, -1); /* -1 to avoid clash with video stream ch_id */
+ ast = avformat_new_stream(s, NULL);
if (!ast)
return -1;
+ ast->id = -1; /* -1 to avoid clash with video stream ch_id */
ast->codec->channels = 1 + (v&1);
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
ast->codec->codec_id = ff_codec_get_id(swf_audio_codec_tags, (v>>4) & 15);
@@ -177,9 +179,10 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
break;
}
if (i == s->nb_streams) {
- vst = av_new_stream(s, -2); /* -2 to avoid clash with video stream and audio stream */
+ vst = avformat_new_stream(s, NULL);
if (!vst)
return -1;
+ vst->id = -2; /* -2 to avoid clash with video stream and audio stream */
vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
vst->codec->codec_id = CODEC_ID_MJPEG;
av_set_pts_info(vst, 64, 256, swf->frame_rate);
diff --git a/libavformat/thp.c b/libavformat/thp.c
index 17054df..e2aba3b 100644
--- a/libavformat/thp.c
+++ b/libavformat/thp.c
@@ -94,7 +94,7 @@ static int thp_read_header(AVFormatContext *s,
break;
/* Video component. */
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
@@ -117,7 +117,7 @@ static int thp_read_header(AVFormatContext *s,
break;
/* Audio component. */
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
diff --git a/libavformat/tiertexseq.c b/libavformat/tiertexseq.c
index d8bdf2a..dfed70c 100644
--- a/libavformat/tiertexseq.c
+++ b/libavformat/tiertexseq.c
@@ -206,7 +206,7 @@ static int seq_read_header(AVFormatContext *s, AVFormatParameters *ap)
seq->audio_buffer_full = 0;
/* initialize the video decoder stream */
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
@@ -219,7 +219,7 @@ static int seq_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->height = SEQ_FRAME_H;
/* initialize the audio decoder stream */
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
diff --git a/libavformat/tmv.c b/libavformat/tmv.c
index 3fce1e8..03d6e08 100644
--- a/libavformat/tmv.c
+++ b/libavformat/tmv.c
@@ -73,10 +73,10 @@ static int tmv_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (avio_rl32(pb) != TMV_TAG)
return -1;
- if (!(vst = av_new_stream(s, 0)))
+ if (!(vst = avformat_new_stream(s, NULL)))
return AVERROR(ENOMEM);
- if (!(ast = av_new_stream(s, 0)))
+ if (!(ast = avformat_new_stream(s, NULL)))
return AVERROR(ENOMEM);
ast->codec->sample_rate = avio_rl16(pb);
diff --git a/libavformat/tta.c b/libavformat/tta.c
index 23e54b2..ca2d36b 100644
--- a/libavformat/tta.c
+++ b/libavformat/tta.c
@@ -77,7 +77,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap)
return -1;
}
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
diff --git a/libavformat/tty.c b/libavformat/tty.c
index 913ec45..5c9fee7 100644
--- a/libavformat/tty.c
+++ b/libavformat/tty.c
@@ -76,7 +76,7 @@ static int read_header(AVFormatContext *avctx,
{
TtyDemuxContext *s = avctx->priv_data;
int width = 0, height = 0, ret = 0;
- AVStream *st = av_new_stream(avctx, 0);
+ AVStream *st = avformat_new_stream(avctx, NULL);
AVRational framerate;
if (!st) {
diff --git a/libavformat/txd.c b/libavformat/txd.c
index 6928216..5d9f969 100644
--- a/libavformat/txd.c
+++ b/libavformat/txd.c
@@ -40,7 +40,7 @@ static int txd_probe(AVProbeData * pd) {
static int txd_read_header(AVFormatContext *s, AVFormatParameters *ap) {
AVStream *st;
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
diff --git a/libavformat/utils.c b/libavformat/utils.c
index d1fdef2..f00b1cb 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2762,8 +2762,18 @@ void av_close_input_file(AVFormatContext *s)
avio_close(pb);
}
+#if FF_API_NEW_STREAM
AVStream *av_new_stream(AVFormatContext *s, int id)
{
+ AVStream *st = avformat_new_stream(s, NULL);
+ if (st)
+ st->id = id;
+ return st;
+}
+#endif
+
+AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c)
+{
AVStream *st;
int i;
AVStream **streams;
@@ -2783,13 +2793,12 @@ AVStream *av_new_stream(AVFormatContext *s, int id)
return NULL;
}
- st->codec = avcodec_alloc_context3(NULL);
+ st->codec = avcodec_alloc_context3(c);
if (s->iformat) {
/* no default bitrate if decoding */
st->codec->bit_rate = 0;
}
st->index = s->nb_streams;
- st->id = id;
st->start_time = AV_NOPTS_VALUE;
st->duration = AV_NOPTS_VALUE;
/* we set the current DTS to 0 so that formats without any timestamps
diff --git a/libavformat/vc1test.c b/libavformat/vc1test.c
index 5742155..ed72119 100644
--- a/libavformat/vc1test.c
+++ b/libavformat/vc1test.c
@@ -54,7 +54,7 @@ static int vc1t_read_header(AVFormatContext *s,
return -1;
/* init video codec */
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return -1;
diff --git a/libavformat/version.h b/libavformat/version.h
index 1f36544..333a3a0 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -24,8 +24,8 @@
#include "libavutil/avutil.h"
#define LIBAVFORMAT_VERSION_MAJOR 53
-#define LIBAVFORMAT_VERSION_MINOR 16
-#define LIBAVFORMAT_VERSION_MICRO 1
+#define LIBAVFORMAT_VERSION_MINOR 17
+#define LIBAVFORMAT_VERSION_MICRO 0
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
@@ -98,5 +98,8 @@
#ifndef FF_API_RTSP_URL_OPTIONS
#define FF_API_RTSP_URL_OPTIONS (LIBAVFORMAT_VERSION_MAJOR < 54)
#endif
+#ifndef FF_API_NEW_STREAM
+#define FF_API_NEW_STREAM (LIBAVFORMAT_VERSION_MAJOR < 54)
+#endif
#endif /* AVFORMAT_VERSION_H */
diff --git a/libavformat/vocdec.c b/libavformat/vocdec.c
index fed7c6d..6ee8d33 100644
--- a/libavformat/vocdec.c
+++ b/libavformat/vocdec.c
@@ -52,7 +52,7 @@ static int voc_read_header(AVFormatContext *s, AVFormatParameters *ap)
return AVERROR(ENOSYS);
}
avio_skip(pb, header_size);
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
diff --git a/libavformat/vqf.c b/libavformat/vqf.c
index 1be5931..1530128 100644
--- a/libavformat/vqf.c
+++ b/libavformat/vqf.c
@@ -64,7 +64,7 @@ static void add_metadata(AVFormatContext *s, const char *tag,
static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap)
{
VqfContext *c = s->priv_data;
- AVStream *st = av_new_stream(s, 0);
+ AVStream *st = avformat_new_stream(s, NULL);
int chunk_tag;
int rate_flag = -1;
int header_size;
diff --git a/libavformat/wav.c b/libavformat/wav.c
index bd8c847..b690cc1 100644
--- a/libavformat/wav.c
+++ b/libavformat/wav.c
@@ -280,7 +280,7 @@ static int wav_parse_fmt_tag(AVFormatContext *s, int64_t size, AVStream **st)
int ret;
/* parse fmt header */
- *st = av_new_stream(s, 0);
+ *st = avformat_new_stream(s, NULL);
if (!*st)
return AVERROR(ENOMEM);
@@ -726,7 +726,7 @@ static int w64_read_header(AVFormatContext *s, AVFormatParameters *ap)
return -1;
}
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c
index 8bba572..9190a1a 100644
--- a/libavformat/wc3movie.c
+++ b/libavformat/wc3movie.c
@@ -163,7 +163,7 @@ static int wc3_read_header(AVFormatContext *s,
} while (fourcc_tag != BRCH_TAG);
/* initialize the decoder streams */
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
av_set_pts_info(st, 33, 1, WC3_FRAME_FPS);
@@ -174,7 +174,7 @@ static int wc3_read_header(AVFormatContext *s,
st->codec->width = wc3->width;
st->codec->height = wc3->height;
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
av_set_pts_info(st, 33, 1, WC3_FRAME_FPS);
diff --git a/libavformat/westwood.c b/libavformat/westwood.c
index 6b5fd51..95aba13 100644
--- a/libavformat/westwood.c
+++ b/libavformat/westwood.c
@@ -144,7 +144,7 @@ static int wsaud_read_header(AVFormatContext *s,
wsaud->audio_bits = (((header[10] & 0x2) >> 1) + 1) * 8;
/* initialize the audio decoder stream */
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
av_set_pts_info(st, 33, 1, wsaud->audio_samplerate);
@@ -221,7 +221,7 @@ static int wsvqa_read_header(AVFormatContext *s,
unsigned int chunk_size;
/* initialize the video decoder stream */
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
av_set_pts_info(st, 33, 1, VQA_FRAMERATE);
@@ -247,7 +247,7 @@ static int wsvqa_read_header(AVFormatContext *s,
/* initialize the audio decoder stream for VQA v1 or nonzero samplerate */
if (AV_RL16(&header[24]) || (AV_RL16(&header[0]) == 1 && AV_RL16(&header[2]) == 1)) {
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
av_set_pts_info(st, 33, 1, VQA_FRAMERATE);
diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c
index af0b711..88587c4 100644
--- a/libavformat/wtvdec.c
+++ b/libavformat/wtvdec.c
@@ -414,7 +414,7 @@ static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length)
if (!filesize)
goto done;
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
goto done;
av_dict_set(&st->metadata, "title", description, 0);
@@ -562,9 +562,10 @@ static AVStream * new_stream(AVFormatContext *s, AVStream *st, int sid, int code
WtvStream *wst = av_mallocz(sizeof(WtvStream));
if (!wst)
return NULL;
- st = av_new_stream(s, sid);
+ st = avformat_new_stream(s, NULL);
if (!st)
return NULL;
+ st->id = sid;
st->priv_data = wst;
}
st->codec->codec_type = codec_type;
diff --git a/libavformat/wv.c b/libavformat/wv.c
index e995e51..72c8df0 100644
--- a/libavformat/wv.c
+++ b/libavformat/wv.c
@@ -220,7 +220,7 @@ static int wv_read_header(AVFormatContext *s,
}
/* now we are ready: build format streams */
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return -1;
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
diff --git a/libavformat/xa.c b/libavformat/xa.c
index de94447..dd7811d 100644
--- a/libavformat/xa.c
+++ b/libavformat/xa.c
@@ -70,7 +70,7 @@ static int xa_read_header(AVFormatContext *s,
AVStream *st;
/*Set up the XA Audio Decoder*/
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
diff --git a/libavformat/xmv.c b/libavformat/xmv.c
index 9c17a14..aeafcb6 100644
--- a/libavformat/xmv.c
+++ b/libavformat/xmv.c
@@ -147,7 +147,7 @@ static int xmv_read_header(AVFormatContext *s,
/* Video track */
- vst = av_new_stream(s, 0);
+ vst = avformat_new_stream(s, NULL);
if (!vst)
return AVERROR(ENOMEM);
@@ -202,7 +202,7 @@ static int xmv_read_header(AVFormatContext *s,
av_log(s, AV_LOG_WARNING, "Unsupported 5.1 ADPCM audio stream "
"(0x%04X)\n", packet->flags);
- ast = av_new_stream(s, audio_track);
+ ast = avformat_new_stream(s, NULL);
if (!ast)
return AVERROR(ENOMEM);
diff --git a/libavformat/xwma.c b/libavformat/xwma.c
index 9e100b1..94208ab 100644
--- a/libavformat/xwma.c
+++ b/libavformat/xwma.c
@@ -69,7 +69,7 @@ static int xwma_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (tag != MKTAG('f', 'm', 't', ' '))
return -1;
size = avio_rl32(pb);
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
diff --git a/libavformat/yop.c b/libavformat/yop.c
index 9e548f0..8cadf12 100644
--- a/libavformat/yop.c
+++ b/libavformat/yop.c
@@ -56,8 +56,8 @@ static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap)
int frame_rate, ret;
- audio_stream = av_new_stream(s, 0);
- video_stream = av_new_stream(s, 1);
+ audio_stream = avformat_new_stream(s, NULL);
+ video_stream = avformat_new_stream(s, NULL);
// Extra data that will be passed to the decoder
video_stream->codec->extradata_size = 8;
diff --git a/libavformat/yuv4mpeg.c b/libavformat/yuv4mpeg.c
index a7f55b4..97d2261 100644
--- a/libavformat/yuv4mpeg.c
+++ b/libavformat/yuv4mpeg.c
@@ -333,7 +333,7 @@ static int yuv4_read_header(AVFormatContext *s, AVFormatParameters *ap)
aspectd = 1;
}
- st = av_new_stream(s, 0);
+ st = avformat_new_stream(s, NULL);
if(!st)
return AVERROR(ENOMEM);
st->codec->width = width;
diff --git a/libavutil/opt.h b/libavutil/opt.h
index 9e6aaa9..d10b985 100644
--- a/libavutil/opt.h
+++ b/libavutil/opt.h
@@ -32,6 +32,189 @@
#include "dict.h"
#include "log.h"
+/**
+ * @defgroup avoptions AVOptions
+ * @{
+ * AVOptions provide a generic system to declare options on arbitrary structs
+ * ("objects"). An option can have a help text, a type and a range of possible
+ * values. Options may then be enumerated, read and written to.
+ *
+ * @section avoptions_implement Implementing AVOptions
+ * This section describes how to add AVOptions capabilities to a struct.
+ *
+ * All AVOptions-related information is stored in an AVClass. Therefore
+ * the first member of the struct must be a pointer to an AVClass describing it.
+ * The option field of the AVClass must be set to a NULL-terminated static array
+ * of AVOptions. Each AVOption must have a non-empty name, a type, a default
+ * value and for number-type AVOptions also a range of allowed values. It must
+ * also declare an offset in bytes from the start of the struct, where the field
+ * associated with this AVOption is located. Other fields in the AVOption struct
+ * should also be set when applicable, but are not required.
+ *
+ * The following example illustrates an AVOptions-enabled struct:
+ * @code
+ * typedef struct test_struct {
+ * AVClass *class;
+ * int int_opt;
+ * char *str_opt;
+ * uint8_t *bin_opt;
+ * int bin_len;
+ * } test_struct;
+ *
+ * static const AVOption options[] = {
+ * { "test_int", "This is a test option of int type.", offsetof(test_struct, int_opt),
+ * AV_OPT_TYPE_INT, { -1 }, INT_MIN, INT_MAX },
+ * { "test_str", "This is a test option of string type.", offsetof(test_struct, str_opt),
+ * AV_OPT_TYPE_STRING },
+ * { "test_bin", "This is a test option of binary type.", offsetof(test_struct, bin_opt),
+ * AV_OPT_TYPE_BINARY },
+ * { NULL },
+ * };
+ *
+ * static const AVClass test_class = {
+ * .class_name = "test class",
+ * .item_name = av_default_item_name,
+ * .option = options,
+ * .version = LIBAVUTIL_VERSION_INT,
+ * };
+ * @endcode
+ *
+ * Next, when allocating your struct, you must ensure that the AVClass pointer
+ * is set to the correct value. Then, av_opt_set_defaults() must be called to
+ * initialize defaults. After that the struct is ready to be used with the
+ * AVOptions API.
+ *
+ * When cleaning up, you may use the av_opt_free() function to automatically
+ * free all the allocated string and binary options.
+ *
+ * Continuing with the above example:
+ *
+ * @code
+ * test_struct *alloc_test_struct(void)
+ * {
+ * test_struct *ret = av_malloc(sizeof(*ret));
+ * ret->class = &test_class;
+ * av_opt_set_defaults(ret);
+ * return ret;
+ * }
+ * void free_test_struct(test_struct **foo)
+ * {
+ * av_opt_free(*foo);
+ * av_freep(foo);
+ * }
+ * @endcode
+ *
+ * @subsection avoptions_implement_nesting Nesting
+ * It may happen that an AVOptions-enabled struct contains another
+ * AVOptions-enabled struct as a member (e.g. AVCodecContext in
+ * libavcodec exports generic options, while its priv_data field exports
+ * codec-specific options). In such a case, it is possible to set up the
+ * parent struct to export a child's options. To do that, simply
+ * implement AVClass.child_next() and AVClass.child_class_next() in the
+ * parent struct's AVClass.
+ * Assuming that the test_struct from above now also contains a
+ * child_struct field:
+ *
+ * @code
+ * typedef struct child_struct {
+ * AVClass *class;
+ * int flags_opt;
+ * } child_struct;
+ * static const AVOption child_opts[] = {
+ * { "test_flags", "This is a test option of flags type.",
+ * offsetof(child_struct, flags_opt), AV_OPT_TYPE_FLAGS, { 0 }, INT_MIN, INT_MAX },
+ * { NULL },
+ * };
+ * static const AVClass child_class = {
+ * .class_name = "child class",
+ * .item_name = av_default_item_name,
+ * .option = child_opts,
+ * .version = LIBAVUTIL_VERSION_INT,
+ * };
+ *
+ * void *child_next(void *obj, void *prev)
+ * {
+ * test_struct *t = obj;
+ * if (!prev && t->child_struct)
+ * return t->child_struct;
+ * return NULL
+ * }
+ * const AVClass child_class_next(const AVClass *prev)
+ * {
+ * return prev ? NULL : &child_class;
+ * }
+ * @endcode
+ * Putting child_next() and child_class_next() as defined above into
+ * test_class will now make child_struct's options accessible through
+ * test_struct (again, proper setup as described above needs to be done on
+ * child_struct right after it is created).
+ *
+ * From the above example it might not be clear why both child_next()
+ * and child_class_next() are needed. The distinction is that child_next()
+ * iterates over actually existing objects, while child_class_next()
+ * iterates over all possible child classes. E.g. if an AVCodecContext
+ * was initialized to use a codec which has private options, then its
+ * child_next() will return AVCodecContext.priv_data and finish
+ * iterating. OTOH child_class_next() on AVCodecContext.av_class will
+ * iterate over all available codecs with private options.
+ *
+ * @subsection avoptions_implement_named_constants Named constants
+ * It is possible to create named constants for options. Simply set the unit
+ * field of the option the constants should apply to to a string and
+ * create the constants themselves as options of type AV_OPT_TYPE_CONST
+ * with their unit field set to the same string.
+ * Their default_val field should contain the value of the named
+ * constant.
+ * For example, to add some named constants for the test_flags option
+ * above, put the following into the child_opts array:
+ * @code
+ * { "test_flags", "This is a test option of flags type.",
+ * offsetof(child_struct, flags_opt), AV_OPT_TYPE_FLAGS, { 0 }, INT_MIN, INT_MAX, "test_unit" },
+ * { "flag1", "This is a flag with value 16", 0, AV_OPT_TYPE_CONST, { 16 }, 0, 0, "test_unit" },
+ * @endcode
+ *
+ * @section avoptions_use Using AVOptions
+ * This section deals with accessing options in an AVOptions-enabled struct.
+ * Such structs in Libav are e.g. AVCodecContext in libavcodec or
+ * AVFormatContext in libavformat.
+ *
+ * @subsection avoptions_use_examine Examining AVOptions
+ * The basic functions for examining options are av_opt_next(), which iterates
+ * over all options defined for one object, and av_opt_find(), which searches
+ * for an option with the given name.
+ *
+ * The situation is more complicated with nesting. An AVOptions-enabled struct
+ * may have AVOptions-enabled children. Passing the AV_OPT_SEARCH_CHILDREN flag
+ * to av_opt_find() will make the function search children recursively.
+ *
+ * For enumerating there are basically two cases. The first is when you want to
+ * get all options that may potentially exist on the struct and its children
+ * (e.g. when constructing documentation). In that case you should call
+ * av_opt_child_class_next() recursively on the parent struct's AVClass. The
+ * second case is when you have an already initialized struct with all its
+ * children and you want to get all options that can be actually written or read
+ * from it. In that case you should call av_opt_child_next() recursively (and
+ * av_opt_next() on each result).
+ *
+ * @subsection avoptions_use_get_set Reading and writing AVOptions
+ * When setting options, you often have a string read directly from the
+ * user. In such a case, simply passing it to av_opt_set() is enough. For
+ * non-string type options, av_opt_set() will parse the string according to the
+ * option type.
+ *
+ * Similarly av_opt_get() will read any option type and convert it to a string
+ * which will be returned. Do not forget that the string is allocated, so you
+ * have to free it with av_free().
+ *
+ * In some cases it may be more convenient to put all options into an
+ * AVDictionary and call av_opt_set_dict() on it. A specific case of this
+ * are the format/codec open functions in lavf/lavc which take a dictionary
+ * filled with option as a parameter. This allows to set some options
+ * that cannot be set otherwise, since e.g. the input file format is not known
+ * before the file is actually opened.
+ * @}
+ */
+
enum AVOptionType{
AV_OPT_TYPE_FLAGS,
AV_OPT_TYPE_INT,
diff --git a/ffpresets/libvpx-1080p.avpreset b/presets/libvpx-1080p.ffpreset
index 5c7da6f..5c7da6f 100644
--- a/ffpresets/libvpx-1080p.avpreset
+++ b/presets/libvpx-1080p.ffpreset
diff --git a/ffpresets/libvpx-1080p50_60.avpreset b/presets/libvpx-1080p50_60.ffpreset
index d42f731..d42f731 100644
--- a/ffpresets/libvpx-1080p50_60.avpreset
+++ b/presets/libvpx-1080p50_60.ffpreset
diff --git a/ffpresets/libvpx-360p.avpreset b/presets/libvpx-360p.ffpreset
index 2cb9e38..2cb9e38 100644
--- a/ffpresets/libvpx-360p.avpreset
+++ b/presets/libvpx-360p.ffpreset
diff --git a/ffpresets/libvpx-720p.avpreset b/presets/libvpx-720p.ffpreset
index 3c7e396..3c7e396 100644
--- a/ffpresets/libvpx-720p.avpreset
+++ b/presets/libvpx-720p.ffpreset
diff --git a/ffpresets/libvpx-720p50_60.avpreset b/presets/libvpx-720p50_60.ffpreset
index 6139300..6139300 100644
--- a/ffpresets/libvpx-720p50_60.avpreset
+++ b/presets/libvpx-720p50_60.ffpreset
diff --git a/presets/libx264-baseline.ffpreset b/presets/libx264-baseline.ffpreset
new file mode 100644
index 0000000..0626e28
--- /dev/null
+++ b/presets/libx264-baseline.ffpreset
@@ -0,0 +1 @@
+profile=baseline
diff --git a/presets/libx264-fast.ffpreset b/presets/libx264-fast.ffpreset
new file mode 100644
index 0000000..a8c526e
--- /dev/null
+++ b/presets/libx264-fast.ffpreset
@@ -0,0 +1 @@
+preset=fast
diff --git a/presets/libx264-fast_firstpass.ffpreset b/presets/libx264-fast_firstpass.ffpreset
new file mode 100644
index 0000000..d9cf5af
--- /dev/null
+++ b/presets/libx264-fast_firstpass.ffpreset
@@ -0,0 +1,2 @@
+preset=fast
+fastfirstpass=1
diff --git a/presets/libx264-faster.ffpreset b/presets/libx264-faster.ffpreset
new file mode 100644
index 0000000..e311989
--- /dev/null
+++ b/presets/libx264-faster.ffpreset
@@ -0,0 +1 @@
+preset=faster
diff --git a/presets/libx264-faster_firstpass.ffpreset b/presets/libx264-faster_firstpass.ffpreset
new file mode 100644
index 0000000..48a2d44
--- /dev/null
+++ b/presets/libx264-faster_firstpass.ffpreset
@@ -0,0 +1,2 @@
+preset=faster
+fastfirstpass=1
diff --git a/presets/libx264-ipod320.ffpreset b/presets/libx264-ipod320.ffpreset
new file mode 100644
index 0000000..6323191
--- /dev/null
+++ b/presets/libx264-ipod320.ffpreset
@@ -0,0 +1,4 @@
+profile=baseline
+level=13
+maxrate=768000
+bufsize=3000000
diff --git a/presets/libx264-ipod640.ffpreset b/presets/libx264-ipod640.ffpreset
new file mode 100644
index 0000000..c2c3e1a
--- /dev/null
+++ b/presets/libx264-ipod640.ffpreset
@@ -0,0 +1,4 @@
+profile=baseline
+level=30
+maxrate=10000000
+bufsize=10000000
diff --git a/presets/libx264-lossless_fast.ffpreset b/presets/libx264-lossless_fast.ffpreset
new file mode 100644
index 0000000..1658d56
--- /dev/null
+++ b/presets/libx264-lossless_fast.ffpreset
@@ -0,0 +1,2 @@
+preset=fast
+qp=0
diff --git a/presets/libx264-lossless_max.ffpreset b/presets/libx264-lossless_max.ffpreset
new file mode 100644
index 0000000..c25ff32
--- /dev/null
+++ b/presets/libx264-lossless_max.ffpreset
@@ -0,0 +1,2 @@
+preset=placebo
+qp=0
diff --git a/presets/libx264-lossless_medium.ffpreset b/presets/libx264-lossless_medium.ffpreset
new file mode 100644
index 0000000..f7b1d81
--- /dev/null
+++ b/presets/libx264-lossless_medium.ffpreset
@@ -0,0 +1,2 @@
+preset=medium
+qp=0
diff --git a/presets/libx264-lossless_slow.ffpreset b/presets/libx264-lossless_slow.ffpreset
new file mode 100644
index 0000000..a15ff4c
--- /dev/null
+++ b/presets/libx264-lossless_slow.ffpreset
@@ -0,0 +1,2 @@
+preset=slow
+qp=0
diff --git a/presets/libx264-lossless_slower.ffpreset b/presets/libx264-lossless_slower.ffpreset
new file mode 100644
index 0000000..bd71f03
--- /dev/null
+++ b/presets/libx264-lossless_slower.ffpreset
@@ -0,0 +1,2 @@
+preset=slower
+qp=0
diff --git a/presets/libx264-lossless_ultrafast.ffpreset b/presets/libx264-lossless_ultrafast.ffpreset
new file mode 100644
index 0000000..4d71eb7
--- /dev/null
+++ b/presets/libx264-lossless_ultrafast.ffpreset
@@ -0,0 +1,2 @@
+preset=ultrafast
+qp=0
diff --git a/presets/libx264-main.ffpreset b/presets/libx264-main.ffpreset
new file mode 100644
index 0000000..336c69b
--- /dev/null
+++ b/presets/libx264-main.ffpreset
@@ -0,0 +1 @@
+profile=main
diff --git a/presets/libx264-medium.ffpreset b/presets/libx264-medium.ffpreset
new file mode 100644
index 0000000..261d584
--- /dev/null
+++ b/presets/libx264-medium.ffpreset
@@ -0,0 +1 @@
+preset=medium
diff --git a/presets/libx264-medium_firstpass.ffpreset b/presets/libx264-medium_firstpass.ffpreset
new file mode 100644
index 0000000..06c8f9f
--- /dev/null
+++ b/presets/libx264-medium_firstpass.ffpreset
@@ -0,0 +1,2 @@
+preset=medium
+fastfirstpass=1
diff --git a/presets/libx264-placebo.ffpreset b/presets/libx264-placebo.ffpreset
new file mode 100644
index 0000000..93d721d
--- /dev/null
+++ b/presets/libx264-placebo.ffpreset
@@ -0,0 +1 @@
+preset=placebo
diff --git a/presets/libx264-placebo_firstpass.ffpreset b/presets/libx264-placebo_firstpass.ffpreset
new file mode 100644
index 0000000..c8099e5
--- /dev/null
+++ b/presets/libx264-placebo_firstpass.ffpreset
@@ -0,0 +1,2 @@
+preset=placebo
+fastfirstpass=1
diff --git a/presets/libx264-slow.ffpreset b/presets/libx264-slow.ffpreset
new file mode 100644
index 0000000..85778ec
--- /dev/null
+++ b/presets/libx264-slow.ffpreset
@@ -0,0 +1 @@
+preset=slow
diff --git a/presets/libx264-slow_firstpass.ffpreset b/presets/libx264-slow_firstpass.ffpreset
new file mode 100644
index 0000000..9998bc9
--- /dev/null
+++ b/presets/libx264-slow_firstpass.ffpreset
@@ -0,0 +1,2 @@
+preset=slow
+fastfirstpass=1
diff --git a/presets/libx264-slower.ffpreset b/presets/libx264-slower.ffpreset
new file mode 100644
index 0000000..87d6989
--- /dev/null
+++ b/presets/libx264-slower.ffpreset
@@ -0,0 +1 @@
+preset=slower
diff --git a/presets/libx264-slower_firstpass.ffpreset b/presets/libx264-slower_firstpass.ffpreset
new file mode 100644
index 0000000..c798b82
--- /dev/null
+++ b/presets/libx264-slower_firstpass.ffpreset
@@ -0,0 +1,2 @@
+preset=slower
+fastfirstpass=1
diff --git a/presets/libx264-superfast.ffpreset b/presets/libx264-superfast.ffpreset
new file mode 100644
index 0000000..1c117ec
--- /dev/null
+++ b/presets/libx264-superfast.ffpreset
@@ -0,0 +1 @@
+preset=superfast
diff --git a/presets/libx264-superfast_firstpass.ffpreset b/presets/libx264-superfast_firstpass.ffpreset
new file mode 100644
index 0000000..fc70e09
--- /dev/null
+++ b/presets/libx264-superfast_firstpass.ffpreset
@@ -0,0 +1,2 @@
+preset=superfast
+fastfirstpass=1
diff --git a/presets/libx264-ultrafast.ffpreset b/presets/libx264-ultrafast.ffpreset
new file mode 100644
index 0000000..9103301
--- /dev/null
+++ b/presets/libx264-ultrafast.ffpreset
@@ -0,0 +1 @@
+preset=ultrafast
diff --git a/presets/libx264-ultrafast_firstpass.ffpreset b/presets/libx264-ultrafast_firstpass.ffpreset
new file mode 100644
index 0000000..e3aaa17
--- /dev/null
+++ b/presets/libx264-ultrafast_firstpass.ffpreset
@@ -0,0 +1,2 @@
+preset=ultrafast
+fastfirstpass=1
diff --git a/presets/libx264-veryfast.ffpreset b/presets/libx264-veryfast.ffpreset
new file mode 100644
index 0000000..fa49629
--- /dev/null
+++ b/presets/libx264-veryfast.ffpreset
@@ -0,0 +1 @@
+preset=veryfast
diff --git a/presets/libx264-veryfast_firstpass.ffpreset b/presets/libx264-veryfast_firstpass.ffpreset
new file mode 100644
index 0000000..4909030
--- /dev/null
+++ b/presets/libx264-veryfast_firstpass.ffpreset
@@ -0,0 +1,2 @@
+preset=veryfast
+fastfirstpass=1
diff --git a/presets/libx264-veryslow.ffpreset b/presets/libx264-veryslow.ffpreset
new file mode 100644
index 0000000..7e01c8f
--- /dev/null
+++ b/presets/libx264-veryslow.ffpreset
@@ -0,0 +1 @@
+preset=veryslow
diff --git a/presets/libx264-veryslow_firstpass.ffpreset b/presets/libx264-veryslow_firstpass.ffpreset
new file mode 100644
index 0000000..daf5a8f
--- /dev/null
+++ b/presets/libx264-veryslow_firstpass.ffpreset
@@ -0,0 +1,2 @@
+preset=veryslow
+fastfirstpass=1
OpenPOWER on IntegriCloud