History

Merge remote-tracking branch 'qatar/master'

* qatar/master: presets: rename presets directory lavc: make avcodec_get_context_defaults3 "officially" public lavf: replace av_new_stream->avformat_new_stream part II. lavf,lavd: replace av_new_stream->avformat_new_stream part I. lavf: add avformat_new_stream as a replacement for av_new_stream. Use correct scaling table for bwd-pred MVs in second B-field Ut Video decoder Makefile: change presets extension to .avpreset lavfi: add rgbtestsrc source, ported from MPlayer libmpcodecs lavfi: add testsrc source AVOptions: add documentation. presets: update libx264 ffpresets Conflicts: Changelog doc/APIchanges doc/ffmpeg.texi ffpresets/libx264-ipod320.ffpreset ffpresets/libx264-ipod640.ffpreset ffserver.c libavcodec/avcodec.h libavcodec/options.c libavcodec/version.h libavdevice/libdc1394.c libavfilter/avfilter.h libavfilter/vsrc_testsrc.c libavformat/flvdec.c libavformat/riff.c libavformat/version.h libavformat/wtv.c

Michael Niedermayer committed 15 years ago

Commit d0492572 parents 9ef7143 8096fdf181 files · +1021 −256Browse files

Unified · Split

181 files
  1. Changelog +1 −0
  2. Makefile +1 −1
  3. avconv.c +4 −1
  4. doc/APIchanges +3 −0
  5. doc/avconv.texi +1 −1
  6. doc/examples/muxing.c +1 −1
  7. doc/ffmpeg.texi +1 −1
  8. doc/general.texi +1 −0
  9. ffmpeg.c +4 −1
  10. ffpresets/libx264-ipod320.ffpreset +0 −8
  11. ffpresets/libx264-ipod640.ffpreset +0 −9
  12. ffserver.c +1 −0
  13. libavcodec/Makefile +1 −0
  14. libavcodec/allcodecs.c +1 −0
  15. libavcodec/avcodec.h +15 −2
  16. libavcodec/options.c +25 −23
  17. libavcodec/utvideo.c +460 −0
  18. libavcodec/vc1dec.c +11 −9
  19. libavcodec/version.h +1 −1
  20. libavdevice/alsa-audio-dec.c +1 −1
  21. libavdevice/bktr.c +1 −1
  22. libavdevice/fbdev.c +1 −1
  23. libavdevice/jack_audio.c +1 −1
  24. libavdevice/libcdio.c +1 −1
  25. libavdevice/libdc1394.c +1 −1
  26. libavdevice/oss_audio.c +1 −1
  27. libavdevice/sndio_dec.c +1 −1
  28. libavdevice/v4l.c +1 −1
  29. libavdevice/v4l2.c +1 −1
  30. libavdevice/vfwcap.c +1 −1
  31. libavdevice/x11grab.c +1 −1
  32. libavfilter/avfilter.h +1 −1
  33. libavfilter/vsrc_testsrc.c +7 −7
  34. libavformat/4xm.c +3 −2
  35. libavformat/aacdec.c +1 −1
  36. libavformat/aea.c +1 −1
  37. libavformat/aiffdec.c +1 −1
  38. libavformat/amr.c +1 −1
  39. libavformat/anm.c +1 −1
  40. libavformat/apc.c +1 −1
  41. libavformat/ape.c +1 −1
  42. libavformat/applehttp.c +2 −1
  43. libavformat/asfdec.c +1 −1
  44. libavformat/assdec.c +1 −1
  45. libavformat/au.c +1 −1
  46. libavformat/avformat.h +21 −0
  47. libavformat/avidec.c +2 −1
  48. libavformat/avisynth.c +4 −2
  49. libavformat/avs.c +2 −2
  50. libavformat/bethsoftvid.c +2 −2
  51. libavformat/bfi.c +2 −2
  52. libavformat/bink.c +2 −2
  53. libavformat/c93.c +2 −2
  54. libavformat/cafdec.c +1 −1
  55. libavformat/cdg.c +1 −1
  56. libavformat/daud.c +1 −1
  57. libavformat/dfa.c +1 −1
  58. libavformat/dsicin.c +2 −2
  59. libavformat/dv.c +2 −2
  60. libavformat/dxa.c +2 −2
  61. libavformat/eacdata.c +1 −1
  62. libavformat/electronicarts.c +2 −2
  63. libavformat/ffmdec.c +1 −1
  64. libavformat/ffmetadec.c +1 −1
  65. libavformat/filmstripdec.c +1 −1
  66. libavformat/flacdec.c +1 −1
  67. libavformat/flic.c +2 −2
  68. libavformat/flvdec.c +2 −1
  69. libavformat/gxf.c +2 −1
  70. libavformat/idcin.c +2 −2
  71. libavformat/idroqdec.c +2 −2
  72. libavformat/iff.c +1 −1
  73. libavformat/img2.c +1 −1
  74. libavformat/ipmovie.c +2 −2
  75. libavformat/iss.c +1 −1
  76. libavformat/iv8.c +1 −1
  77. libavformat/ivfdec.c +1 −1
  78. libavformat/jvdec.c +2 −2
  79. libavformat/libnut.c +1 −1
  80. libavformat/lmlm4.c +2 −2
  81. libavformat/lxfdec.c +2 −2
  82. libavformat/matroskadec.c +2 −2
  83. libavformat/mm.c +2 −2
  84. libavformat/mmf.c +1 −1
  85. libavformat/mov.c +2 −1
  86. libavformat/mp3dec.c +1 −1
  87. libavformat/mpc.c +1 −1
  88. libavformat/mpc8.c +1 −1
  89. libavformat/mpeg.c +2 −1
  90. libavformat/mpegts.c +13 −7
  91. libavformat/msnwc_tcp.c +1 −1
  92. libavformat/mtv.c +4 −6
  93. libavformat/mvi.c +2 −2
  94. libavformat/mxfdec.c +2 −1
  95. libavformat/mxg.c +4 −6
  96. libavformat/ncdec.c +1 −1
  97. libavformat/nsvdec.c +4 −2
  98. libavformat/nutdec.c +1 −1
  99. libavformat/nuv.c +2 −2
  100. libavformat/oggdec.c +2 −1
  101. libavformat/oma.c +1 −1
  102. libavformat/psxstr.c +2 −2
  103. libavformat/pva.c +2 −2
  104. libavformat/qcp.c +1 −1
  105. libavformat/r3d.c +2 −2
  106. libavformat/rawdec.c +3 −3
  107. libavformat/rdt.c +2 −1
  108. libavformat/riff.c +2 −2
  109. libavformat/rl2.c +2 −2
  110. libavformat/rmdec.c +2 −2
  111. libavformat/rpl.c +2 −2
  112. libavformat/rsodec.c +1 −1
  113. libavformat/rtpenc_chain.c +1 −1
  114. libavformat/rtsp.c +2 −1
  115. libavformat/sapdec.c +4 −2
  116. libavformat/segafilm.c +2 −2
  117. libavformat/sierravmd.c +2 −2
  118. libavformat/siff.c +2 −2
  119. libavformat/smacker.c +2 −2
  120. libavformat/sol.c +1 −1
  121. libavformat/soxdec.c +1 −1
  122. libavformat/spdifdec.c +1 −1
  123. libavformat/srtdec.c +1 −1
  124. libavformat/swfdec.c +6 −3
  125. libavformat/thp.c +2 −2
  126. libavformat/tiertexseq.c +2 −2
  127. libavformat/tmv.c +2 −2
  128. libavformat/tta.c +1 −1
  129. libavformat/tty.c +1 −1
  130. libavformat/txd.c +1 −1
  131. libavformat/utils.c +11 −2
  132. libavformat/vc1test.c +1 −1
  133. libavformat/version.h +5 −2
  134. libavformat/vocdec.c +1 −1
  135. libavformat/vqf.c +1 −1
  136. libavformat/wav.c +2 −2
  137. libavformat/wc3movie.c +2 −2
  138. libavformat/westwood.c +3 −3
  139. libavformat/wtvdec.c +3 −2
  140. libavformat/wv.c +1 −1
  141. libavformat/xa.c +1 −1
  142. libavformat/xmv.c +2 −2
  143. libavformat/xwma.c +1 −1
  144. libavformat/yop.c +2 −2
  145. libavformat/yuv4mpeg.c +1 −1
  146. libavutil/opt.h +183 −0
  147. presets/libvpx-1080p.ffpreset +0 −0
  148. presets/libvpx-1080p50_60.ffpreset +0 −0
  149. presets/libvpx-360p.ffpreset +0 −0
  150. presets/libvpx-720p.ffpreset +0 −0
  151. presets/libvpx-720p50_60.ffpreset +0 −0
  152. presets/libx264-baseline.ffpreset +1 −0
  153. presets/libx264-fast.ffpreset +1 −0
  154. presets/libx264-fast_firstpass.ffpreset +2 −0
  155. presets/libx264-faster.ffpreset +1 −0
  156. presets/libx264-faster_firstpass.ffpreset +2 −0
  157. presets/libx264-ipod320.ffpreset +4 −0
  158. presets/libx264-ipod640.ffpreset +4 −0
  159. presets/libx264-lossless_fast.ffpreset +2 −0
  160. presets/libx264-lossless_max.ffpreset +2 −0
  161. presets/libx264-lossless_medium.ffpreset +2 −0
  162. presets/libx264-lossless_slow.ffpreset +2 −0
  163. presets/libx264-lossless_slower.ffpreset +2 −0
  164. presets/libx264-lossless_ultrafast.ffpreset +2 −0
  165. presets/libx264-main.ffpreset +1 −0
  166. presets/libx264-medium.ffpreset +1 −0
  167. presets/libx264-medium_firstpass.ffpreset +2 −0
  168. presets/libx264-placebo.ffpreset +1 −0
  169. presets/libx264-placebo_firstpass.ffpreset +2 −0
  170. presets/libx264-slow.ffpreset +1 −0
  171. presets/libx264-slow_firstpass.ffpreset +2 −0
  172. presets/libx264-slower.ffpreset +1 −0
  173. presets/libx264-slower_firstpass.ffpreset +2 −0
  174. presets/libx264-superfast.ffpreset +1 −0
  175. presets/libx264-superfast_firstpass.ffpreset +2 −0
  176. presets/libx264-ultrafast.ffpreset +1 −0
  177. presets/libx264-ultrafast_firstpass.ffpreset +2 −0
  178. presets/libx264-veryfast.ffpreset +1 −0
  179. presets/libx264-veryfast_firstpass.ffpreset +2 −0
  180. presets/libx264-veryslow.ffpreset +1 −0
  181. presets/libx264-veryslow_firstpass.ffpreset +2 −0
Changelog+1−0
@@ -65,6 +65,7 @@ easier to use. The changes are: · 64 unmodified lines
65- VC-1 interlaced decoding65- VC-1 interlaced decoding
66- libutvideo wrapper (--enable-libutvideo)66- libutvideo wrapper (--enable-libutvideo)
67- aevalsrc audio source added67- aevalsrc audio source added
68- Ut Video decoder
68 69
69 70
70version 0.8:71version 0.8:
Makefile+1−1
@@ -38,7 +38,7 @@ FFLIBS-$(CONFIG_SWSCALE) += swscale · 37 unmodified lines
38 38
39FFLIBS := avutil39FFLIBS := avutil
40 40
41DATA_FILES := $(wildcard $(SRC_PATH)/ffpresets/*.ffpreset)41DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.ffpreset)
42 42
43SKIPHEADERS = cmdutils_common_opts.h43SKIPHEADERS = cmdutils_common_opts.h
44 44
avconv.c+4−1
@@ -3137,7 +3137,7 @@ static int get_preset_file_2(const char *preset_name, const char *codec_name, AV · 3136 unmodified lines
3137static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type)3137static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type)
3138{3138{
3139 OutputStream *ost;3139 OutputStream *ost;
3140 AVStream *st = av_new_stream(oc, oc->nb_streams < o->nb_streamid_map ? o->streamid_map[oc->nb_streams] : 0);3140 AVStream *st = avformat_new_stream(oc, NULL);
3141 int idx = oc->nb_streams - 1, ret = 0;3141 int idx = oc->nb_streams - 1, ret = 0;
3142 int64_t max_frames = INT64_MAX;3142 int64_t max_frames = INT64_MAX;
3143 char *bsf = NULL, *next, *codec_tag = NULL;3143 char *bsf = NULL, *next, *codec_tag = NULL;
@@ -3151,6 +3151,9 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e · 7 unmodified lines
3151 exit_program(1);3151 exit_program(1);
3152 }3152 }
3153 3153
3154 if (oc->nb_streams - 1 < o->nb_streamid_map)
3155 st->id = o->streamid_map[oc->nb_streams - 1];
3156
3154 output_streams = grow_array(output_streams, sizeof(*output_streams), &nb_output_streams,3157 output_streams = grow_array(output_streams, sizeof(*output_streams), &nb_output_streams,
3155 nb_output_streams + 1);3158 nb_output_streams + 1);
3156 ost = &output_streams[nb_output_streams - 1];3159 ost = &output_streams[nb_output_streams - 1];
doc/APIchanges+3−0
@@ -16,6 +16,9 @@ API changes, most recent first: · 15 unmodified lines
162011-10-20 - b35e9e1 - lavu 51.22.0162011-10-20 - b35e9e1 - lavu 51.22.0
17 Add av_strtok() to avstring.h.17 Add av_strtok() to avstring.h.
18 18
192011-10-xx - xxxxxxx - lavf 53.10.0
20 Add avformat_new_stream(). Deprecate av_new_stream().
21
192011-xx-xx - xxxxxxx - lavf 53.9.0222011-xx-xx - xxxxxxx - lavf 53.9.0
20 Add AVFMT_NO_BYTE_SEEK AVInputFormat flag.23 Add AVFMT_NO_BYTE_SEEK AVInputFormat flag.
21 24
doc/avconv.texi+1−1
@@ -778,7 +778,7 @@ A preset file contains a sequence of @var{option=value} pairs, one for · 777 unmodified lines
778each line, specifying a sequence of options which can be specified also on778each line, specifying a sequence of options which can be specified also on
779the command line. Lines starting with the hash ('#') character are ignored and779the command line. Lines starting with the hash ('#') character are ignored and
780are used to provide comments. Empty lines are also ignored. Check the780are used to provide comments. Empty lines are also ignored. Check the
781@file{ffpresets} directory in the Libav source tree for examples.781@file{presets} directory in the Libav source tree for examples.
782 782
783Preset files are specified with the @code{pre} option, this option takes a783Preset files are specified with the @code{pre} option, this option takes a
784preset name as input. Avconv searches for a file named @var{preset_name}.avpreset in784preset name as input. Avconv searches for a file named @var{preset_name}.avpreset in
doc/examples/muxing.c+1−1
@@ -199,7 +199,7 @@ static AVStream *add_video_stream(AVFormatContext *oc, enum CodecID codec_id) · 198 unmodified lines
199 AVCodecContext *c;199 AVCodecContext *c;
200 AVStream *st;200 AVStream *st;
201 201
202 st = av_new_stream(oc, 0);202 st = avformat_new_stream(oc, NULL);
203 if (!st) {203 if (!st) {
204 fprintf(stderr, "Could not alloc stream\n");204 fprintf(stderr, "Could not alloc stream\n");
205 exit(1);205 exit(1);
doc/ffmpeg.texi+1−1
@@ -873,7 +873,7 @@ A preset file contains a sequence of @var{option}=@var{value} pairs, · 872 unmodified lines
873one for each line, specifying a sequence of options which would be873one for each line, specifying a sequence of options which would be
874awkward to specify on the command line. Lines starting with the hash874awkward to specify on the command line. Lines starting with the hash
875('#') character are ignored and are used to provide comments. Check875('#') character are ignored and are used to provide comments. Check
876the @file{ffpresets} directory in the FFmpeg source tree for examples.876the @file{presets} directory in the FFmpeg source tree for examples.
877 877
878Preset files are specified with the @code{vpre}, @code{apre},878Preset files are specified with the @code{vpre}, @code{apre},
879@code{spre}, and @code{fpre} options. The @code{fpre} option takes the879@code{spre}, and @code{fpre} options. The @code{fpre} option takes the
doc/general.texi+1−0
@@ -527,6 +527,7 @@ following image formats are supported: · 526 unmodified lines
527 @tab encoding supported through external library libtheora527 @tab encoding supported through external library libtheora
528@item Tiertex Limited SEQ video @tab @tab X528@item Tiertex Limited SEQ video @tab @tab X
529 @tab Codec used in DOS CD-ROM FlashBack game.529 @tab Codec used in DOS CD-ROM FlashBack game.
530@item Ut Video @tab @tab X
530@item V210 Quicktime Uncompressed 4:2:2 10-bit @tab X @tab X531@item V210 Quicktime Uncompressed 4:2:2 10-bit @tab X @tab X
531@item VMware Screen Codec / VMware Video @tab @tab X532@item VMware Screen Codec / VMware Video @tab @tab X
532 @tab Codec used in videos captured by VMware.533 @tab Codec used in videos captured by VMware.
ffmpeg.c+4−1
@@ -3252,7 +3252,7 @@ static int get_preset_file_2(const char *preset_name, const char *codec_name, AV · 3251 unmodified lines
3252static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type)3252static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type)
3253{3253{
3254 OutputStream *ost;3254 OutputStream *ost;
3255 AVStream *st = av_new_stream(oc, oc->nb_streams < o->nb_streamid_map ? o->streamid_map[oc->nb_streams] : 0);3255 AVStream *st = avformat_new_stream(oc, NULL);
3256 int idx = oc->nb_streams - 1, ret = 0;3256 int idx = oc->nb_streams - 1, ret = 0;
3257 int64_t max_frames = INT64_MAX;3257 int64_t max_frames = INT64_MAX;
3258 char *bsf = NULL, *next, *codec_tag = NULL;3258 char *bsf = NULL, *next, *codec_tag = NULL;
@@ -3266,6 +3266,9 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e · 7 unmodified lines
3266 exit_program(1);3266 exit_program(1);
3267 }3267 }
3268 3268
3269 if (oc->nb_streams - 1 < o->nb_streamid_map)
3270 st->id = o->streamid_map[oc->nb_streams - 1];
3271
3269 output_streams = grow_array(output_streams, sizeof(*output_streams), &nb_output_streams,3272 output_streams = grow_array(output_streams, sizeof(*output_streams), &nb_output_streams,
3270 nb_output_streams + 1);3273 nb_output_streams + 1);
3271 ost = &output_streams[nb_output_streams - 1];3274 ost = &output_streams[nb_output_streams - 1];
ffpresets/libx264-ipod320.ffpreset+0−8
@@ -1,8 +0,0 @@
1coder=0
2bf=0
3weightb=0
48x8dct=0
5level=13
6maxrate=768000
7bufsize=3000000
8weightp=0
ffpresets/libx264-ipod640.ffpreset+0−9
@@ -1,9 +0,0 @@
1coder=0
2bf=0
3refs=1
4weightb=0
58x8dct=0
6level=30
7maxrate=10000000
8bufsize=10000000
9weightp=0
ffserver.c+1−0
@@ -4236,6 +4236,7 @@ static int parse_ffconfig(const char *filename) · 4235 unmodified lines
4236 stream->fmt = ffserver_guess_format(NULL, stream->filename, NULL);4236 stream->fmt = ffserver_guess_format(NULL, stream->filename, NULL);
4237 avcodec_get_context_defaults2(&video_enc, AVMEDIA_TYPE_VIDEO);4237 avcodec_get_context_defaults2(&video_enc, AVMEDIA_TYPE_VIDEO);
4238 avcodec_get_context_defaults2(&audio_enc, AVMEDIA_TYPE_AUDIO);4238 avcodec_get_context_defaults2(&audio_enc, AVMEDIA_TYPE_AUDIO);
4239
4239 audio_id = CODEC_ID_NONE;4240 audio_id = CODEC_ID_NONE;
4240 video_id = CODEC_ID_NONE;4241 video_id = CODEC_ID_NONE;
4241 if (stream->fmt) {4242 if (stream->fmt) {
libavcodec/Makefile+1−0
@@ -401,6 +401,7 @@ OBJS-$(CONFIG_TTA_DECODER) += tta.o · 400 unmodified lines
401OBJS-$(CONFIG_TWINVQ_DECODER) += twinvq.o celp_math.o401OBJS-$(CONFIG_TWINVQ_DECODER) += twinvq.o celp_math.o
402OBJS-$(CONFIG_TXD_DECODER) += txd.o s3tc.o402OBJS-$(CONFIG_TXD_DECODER) += txd.o s3tc.o
403OBJS-$(CONFIG_ULTI_DECODER) += ulti.o403OBJS-$(CONFIG_ULTI_DECODER) += ulti.o
404OBJS-$(CONFIG_UTVIDEO_DECODER) += utvideo.o
404OBJS-$(CONFIG_V210_DECODER) += v210dec.o405OBJS-$(CONFIG_V210_DECODER) += v210dec.o
405OBJS-$(CONFIG_V210_ENCODER) += v210enc.o406OBJS-$(CONFIG_V210_ENCODER) += v210enc.o
406OBJS-$(CONFIG_V210X_DECODER) += v210x.o407OBJS-$(CONFIG_V210X_DECODER) += v210x.o
libavcodec/allcodecs.c+1−0
@@ -208,6 +208,7 @@ void avcodec_register_all(void) · 207 unmodified lines
208 REGISTER_DECODER (TSCC, tscc);208 REGISTER_DECODER (TSCC, tscc);
209 REGISTER_DECODER (TXD, txd);209 REGISTER_DECODER (TXD, txd);
210 REGISTER_DECODER (ULTI, ulti);210 REGISTER_DECODER (ULTI, ulti);
211 REGISTER_DECODER (UTVIDEO, utvideo);
211 REGISTER_ENCDEC (V210, v210);212 REGISTER_ENCDEC (V210, v210);
212 REGISTER_DECODER (V210X, v210x);213 REGISTER_DECODER (V210X, v210x);
213 REGISTER_DECODER (VB, vb);214 REGISTER_DECODER (VB, vb);
libavcodec/avcodec.h+15−2
@@ -212,6 +212,7 @@ enum CodecID { · 211 unmodified lines
212 CODEC_ID_VC1IMAGE,212 CODEC_ID_VC1IMAGE,
213 CODEC_ID_8SVX_RAW,213 CODEC_ID_8SVX_RAW,
214 CODEC_ID_G2M,214 CODEC_ID_G2M,
215 CODEC_ID_UTVIDEO_DEPRECATED,
215 CODEC_ID_UTVIDEO = 0x800,216 CODEC_ID_UTVIDEO = 0x800,
216 217
217 /* various PCM "codecs" */218 /* various PCM "codecs" */
@@ -3707,19 +3708,31 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode); · 3489 unmodified lines
3707 */3708 */
3708const char *av_get_profile_name(const AVCodec *codec, int profile);3709const char *av_get_profile_name(const AVCodec *codec, int profile);
3709 3710
3711#if FF_API_ALLOC_CONTEXT
3710/**3712/**
3711 * Set the fields of the given AVCodecContext to default values.3713 * Set the fields of the given AVCodecContext to default values.
3712 *3714 *
3713 * @param s The AVCodecContext of which the fields should be set to default values.3715 * @param s The AVCodecContext of which the fields should be set to default values.
3716 * @deprecated use avcodec_get_context_defaults3
3714 */3717 */
3718attribute_deprecated
3715void avcodec_get_context_defaults(AVCodecContext *s);3719void avcodec_get_context_defaults(AVCodecContext *s);
3716 3720
3717/** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API!3721/** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API!
3718 * we WILL change its arguments and name a few times! */3722 * we WILL change its arguments and name a few times! */
3723attribute_deprecated
3719void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType);3724void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType);
3725#endif
3720 3726
3721/** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API!3727/**
3722 * we WILL change its arguments and name a few times! */3728 * Set the fields of the given AVCodecContext to default values corresponding
3729 * to the given codec (defaults may be codec-dependent).
3730 *
3731 * Do not call this function if a non-NULL codec has been passed
3732 * to avcodec_alloc_context3() that allocated this AVCodecContext.
3733 * If codec is non-NULL, it is illegal to call avcodec_open2() with a
3734 * different codec on this AVCodecContext.
3735 */
3723int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec);3736int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec);
3724 3737
3725#if FF_API_ALLOC_CONTEXT3738#if FF_API_ALLOC_CONTEXT
libavcodec/options.c+25−23
@@ -532,37 +532,41 @@ static const AVClass av_codec_context_class = { · 531 unmodified lines
532 .child_class_next = codec_child_class_next,532 .child_class_next = codec_child_class_next,
533};533};
534 534
535#if FF_API_ALLOC_CONTEXT
535void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType codec_type){536void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType codec_type){
537 AVCodec c= {0};
538 c.type= codec_type;
539 avcodec_get_context_defaults3(s, &c);
540}
541#endif
542
543int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec){
536 int flags=0;544 int flags=0;
537 memset(s, 0, sizeof(AVCodecContext));545 memset(s, 0, sizeof(AVCodecContext));
538 546
539 s->av_class= &av_codec_context_class;547 s->av_class = &av_codec_context_class;
540 548
541 s->codec_type = codec_type;549 s->codec_type = codec ? codec->type : AVMEDIA_TYPE_UNKNOWN;
542 if(codec_type == AVMEDIA_TYPE_AUDIO)550 if(s->codec_type == AVMEDIA_TYPE_AUDIO)
543 flags= AV_OPT_FLAG_AUDIO_PARAM;551 flags= AV_OPT_FLAG_AUDIO_PARAM;
544 else if(codec_type == AVMEDIA_TYPE_VIDEO)552 else if(s->codec_type == AVMEDIA_TYPE_VIDEO)
545 flags= AV_OPT_FLAG_VIDEO_PARAM;553 flags= AV_OPT_FLAG_VIDEO_PARAM;
546 else if(codec_type == AVMEDIA_TYPE_SUBTITLE)554 else if(s->codec_type == AVMEDIA_TYPE_SUBTITLE)
547 flags= AV_OPT_FLAG_SUBTITLE_PARAM;555 flags= AV_OPT_FLAG_SUBTITLE_PARAM;
548 av_opt_set_defaults2(s, flags, flags);556 av_opt_set_defaults2(s, flags, flags);
549 557
550 s->time_base= (AVRational){0,1};558 s->time_base = (AVRational){0,1};
551 s->get_buffer= avcodec_default_get_buffer;559 s->get_buffer = avcodec_default_get_buffer;
552 s->release_buffer= avcodec_default_release_buffer;560 s->release_buffer = avcodec_default_release_buffer;
553 s->get_format= avcodec_default_get_format;561 s->get_format = avcodec_default_get_format;
554 s->execute= avcodec_default_execute;562 s->execute = avcodec_default_execute;
555 s->execute2= avcodec_default_execute2;563 s->execute2 = avcodec_default_execute2;
556 s->sample_aspect_ratio= (AVRational){0,1};564 s->sample_aspect_ratio = (AVRational){0,1};
557 s->pix_fmt= PIX_FMT_NONE;565 s->pix_fmt = PIX_FMT_NONE;
558 s->sample_fmt= AV_SAMPLE_FMT_NONE;566 s->sample_fmt = AV_SAMPLE_FMT_NONE;
559 567
560 s->reget_buffer= avcodec_default_reget_buffer;568 s->reget_buffer = avcodec_default_reget_buffer;
561 s->reordered_opaque= AV_NOPTS_VALUE;569 s->reordered_opaque = AV_NOPTS_VALUE;
562}
563
564int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec){
565 avcodec_get_context_defaults2(s, codec ? codec->type : AVMEDIA_TYPE_UNKNOWN);
566 if(codec && codec->priv_data_size){570 if(codec && codec->priv_data_size){
567 if(!s->priv_data){571 if(!s->priv_data){
568 s->priv_data= av_mallocz(codec->priv_data_size);572 s->priv_data= av_mallocz(codec->priv_data_size);
@@ -610,13 +614,11 @@ AVCodecContext *avcodec_alloc_context2(enum AVMediaType codec_type){ · 41 unmodified lines
610 614
611 return avctx;615 return avctx;
612}616}
613#endif
614 617
615void avcodec_get_context_defaults(AVCodecContext *s){618void avcodec_get_context_defaults(AVCodecContext *s){
616 avcodec_get_context_defaults2(s, AVMEDIA_TYPE_UNKNOWN);619 avcodec_get_context_defaults2(s, AVMEDIA_TYPE_UNKNOWN);
617}620}
618 621
619#if FF_API_ALLOC_CONTEXT
620AVCodecContext *avcodec_alloc_context(void){622AVCodecContext *avcodec_alloc_context(void){
621 return avcodec_alloc_context2(AVMEDIA_TYPE_UNKNOWN);623 return avcodec_alloc_context2(AVMEDIA_TYPE_UNKNOWN);
622}624}
libavcodec/utvideo.c+460−0
@@ -0,0 +1,460 @@
1/*
2 * Ut Video decoder
3 * Copyright (c) 2011 Konstantin Shishkov
4 *
5 * This file is part of Libav.
6 *
7 * Libav is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * Libav is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with Libav; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22/**
23 * @file
24 * Ut Video decoder
25 */
26
27#include <stdlib.h>
28
29#include "libavutil/intreadwrite.h"
30#include "avcodec.h"
31#include "bytestream.h"
32#include "get_bits.h"
33#include "dsputil.h"
34
35enum {
36 PRED_NONE = 0,
37 PRED_LEFT,
38 PRED_GRADIENT,
39 PRED_MEDIAN,
40};
41
42typedef struct UtvideoContext {
43 AVCodecContext *avctx;
44 AVFrame pic;
45 DSPContext dsp;
46
47 uint32_t frame_info_size, flags, frame_info;
48 int planes;
49 int slices;
50 int compression;
51 int interlaced;
52 int frame_pred;
53
54 uint8_t *slice_bits;
55 int slice_bits_size;
56} UtvideoContext;
57
58typedef struct HuffEntry {
59 uint8_t sym;
60 uint8_t len;
61} HuffEntry;
62
63static int huff_cmp(const void *a, const void *b)
64{
65 const HuffEntry *aa = a, *bb = b;
66 return (aa->len - bb->len)*256 + aa->sym - bb->sym;
67}
68
69static int build_huff(const uint8_t *src, VLC *vlc)
70{
71 int i;
72 HuffEntry he[256];
73 int last;
74 uint32_t codes[256];
75 uint8_t bits[256];
76 uint8_t syms[256];
77 uint32_t code;
78
79 for (i = 0; i < 256; i++) {
80 he[i].sym = i;
81 he[i].len = *src++;
82 }
83 qsort(he, 256, sizeof(*he), huff_cmp);
84
85 if (!he[0].len || he[0].len > 32)
86 return -1;
87
88 last = 255;
89 while (he[last].len == 255 && last)
90 last--;
91
92 code = 1;
93 for (i = last; i >= 0; i--) {
94 codes[i] = code >> (32 - he[i].len);
95 bits[i] = he[i].len;
96 syms[i] = he[i].sym;
97 code += 0x80000000u >> (he[i].len - 1);
98 }
99
100 return init_vlc_sparse(vlc, FFMIN(he[last].len, 9), last + 1,
101 bits, sizeof(*bits), sizeof(*bits),
102 codes, sizeof(*codes), sizeof(*codes),
103 syms, sizeof(*syms), sizeof(*syms), 0);
104}
105
106static int decode_plane(UtvideoContext *c, int plane_no,
107 uint8_t *dst, int step, int stride,
108 int width, int height,
109 const uint8_t *src, int src_size, int use_pred)
110{
111 int i, j, slice, pix;
112 int sstart, send;
113 VLC vlc;
114 GetBitContext gb;
115 int prev;
116
117 if (build_huff(src, &vlc)) {
118 av_log(c->avctx, AV_LOG_ERROR, "Cannot build Huffman codes\n");
119 return AVERROR_INVALIDDATA;
120 }
121
122 src += 256;
123 src_size -= 256;
124
125 send = 0;
126 for (slice = 0; slice < c->slices; slice++) {
127 uint8_t *dest;
128 int slice_data_start, slice_data_end, slice_size;
129
130 sstart = send;
131 send = height * (slice + 1) / c->slices;
132 dest = dst + sstart * stride;
133
134 // slice offset and size validation was done earlier
135 slice_data_start = slice ? AV_RL32(src + slice * 4 - 4) : 0;
136 slice_data_end = AV_RL32(src + slice * 4);
137 slice_size = slice_data_end - slice_data_start;
138
139 if (!slice_size) {
140 for (j = sstart; j < send; j++) {
141 for (i = 0; i < width * step; i += step)
142 dest[i] = 0x80;
143 dest += stride;
144 }
145 continue;
146 }
147
148 memcpy(c->slice_bits, src + slice_data_start + c->slices * 4, slice_size);
149 memset(c->slice_bits + slice_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
150 c->dsp.bswap_buf((uint32_t*)c->slice_bits, (uint32_t*)c->slice_bits,
151 (slice_data_end - slice_data_start + 3) >> 2);
152 init_get_bits(&gb, c->slice_bits, slice_size * 8);
153
154 prev = 0x80;
155 for (j = sstart; j < send; j++) {
156 for (i = 0; i < width * step; i += step) {
157 if (get_bits_left(&gb) <= 0) {
158 av_log(c->avctx, AV_LOG_ERROR, "Slice decoding ran out of bits\n");
159 goto fail;
160 }
161 pix = get_vlc2(&gb, vlc.table, vlc.bits, 4);
162 if (pix < 0) {
163 av_log(c->avctx, AV_LOG_ERROR, "Decoding error\n");
164 goto fail;
165 }
166 if (use_pred) {
167 prev += pix;
168 pix = prev;
169 }
170 dest[i] = pix;
171 }
172 dest += stride;
173 }
174 if (get_bits_left(&gb) > 32)
175 av_log(c->avctx, AV_LOG_WARNING, "%d bits left after decoding slice\n",
176 get_bits_left(&gb));
177 }
178
179 free_vlc(&vlc);
180
181 return 0;
182fail:
183 free_vlc(&vlc);
184 return AVERROR_INVALIDDATA;
185}
186
187static const int rgb_order[4] = { 1, 2, 0, 3 };
188
189static void restore_rgb_planes(uint8_t *src, int step, int stride, int width, int height)
190{
191 int i, j;
192 uint8_t r, g, b;
193
194 for (j = 0; j < height; j++) {
195 for (i = 0; i < width * step; i += step) {
196 r = src[i];
197 g = src[i + 1];
198 b = src[i + 2];
199 src[i] = r + g - 0x80;
200 src[i + 2] = b + g - 0x80;
201 }
202 src += stride;
203 }
204}
205
206static void restore_median(uint8_t *src, int step, int stride,
207 int width, int height, int slices)
208{
209 int i, j, slice;
210 int A, B, C;
211 uint8_t *bsrc;
212 int slice_start, slice_height;
213
214 for (slice = 0; slice < slices; slice++) {
215 slice_start = (slice * height) / slices;
216 slice_height = ((slice + 1) * height) / slices - slice_start;
217
218 bsrc = src + slice_start * stride;
219
220 // first line - left neighbour prediction
221 bsrc[0] += 0x80;
222 A = bsrc[0];
223 for (i = step; i < width * step; i += step) {
224 bsrc[i] += A;
225 A = bsrc[i];
226 }
227 bsrc += stride;
228 if (slice_height == 1)
229 continue;
230 // second line - first element has top predition, the rest uses median
231 C = bsrc[-stride];
232 bsrc[0] += C;
233 A = bsrc[0];
234 for (i = step; i < width * step; i += step) {
235 B = bsrc[i - stride];
236 bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C));
237 C = B;
238 A = bsrc[i];
239 }
240 bsrc += stride;
241 // the rest of lines use continuous median prediction
242 for (j = 2; j < slice_height; j++) {
243 for (i = 0; i < width * step; i += step) {
244 B = bsrc[i - stride];
245 bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C));
246 C = B;
247 A = bsrc[i];
248 }
249 bsrc += stride;
250 }
251 }
252}
253
254static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
255{
256 const uint8_t *buf = avpkt->data;
257 int buf_size = avpkt->size;
258 const uint8_t *buf_end = buf + buf_size;
259 UtvideoContext *c = avctx->priv_data;
260 const uint8_t *ptr;
261 int i, j;
262 const uint8_t *plane_start[5];
263 int plane_size, max_slice_size = 0, slice_start, slice_end, slice_size;
264 int ret;
265
266 if (c->pic.data[0])
267 avctx->release_buffer(avctx, &c->pic);
268
269 c->pic.reference = 1;
270 c->pic.buffer_hints = FF_BUFFER_HINTS_VALID;
271 if ((ret = avctx->get_buffer(avctx, &c->pic)) < 0) {
272 av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
273 return ret;
274 }
275
276 /* parse plane structure to retrieve frame flags and validate slice offsets */
277 ptr = buf;
278 for (i = 0; i < c->planes; i++) {
279 plane_start[i] = ptr;
280 if (buf_end - ptr < 256 + 4 * c->slices) {
281 av_log(avctx, AV_LOG_ERROR, "Insufficient data for a plane\n");
282 return AVERROR_INVALIDDATA;
283 }
284 ptr += 256;
285 slice_start = 0;
286 slice_end = 0;
287 for (j = 0; j < c->slices; j++) {
288 slice_end = bytestream_get_le32(&ptr);
289 slice_size = slice_end - slice_start;
290 if (slice_size < 0) {
291 av_log(avctx, AV_LOG_ERROR, "Incorrect slice size\n");
292 return AVERROR_INVALIDDATA;
293 }
294 slice_start = slice_end;
295 max_slice_size = FFMAX(max_slice_size, slice_size);
296 }
297 plane_size = slice_end;
298 if (buf_end - ptr < plane_size) {
299 av_log(avctx, AV_LOG_ERROR, "Plane size is bigger than available data\n");
300 return AVERROR_INVALIDDATA;
301 }
302 ptr += plane_size;
303 }
304 plane_start[c->planes] = ptr;
305 if (buf_end - ptr < c->frame_info_size) {
306 av_log(avctx, AV_LOG_ERROR, "Not enough data for frame information\n");
307 return AVERROR_INVALIDDATA;
308 }
309 c->frame_info = AV_RL32(ptr);
310 av_log(avctx, AV_LOG_DEBUG, "frame information flags %X\n", c->frame_info);
311
312 c->frame_pred = (c->frame_info >> 8) & 3;
313
314 if (c->frame_pred == PRED_GRADIENT) {
315 av_log_ask_for_sample(avctx, "Frame uses gradient prediction\n");
316 return AVERROR_PATCHWELCOME;
317 }
318
319 av_fast_malloc(&c->slice_bits, &c->slice_bits_size,
320 max_slice_size + FF_INPUT_BUFFER_PADDING_SIZE);
321
322 if (!c->slice_bits) {
323 av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer\n");
324 return AVERROR(ENOMEM);
325 }
326
327 switch (c->avctx->pix_fmt) {
328 case PIX_FMT_RGB24:
329 case PIX_FMT_RGBA:
330 for (i = 0; i < c->planes; i++) {
331 ret = decode_plane(c, i, c->pic.data[0] + rgb_order[i], c->planes,
332 c->pic.linesize[0], avctx->width, avctx->height,
333 plane_start[i], plane_start[i + 1] - plane_start[i],
334 c->frame_pred == PRED_LEFT);
335 if (ret)
336 return ret;
337 if (c->frame_pred == PRED_MEDIAN)
338 restore_median(c->pic.data[0] + rgb_order[i], c->planes,
339 c->pic.linesize[0], avctx->width, avctx->height,
340 c->slices);
341 }
342 restore_rgb_planes(c->pic.data[0], c->planes, c->pic.linesize[0],
343 avctx->width, avctx->height);
344 break;
345 case PIX_FMT_YUV420P:
346 for (i = 0; i < 3; i++) {
347 ret = decode_plane(c, i, c->pic.data[i], 1,
348 c->pic.linesize[i], avctx->width >> !!i, avctx->height >> !!i,
349 plane_start[i], plane_start[i + 1] - plane_start[i],
350 c->frame_pred == PRED_LEFT);
351 if (ret)
352 return ret;
353 if (c->frame_pred == PRED_MEDIAN)
354 restore_median(c->pic.data[i], 1, c->pic.linesize[i],
355 avctx->width >> !!i, avctx->height >> !!i,
356 c->slices);
357 }
358 break;
359 case PIX_FMT_YUV422P:
360 for (i = 0; i < 3; i++) {
361 ret = decode_plane(c, i, c->pic.data[i], 1,
362 c->pic.linesize[i], avctx->width >> !!i, avctx->height,
363 plane_start[i], plane_start[i + 1] - plane_start[i],
364 c->frame_pred == PRED_LEFT);
365 if (ret)
366 return ret;
367 if (c->frame_pred == PRED_MEDIAN)
368 restore_median(c->pic.data[i], 1, c->pic.linesize[i],
369 avctx->width >> !!i, avctx->height, c->slices);
370 }
371 break;
372 }
373
374 *data_size = sizeof(AVFrame);
375 *(AVFrame*)data = c->pic;
376
377 /* always report that the buffer was completely consumed */
378 return buf_size;
379}
380
381static av_cold int decode_init(AVCodecContext *avctx)
382{
383 UtvideoContext * const c = avctx->priv_data;
384
385 c->avctx = avctx;
386
387 dsputil_init(&c->dsp, avctx);
388
389 if (avctx->extradata_size < 16) {
390 av_log(avctx, AV_LOG_ERROR, "Insufficient extradata size %d, should be at least 16\n",
391 avctx->extradata_size);
392 return AVERROR_INVALIDDATA;
393 }
394
395 av_log(avctx, AV_LOG_DEBUG, "Encoder version %d.%d.%d.%d\n",
396 avctx->extradata[3], avctx->extradata[2],
397 avctx->extradata[1], avctx->extradata[0]);
398 av_log(avctx, AV_LOG_DEBUG, "Original format %X\n", AV_RB32(avctx->extradata + 4));
399 c->frame_info_size = AV_RL32(avctx->extradata + 8);
400 c->flags = AV_RL32(avctx->extradata + 12);
401
402 if (c->frame_info_size != 4)
403 av_log_ask_for_sample(avctx, "Frame info is not 4 bytes\n");
404 av_log(avctx, AV_LOG_DEBUG, "Encoding parameters %08X\n", c->flags);
405 c->slices = (c->flags >> 24) + 1;
406 c->compression = c->flags & 1;
407 c->interlaced = c->flags & 0x800;
408
409 c->slice_bits_size = 0;
410
411 switch (avctx->codec_tag) {
412 case MKTAG('U', 'L', 'R', 'G'):
413 c->planes = 3;
414 avctx->pix_fmt = PIX_FMT_RGB24;
415 break;
416 case MKTAG('U', 'L', 'R', 'A'):
417 c->planes = 4;
418 avctx->pix_fmt = PIX_FMT_RGBA;
419 break;
420 case MKTAG('U', 'L', 'Y', '0'):
421 c->planes = 3;
422 avctx->pix_fmt = PIX_FMT_YUV420P;
423 break;
424 case MKTAG('U', 'L', 'Y', '2'):
425 c->planes = 3;
426 avctx->pix_fmt = PIX_FMT_YUV422P;
427 break;
428 default:
429 av_log(avctx, AV_LOG_ERROR, "Unknown Ut Video FOURCC provided (%08X)\n",
430 avctx->codec_tag);
431 return AVERROR_INVALIDDATA;
432 }
433
434 return 0;
435}
436
437static av_cold int decode_end(AVCodecContext *avctx)
438{
439 UtvideoContext * const c = avctx->priv_data;
440
441 if (c->pic.data[0])
442 avctx->release_buffer(avctx, &c->pic);
443
444 av_freep(&c->slice_bits);
445
446 return 0;
447}
448
449AVCodec ff_utvideo_decoder = {
450 .name = "utvideo",
451 .type = AVMEDIA_TYPE_VIDEO,
452 .id = CODEC_ID_UTVIDEO,
453 .priv_data_size = sizeof(UtvideoContext),
454 .init = decode_init,
455 .close = decode_end,
456 .decode = decode_frame,
457 .capabilities = CODEC_CAP_DR1,
458 .long_name = NULL_IF_CONFIG_SMALL("Ut Video"),
459};
460
libavcodec/vc1dec.c+11−9
@@ -1291,6 +1291,7 @@ static av_always_inline int scaleforsame_x(VC1Context *v, int n /* MV */, int di · 1290 unmodified lines
1291 int scaledvalue, refdist;1291 int scaledvalue, refdist;
1292 int scalesame1, scalesame2;1292 int scalesame1, scalesame2;
1293 int scalezone1_x, zone1offset_x;1293 int scalezone1_x, zone1offset_x;
1294 int table_index = dir ^ v->second_field;
1294 1295
1295 if (v->s.pict_type != AV_PICTURE_TYPE_B)1296 if (v->s.pict_type != AV_PICTURE_TYPE_B)
1296 refdist = v->refdist;1297 refdist = v->refdist;
@@ -1298,10 +1299,10 @@ static av_always_inline int scaleforsame_x(VC1Context *v, int n /* MV */, int di · 1 unmodified line
1298 refdist = dir ? v->brfd : v->frfd;1299 refdist = dir ? v->brfd : v->frfd;
1299 if (refdist > 3)1300 if (refdist > 3)
1300 refdist = 3;1301 refdist = 3;
1301 scalesame1 = vc1_field_mvpred_scales[v->second_field][1][refdist];1302 scalesame1 = vc1_field_mvpred_scales[table_index][1][refdist];
1302 scalesame2 = vc1_field_mvpred_scales[v->second_field][2][refdist];1303 scalesame2 = vc1_field_mvpred_scales[table_index][2][refdist];
1303 scalezone1_x = vc1_field_mvpred_scales[v->second_field][3][refdist];1304 scalezone1_x = vc1_field_mvpred_scales[table_index][3][refdist];
1304 zone1offset_x = vc1_field_mvpred_scales[v->second_field][5][refdist];1305 zone1offset_x = vc1_field_mvpred_scales[table_index][5][refdist];
1305 1306
1306 if (FFABS(n) > 255)1307 if (FFABS(n) > 255)
1307 scaledvalue = n;1308 scaledvalue = n;
@@ -1323,6 +1324,7 @@ static av_always_inline int scaleforsame_y(VC1Context *v, int i, int n /* MV */, · 15 unmodified lines
1323 int scaledvalue, refdist;1324 int scaledvalue, refdist;
1324 int scalesame1, scalesame2;1325 int scalesame1, scalesame2;
1325 int scalezone1_y, zone1offset_y;1326 int scalezone1_y, zone1offset_y;
1327 int table_index = dir ^ v->second_field;
1326 1328
1327 if (v->s.pict_type != AV_PICTURE_TYPE_B)1329 if (v->s.pict_type != AV_PICTURE_TYPE_B)
1328 refdist = v->refdist;1330 refdist = v->refdist;
@@ -1330,10 +1332,10 @@ static av_always_inline int scaleforsame_y(VC1Context *v, int i, int n /* MV */, · 1 unmodified line
1330 refdist = dir ? v->brfd : v->frfd;1332 refdist = dir ? v->brfd : v->frfd;
1331 if (refdist > 3)1333 if (refdist > 3)
1332 refdist = 3;1334 refdist = 3;
1333 scalesame1 = vc1_field_mvpred_scales[v->second_field][1][refdist];1335 scalesame1 = vc1_field_mvpred_scales[table_index][1][refdist];
1334 scalesame2 = vc1_field_mvpred_scales[v->second_field][2][refdist];1336 scalesame2 = vc1_field_mvpred_scales[table_index][2][refdist];
1335 scalezone1_y = vc1_field_mvpred_scales[v->second_field][4][refdist];1337 scalezone1_y = vc1_field_mvpred_scales[table_index][4][refdist];
1336 zone1offset_y = vc1_field_mvpred_scales[v->second_field][6][refdist];1338 zone1offset_y = vc1_field_mvpred_scales[table_index][6][refdist];
1337 1339
1338 if (FFABS(n) > 63)1340 if (FFABS(n) > 63)
1339 scaledvalue = n;1341 scaledvalue = n;
@@ -1444,7 +1446,7 @@ static av_always_inline int scaleforopp(VC1Context *v, int n /* MV */, · 104 unmodified lines
1444 refdist = FFMIN(v->refdist, 3);1446 refdist = FFMIN(v->refdist, 3);
1445 else1447 else
1446 refdist = dir ? v->brfd : v->frfd;1448 refdist = dir ? v->brfd : v->frfd;
1447 scaleopp = vc1_field_mvpred_scales[v->second_field][0][refdist];1449 scaleopp = vc1_field_mvpred_scales[dir ^ v->second_field][0][refdist];
1448 1450
1449 return n * scaleopp >> 8;1451 return n * scaleopp >> 8;
1450}1452}
libavcodec/version.h+1−1
@@ -21,7 +21,7 @@ · 20 unmodified lines
21#define AVCODEC_VERSION_H21#define AVCODEC_VERSION_H
22 22
23#define LIBAVCODEC_VERSION_MAJOR 5323#define LIBAVCODEC_VERSION_MAJOR 53
24#define LIBAVCODEC_VERSION_MINOR 2124#define LIBAVCODEC_VERSION_MINOR 22
25#define LIBAVCODEC_VERSION_MICRO 025#define LIBAVCODEC_VERSION_MICRO 0
26 26
27#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \27#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
libavdevice/alsa-audio-dec.c+1−1
@@ -61,7 +61,7 @@ static av_cold int audio_read_header(AVFormatContext *s1, · 60 unmodified lines
61 enum CodecID codec_id;61 enum CodecID codec_id;
62 double o;62 double o;
63 63
64 st = av_new_stream(s1, 0);64 st = avformat_new_stream(s1, NULL);
65 if (!st) {65 if (!st) {
66 av_log(s1, AV_LOG_ERROR, "Cannot add stream\n");66 av_log(s1, AV_LOG_ERROR, "Cannot add stream\n");
67 67
libavdevice/bktr.c+1−1
@@ -271,7 +271,7 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap) · 270 unmodified lines
271 goto out;271 goto out;
272 }272 }
273 273
274 st = av_new_stream(s1, 0);274 st = avformat_new_stream(s1, NULL);
275 if (!st) {275 if (!st) {
276 ret = AVERROR(ENOMEM);276 ret = AVERROR(ENOMEM);
277 goto out;277 goto out;
libavdevice/fbdev.c+1−1
@@ -108,7 +108,7 @@ av_cold static int fbdev_read_header(AVFormatContext *avctx, · 107 unmodified lines
108 return ret;108 return ret;
109 }109 }
110 110
111 if (!(st = av_new_stream(avctx, 0)))111 if (!(st = avformat_new_stream(avctx, NULL)))
112 return AVERROR(ENOMEM);112 return AVERROR(ENOMEM);
113 av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in microseconds */113 av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in microseconds */
114 114
libavdevice/jack_audio.c+1−1
@@ -229,7 +229,7 @@ static int audio_read_header(AVFormatContext *context, AVFormatParameters *param · 228 unmodified lines
229 if ((test = start_jack(context)))229 if ((test = start_jack(context)))
230 return test;230 return test;
231 231
232 stream = av_new_stream(context, 0);232 stream = avformat_new_stream(context, NULL);
233 if (!stream) {233 if (!stream) {
234 stop_jack(self);234 stop_jack(self);
235 return AVERROR(ENOMEM);235 return AVERROR(ENOMEM);
libavdevice/libcdio.c+1−1
@@ -54,7 +54,7 @@ static av_cold int read_header(AVFormatContext *ctx, AVFormatParameters *ap) · 53 unmodified lines
54 int ret, i;54 int ret, i;
55 char *err = NULL;55 char *err = NULL;
56 56
57 if (!(st = av_new_stream(ctx, 0)))57 if (!(st = avformat_new_stream(ctx, NULL)))
58 return AVERROR(ENOMEM);58 return AVERROR(ENOMEM);
59 s->drive = cdio_cddap_identify(ctx->filename, CDDA_MESSAGE_LOGIT, &err);59 s->drive = cdio_cddap_identify(ctx->filename, CDDA_MESSAGE_LOGIT, &err);
60 if (!s->drive) {60 if (!s->drive) {
libavdevice/libdc1394.c+1−1
@@ -253,7 +253,7 @@ static int dc1394_read_header(AVFormatContext *c, AVFormatParameters * ap) · 252 unmodified lines
253 }253 }
254 254
255 /* create a video stream */255 /* create a video stream */
256 vst = av_new_stream(c, 0);256 vst = avformat_new_stream(c, NULL);
257 if (!vst)257 if (!vst)
258 goto out_camera;258 goto out_camera;
259 av_set_pts_info(vst, 64, 1, 1000);259 av_set_pts_info(vst, 64, 1, 1000);
libavdevice/oss_audio.c+1−1
@@ -209,7 +209,7 @@ static int audio_read_header(AVFormatContext *s1, AVFormatParameters *ap) · 208 unmodified lines
209 AVStream *st;209 AVStream *st;
210 int ret;210 int ret;
211 211
212 st = av_new_stream(s1, 0);212 st = avformat_new_stream(s1, NULL);
213 if (!st) {213 if (!st) {
214 return AVERROR(ENOMEM);214 return AVERROR(ENOMEM);
215 }215 }
libavdevice/sndio_dec.c+1−1
@@ -34,7 +34,7 @@ static av_cold int audio_read_header(AVFormatContext *s1, · 33 unmodified lines
34 AVStream *st;34 AVStream *st;
35 int ret;35 int ret;
36 36
37 st = av_new_stream(s1, 0);37 st = avformat_new_stream(s1, NULL);
38 if (!st)38 if (!st)
39 return AVERROR(ENOMEM);39 return AVERROR(ENOMEM);
40 40
libavdevice/v4l.c+1−1
@@ -98,7 +98,7 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap) · 97 unmodified lines
98 s->video_win.width = ap->width;98 s->video_win.width = ap->width;
99 s->video_win.height = ap->height;99 s->video_win.height = ap->height;
100 100
101 st = av_new_stream(s1, 0);101 st = avformat_new_stream(s1, NULL);
102 if (!st)102 if (!st)
103 return AVERROR(ENOMEM);103 return AVERROR(ENOMEM);
104 av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */104 av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
libavdevice/v4l2.c+1−1
@@ -560,7 +560,7 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap) · 559 unmodified lines
560 enum CodecID codec_id;560 enum CodecID codec_id;
561 enum PixelFormat pix_fmt = PIX_FMT_NONE;561 enum PixelFormat pix_fmt = PIX_FMT_NONE;
562 562
563 st = av_new_stream(s1, 0);563 st = avformat_new_stream(s1, NULL);
564 if (!st) {564 if (!st) {
565 res = AVERROR(ENOMEM);565 res = AVERROR(ENOMEM);
566 goto out;566 goto out;
libavdevice/vfwcap.c+1−1
@@ -293,7 +293,7 @@ static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap) · 292 unmodified lines
293 293
294 SetWindowLongPtr(ctx->hwnd, GWLP_USERDATA, (LONG_PTR) s);294 SetWindowLongPtr(ctx->hwnd, GWLP_USERDATA, (LONG_PTR) s);
295 295
296 st = av_new_stream(s, 0);296 st = avformat_new_stream(s, NULL);
297 if(!st) {297 if(!st) {
298 vfw_read_close(s);298 vfw_read_close(s);
299 return AVERROR(ENOMEM);299 return AVERROR(ENOMEM);
libavdevice/x11grab.c+1−1
@@ -194,7 +194,7 @@ x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap) · 193 unmodified lines
194 goto out;194 goto out;
195 }195 }
196 196
197 st = av_new_stream(s1, 0);197 st = avformat_new_stream(s1, NULL);
198 if (!st) {198 if (!st) {
199 ret = AVERROR(ENOMEM);199 ret = AVERROR(ENOMEM);
200 goto out;200 goto out;
libavfilter/avfilter.h+1−1
@@ -30,7 +30,7 @@ · 29 unmodified lines
30 30
31#define LIBAVFILTER_VERSION_MAJOR 231#define LIBAVFILTER_VERSION_MAJOR 2
32#define LIBAVFILTER_VERSION_MINOR 4432#define LIBAVFILTER_VERSION_MINOR 44
33#define LIBAVFILTER_VERSION_MICRO 033#define LIBAVFILTER_VERSION_MICRO 1
34 34
35#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \35#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
36 LIBAVFILTER_VERSION_MINOR, \36 LIBAVFILTER_VERSION_MINOR, \
libavfilter/vsrc_testsrc.c+7−7
@@ -103,7 +103,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) · 102 unmodified lines
103 test->nb_frame = 0;103 test->nb_frame = 0;
104 test->pts = 0;104 test->pts = 0;
105 105
106 av_log(ctx, AV_LOG_INFO, "size:%dx%d rate:%d/%d duration:%f sar:%d/%d\n",106 av_log(ctx, AV_LOG_DEBUG, "size:%dx%d rate:%d/%d duration:%f sar:%d/%d\n",
107 test->w, test->h, frame_rate_q.num, frame_rate_q.den,107 test->w, test->h, frame_rate_q.num, frame_rate_q.den,
108 duration < 0 ? -1 : test->max_pts * av_q2d(test->time_base),108 duration < 0 ? -1 : test->max_pts * av_q2d(test->time_base),
109 test->sar.num, test->sar.den);109 test->sar.num, test->sar.den);
@@ -156,9 +156,9 @@ static const char *testsrc_get_name(void *ctx) · 46 unmodified lines
156}156}
157 157
158static const AVClass testsrc_class = {158static const AVClass testsrc_class = {
159 "TestSourceContext",159 .class_name = "TestSourceContext",
160 testsrc_get_name,160 .item_name = testsrc_get_name,
161 testsrc_options161 .option = testsrc_options,
162};162};
163 163
164/**164/**
@@ -378,9 +378,9 @@ static const char *rgbtestsrc_get_name(void *ctx) · 213 unmodified lines
378}378}
379 379
380static const AVClass rgbtestsrc_class = {380static const AVClass rgbtestsrc_class = {
381 "RGBTestSourceContext",381 .class_name = "RGBTestSourceContext",
382 rgbtestsrc_get_name,382 .item_name = rgbtestsrc_get_name,
383 testsrc_options383 .option = testsrc_options,
384};384};
385 385
386#define R 0386#define R 0
libavformat/4xm.c+3−2
@@ -141,7 +141,7 @@ static int fourxm_read_header(AVFormatContext *s, · 140 unmodified lines
141 fourxm->height = AV_RL32(&header[i + 40]);141 fourxm->height = AV_RL32(&header[i + 40]);
142 142
143 /* allocate a new AVStream */143 /* allocate a new AVStream */
144 st = av_new_stream(s, 0);144 st = avformat_new_stream(s, NULL);
145 if (!st){145 if (!st){
146 ret= AVERROR(ENOMEM);146 ret= AVERROR(ENOMEM);
147 goto fail;147 goto fail;
@@ -199,12 +199,13 @@ static int fourxm_read_header(AVFormatContext *s, · 51 unmodified lines
199 i += 8 + size;199 i += 8 + size;
200 200
201 /* allocate a new AVStream */201 /* allocate a new AVStream */
202 st = av_new_stream(s, current_track);202 st = avformat_new_stream(s, NULL);
203 if (!st){203 if (!st){
204 ret= AVERROR(ENOMEM);204 ret= AVERROR(ENOMEM);
205 goto fail;205 goto fail;
206 }206 }
207 207
208 st->id = current_track;
208 av_set_pts_info(st, 60, 1, fourxm->tracks[current_track].sample_rate);209 av_set_pts_info(st, 60, 1, fourxm->tracks[current_track].sample_rate);
209 210
210 fourxm->tracks[current_track].stream_index = st->index;211 fourxm->tracks[current_track].stream_index = st->index;
libavformat/aacdec.c+1−1
@@ -66,7 +66,7 @@ static int adts_aac_read_header(AVFormatContext *s, · 65 unmodified lines
66{66{
67 AVStream *st;67 AVStream *st;
68 68
69 st = av_new_stream(s, 0);69 st = avformat_new_stream(s, NULL);
70 if (!st)70 if (!st)
71 return AVERROR(ENOMEM);71 return AVERROR(ENOMEM);
72 72
libavformat/aea.c+1−1
@@ -57,7 +57,7 @@ static int aea_read_probe(AVProbeData *p) · 56 unmodified lines
57static int aea_read_header(AVFormatContext *s,57static int aea_read_header(AVFormatContext *s,
58 AVFormatParameters *ap)58 AVFormatParameters *ap)
59{59{
60 AVStream *st = av_new_stream(s, 0);60 AVStream *st = avformat_new_stream(s, NULL);
61 if (!st)61 if (!st)
62 return AVERROR(ENOMEM);62 return AVERROR(ENOMEM);
63 63
libavformat/aiffdec.c+1−1
@@ -198,7 +198,7 @@ static int aiff_read_header(AVFormatContext *s, · 197 unmodified lines
198 198
199 filesize -= 4;199 filesize -= 4;
200 200
201 st = av_new_stream(s, 0);201 st = avformat_new_stream(s, NULL);
202 if (!st)202 if (!st)
203 return AVERROR(ENOMEM);203 return AVERROR(ENOMEM);
204 204
libavformat/amr.c+1−1
@@ -84,7 +84,7 @@ static int amr_read_header(AVFormatContext *s, · 83 unmodified lines
84 84
85 avio_read(pb, header, 6);85 avio_read(pb, header, 6);
86 86
87 st = av_new_stream(s, 0);87 st = avformat_new_stream(s, NULL);
88 if (!st)88 if (!st)
89 {89 {
90 return AVERROR(ENOMEM);90 return AVERROR(ENOMEM);
libavformat/anm.c+1−1
@@ -97,7 +97,7 @@ static int read_header(AVFormatContext *s, · 96 unmodified lines
97 return AVERROR_INVALIDDATA;97 return AVERROR_INVALIDDATA;
98 98
99 /* video stream */99 /* video stream */
100 st = av_new_stream(s, 0);100 st = avformat_new_stream(s, NULL);
101 if (!st)101 if (!st)
102 return AVERROR(ENOMEM);102 return AVERROR(ENOMEM);
103 st->codec->codec_type = AVMEDIA_TYPE_VIDEO;103 st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
libavformat/apc.c+1−1
@@ -39,7 +39,7 @@ static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap) · 38 unmodified lines
39 avio_rl32(pb); /* _APC */39 avio_rl32(pb); /* _APC */
40 avio_rl32(pb); /* 1.20 */40 avio_rl32(pb); /* 1.20 */
41 41
42 st = av_new_stream(s, 0);42 st = avformat_new_stream(s, NULL);
43 if (!st)43 if (!st)
44 return AVERROR(ENOMEM);44 return AVERROR(ENOMEM);
45 45
libavformat/ape.c+1−1
@@ -313,7 +313,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) · 312 unmodified lines
313 ape->compressiontype);313 ape->compressiontype);
314 314
315 /* now we are ready: build format streams */315 /* now we are ready: build format streams */
316 st = av_new_stream(s, 0);316 st = avformat_new_stream(s, NULL);
317 if (!st)317 if (!st)
318 return -1;318 return -1;
319 319
libavformat/applehttp.c+2−1
@@ -505,11 +505,12 @@ static int applehttp_read_header(AVFormatContext *s, AVFormatParameters *ap) · 504 unmodified lines
505 snprintf(bitrate_str, sizeof(bitrate_str), "%d", v->bandwidth);505 snprintf(bitrate_str, sizeof(bitrate_str), "%d", v->bandwidth);
506 /* Create new AVStreams for each stream in this variant */506 /* Create new AVStreams for each stream in this variant */
507 for (j = 0; j < v->ctx->nb_streams; j++) {507 for (j = 0; j < v->ctx->nb_streams; j++) {
508 AVStream *st = av_new_stream(s, i);508 AVStream *st = avformat_new_stream(s, NULL);
509 if (!st) {509 if (!st) {
510 ret = AVERROR(ENOMEM);510 ret = AVERROR(ENOMEM);
511 goto fail;511 goto fail;
512 }512 }
513 st->id = i;
513 avcodec_copy_context(st->codec, v->ctx->streams[j]->codec);514 avcodec_copy_context(st->codec, v->ctx->streams[j]->codec);
514 if (v->bandwidth)515 if (v->bandwidth)
515 av_dict_set(&st->metadata, "variant_bitrate", bitrate_str,516 av_dict_set(&st->metadata, "variant_bitrate", bitrate_str,
libavformat/asfdec.c+1−1
@@ -224,7 +224,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) · 223 unmodified lines
224 224
225 pos1 = avio_tell(pb);225 pos1 = avio_tell(pb);
226 226
227 st = av_new_stream(s, 0);227 st = avformat_new_stream(s, NULL);
228 if (!st)228 if (!st)
229 return AVERROR(ENOMEM);229 return AVERROR(ENOMEM);
230 av_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */230 av_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */
libavformat/assdec.c+1−1
@@ -83,7 +83,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) · 82 unmodified lines
83 uint8_t *p, **dst[2]={0};83 uint8_t *p, **dst[2]={0};
84 int pos[2]={0};84 int pos[2]={0};
85 85
86 st = av_new_stream(s, 0);86 st = avformat_new_stream(s, NULL);
87 if (!st)87 if (!st)
88 return -1;88 return -1;
89 av_set_pts_info(st, 64, 1, 100);89 av_set_pts_info(st, 64, 1, 100);
libavformat/au.c+1−1
@@ -156,7 +156,7 @@ static int au_read_header(AVFormatContext *s, · 155 unmodified lines
156 }156 }
157 157
158 /* now we are ready: build format streams */158 /* now we are ready: build format streams */
159 st = av_new_stream(s, 0);159 st = avformat_new_stream(s, NULL);
160 if (!st)160 if (!st)
161 return -1;161 return -1;
162 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;162 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
libavformat/avformat.h+21−0
@@ -1402,6 +1402,7 @@ void av_close_input_file(AVFormatContext *s); · 1401 unmodified lines
1402 */1402 */
1403void avformat_free_context(AVFormatContext *s);1403void avformat_free_context(AVFormatContext *s);
1404 1404
1405#if FF_API_NEW_STREAM
1405/**1406/**
1406 * Add a new stream to a media file.1407 * Add a new stream to a media file.
1407 *1408 *
@@ -1412,7 +1413,27 @@ void avformat_free_context(AVFormatContext *s); · 4 unmodified lines
1412 * @param s media file handle1413 * @param s media file handle
1413 * @param id file-format-dependent stream ID1414 * @param id file-format-dependent stream ID
1414 */1415 */
1416attribute_deprecated
1415AVStream *av_new_stream(AVFormatContext *s, int id);1417AVStream *av_new_stream(AVFormatContext *s, int id);
1418#endif
1419
1420/**
1421 * Add a new stream to a media file.
1422 *
1423 * When demuxing, it is called by the demuxer in read_header(). If the
1424 * flag AVFMTCTX_NOHEADER is set in s.ctx_flags, then it may also
1425 * be called in read_packet().
1426 *
1427 * When muxing, should be called by the user before avformat_write_header().
1428 *
1429 * @param c If non-NULL, the AVCodecContext corresponding to the new stream
1430 * will be initialized to use this codec. This is needed for e.g. codec-specific
1431 * defaults to be set, so codec should be provided if it is known.
1432 *
1433 * @return newly created stream or NULL on error.
1434 */
1435AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c);
1436
1416AVProgram *av_new_program(AVFormatContext *s, int id);1437AVProgram *av_new_program(AVFormatContext *s, int id);
1417 1438
1418/**1439/**
libavformat/avidec.c+2−1
@@ -454,10 +454,11 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) · 453 unmodified lines
454 break;454 break;
455 }else{455 }else{
456 stream_index++;456 stream_index++;
457 st = av_new_stream(s, stream_index);457 st = avformat_new_stream(s, NULL);
458 if (!st)458 if (!st)
459 goto fail;459 goto fail;
460 460
461 st->id = stream_index;
461 ast = av_mallocz(sizeof(AVIStream));462 ast = av_mallocz(sizeof(AVIStream));
462 if (!ast)463 if (!ast)
463 goto fail;464 goto fail;
libavformat/avisynth.c+4−2
@@ -84,7 +84,8 @@ static int avisynth_read_header(AVFormatContext *s, AVFormatParameters *ap) · 83 unmodified lines
84 if (AVIStreamReadFormat(stream->handle, 0, &wvfmt, &struct_size) != S_OK)84 if (AVIStreamReadFormat(stream->handle, 0, &wvfmt, &struct_size) != S_OK)
85 continue;85 continue;
86 86
87 st = av_new_stream(s, id);87 st = avformat_new_stream(s, NULL);
88 st->id = id;
88 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;89 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
89 90
90 st->codec->block_align = wvfmt.nBlockAlign;91 st->codec->block_align = wvfmt.nBlockAlign;
@@ -110,7 +111,8 @@ static int avisynth_read_header(AVFormatContext *s, AVFormatParameters *ap) · 19 unmodified lines
110 if (AVIStreamReadFormat(stream->handle, 0, &imgfmt, &struct_size) != S_OK)111 if (AVIStreamReadFormat(stream->handle, 0, &imgfmt, &struct_size) != S_OK)
111 continue;112 continue;
112 113
113 st = av_new_stream(s, id);114 st = avformat_new_stream(s, NULL);
115 st->id = id;
114 st->codec->codec_type = AVMEDIA_TYPE_VIDEO;116 st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
115 st->r_frame_rate.num = stream->info.dwRate;117 st->r_frame_rate.num = stream->info.dwRate;
116 st->r_frame_rate.den = stream->info.dwScale;118 st->r_frame_rate.den = stream->info.dwScale;
libavformat/avs.c+2−2
@@ -179,7 +179,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt) · 178 unmodified lines
179 179
180 case AVS_VIDEO:180 case AVS_VIDEO:
181 if (!avs->st_video) {181 if (!avs->st_video) {
182 avs->st_video = av_new_stream(s, AVS_VIDEO);182 avs->st_video = avformat_new_stream(s, NULL);
183 if (avs->st_video == NULL)183 if (avs->st_video == NULL)
184 return AVERROR(ENOMEM);184 return AVERROR(ENOMEM);
185 avs->st_video->codec->codec_type = AVMEDIA_TYPE_VIDEO;185 avs->st_video->codec->codec_type = AVMEDIA_TYPE_VIDEO;
@@ -196,7 +196,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt) · 10 unmodified lines
196 196
197 case AVS_AUDIO:197 case AVS_AUDIO:
198 if (!avs->st_audio) {198 if (!avs->st_audio) {
199 avs->st_audio = av_new_stream(s, AVS_AUDIO);199 avs->st_audio = avformat_new_stream(s, NULL);
200 if (avs->st_audio == NULL)200 if (avs->st_audio == NULL)
201 return AVERROR(ENOMEM);201 return AVERROR(ENOMEM);
202 avs->st_audio->codec->codec_type = AVMEDIA_TYPE_AUDIO;202 avs->st_audio->codec->codec_type = AVMEDIA_TYPE_AUDIO;
libavformat/bethsoftvid.c+2−2
@@ -70,7 +70,7 @@ static int vid_read_header(AVFormatContext *s, · 69 unmodified lines
70 avio_skip(pb, 5);70 avio_skip(pb, 5);
71 vid->nframes = avio_rl16(pb);71 vid->nframes = avio_rl16(pb);
72 72
73 stream = av_new_stream(s, 0);73 stream = avformat_new_stream(s, NULL);
74 if (!stream)74 if (!stream)
75 return AVERROR(ENOMEM);75 return AVERROR(ENOMEM);
76 av_set_pts_info(stream, 32, 1, 60); // 16 ms increments, i.e. 60 fps76 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, · 6 unmodified lines
83 avio_rl16(pb);83 avio_rl16(pb);
84 84
85 // done with video codec, set up audio codec85 // done with video codec, set up audio codec
86 stream = av_new_stream(s, 0);86 stream = avformat_new_stream(s, NULL);
87 if (!stream)87 if (!stream)
88 return AVERROR(ENOMEM);88 return AVERROR(ENOMEM);
89 stream->codec->codec_type = AVMEDIA_TYPE_AUDIO;89 stream->codec->codec_type = AVMEDIA_TYPE_AUDIO;
libavformat/bfi.c+2−2
@@ -55,12 +55,12 @@ static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap) · 54 unmodified lines
55 int fps, chunk_header;55 int fps, chunk_header;
56 56
57 /* Initialize the video codec... */57 /* Initialize the video codec... */
58 vstream = av_new_stream(s, 0);58 vstream = avformat_new_stream(s, NULL);
59 if (!vstream)59 if (!vstream)
60 return AVERROR(ENOMEM);60 return AVERROR(ENOMEM);
61 61
62 /* Initialize the audio codec... */62 /* Initialize the audio codec... */
63 astream = av_new_stream(s, 0);63 astream = avformat_new_stream(s, NULL);
64 if (!astream)64 if (!astream)
65 return AVERROR(ENOMEM);65 return AVERROR(ENOMEM);
66 66
libavformat/bink.c+2−2
@@ -78,7 +78,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) · 77 unmodified lines
78 uint16_t flags;78 uint16_t flags;
79 int keyframe;79 int keyframe;
80 80
81 vst = av_new_stream(s, 0);81 vst = avformat_new_stream(s, NULL);
82 if (!vst)82 if (!vst)
83 return AVERROR(ENOMEM);83 return AVERROR(ENOMEM);
84 84
@@ -130,7 +130,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) · 45 unmodified lines
130 avio_skip(pb, 4 * bink->num_audio_tracks);130 avio_skip(pb, 4 * bink->num_audio_tracks);
131 131
132 for (i = 0; i < bink->num_audio_tracks; i++) {132 for (i = 0; i < bink->num_audio_tracks; i++) {
133 ast = av_new_stream(s, 1);133 ast = avformat_new_stream(s, NULL);
134 if (!ast)134 if (!ast)
135 return AVERROR(ENOMEM);135 return AVERROR(ENOMEM);
136 ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;136 ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
libavformat/c93.c+2−2
@@ -79,7 +79,7 @@ static int read_header(AVFormatContext *s, · 78 unmodified lines
79 /* Audio streams are added if audio packets are found */79 /* Audio streams are added if audio packets are found */
80 s->ctx_flags |= AVFMTCTX_NOHEADER;80 s->ctx_flags |= AVFMTCTX_NOHEADER;
81 81
82 video = av_new_stream(s, 0);82 video = avformat_new_stream(s, NULL);
83 if (!video)83 if (!video)
84 return AVERROR(ENOMEM);84 return AVERROR(ENOMEM);
85 85
@@ -117,7 +117,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) · 31 unmodified lines
117 datasize = avio_rl16(pb);117 datasize = avio_rl16(pb);
118 if (datasize > 42) {118 if (datasize > 42) {
119 if (!c93->audio) {119 if (!c93->audio) {
120 c93->audio = av_new_stream(s, 1);120 c93->audio = avformat_new_stream(s, NULL);
121 if (!c93->audio)121 if (!c93->audio)
122 return AVERROR(ENOMEM);122 return AVERROR(ENOMEM);
123 c93->audio->codec->codec_type = AVMEDIA_TYPE_AUDIO;123 c93->audio->codec->codec_type = AVMEDIA_TYPE_AUDIO;
libavformat/cafdec.c+1−1
@@ -61,7 +61,7 @@ static int read_desc_chunk(AVFormatContext *s) · 60 unmodified lines
61 int flags;61 int flags;
62 62
63 /* new audio stream */63 /* new audio stream */
64 st = av_new_stream(s, 0);64 st = avformat_new_stream(s, NULL);
65 if (!st)65 if (!st)
66 return AVERROR(ENOMEM);66 return AVERROR(ENOMEM);
67 67
libavformat/cdg.c+1−1
@@ -28,7 +28,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) · 27 unmodified lines
28 AVStream *vst;28 AVStream *vst;
29 int ret;29 int ret;
30 30
31 vst = av_new_stream(s, 0);31 vst = avformat_new_stream(s, NULL);
32 if (!vst)32 if (!vst)
33 return AVERROR(ENOMEM);33 return AVERROR(ENOMEM);
34 34
libavformat/daud.c+1−1
@@ -21,7 +21,7 @@ · 20 unmodified lines
21#include "avformat.h"21#include "avformat.h"
22 22
23static int daud_header(AVFormatContext *s, AVFormatParameters *ap) {23static int daud_header(AVFormatContext *s, AVFormatParameters *ap) {
24 AVStream *st = av_new_stream(s, 0);24 AVStream *st = avformat_new_stream(s, NULL);
25 if (!st)25 if (!st)
26 return AVERROR(ENOMEM);26 return AVERROR(ENOMEM);
27 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;27 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
libavformat/dfa.c+1−1
@@ -45,7 +45,7 @@ static int dfa_read_header(AVFormatContext *s, · 44 unmodified lines
45 avio_skip(pb, 2); // unused45 avio_skip(pb, 2); // unused
46 frames = avio_rl16(pb);46 frames = avio_rl16(pb);
47 47
48 st = av_new_stream(s, 0);48 st = avformat_new_stream(s, NULL);
49 if (!st)49 if (!st)
50 return AVERROR(ENOMEM);50 return AVERROR(ENOMEM);
51 51
libavformat/dsicin.c+2−2
@@ -107,7 +107,7 @@ static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap) · 106 unmodified lines
107 cin->audio_buffer_size = 0;107 cin->audio_buffer_size = 0;
108 108
109 /* initialize the video decoder stream */109 /* initialize the video decoder stream */
110 st = av_new_stream(s, 0);110 st = avformat_new_stream(s, NULL);
111 if (!st)111 if (!st)
112 return AVERROR(ENOMEM);112 return AVERROR(ENOMEM);
113 113
@@ -120,7 +120,7 @@ static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap) · 6 unmodified lines
120 st->codec->height = hdr->video_frame_height;120 st->codec->height = hdr->video_frame_height;
121 121
122 /* initialize the audio decoder stream */122 /* initialize the audio decoder stream */
123 st = av_new_stream(s, 0);123 st = avformat_new_stream(s, NULL);
124 if (!st)124 if (!st)
125 return AVERROR(ENOMEM);125 return AVERROR(ENOMEM);
126 126
libavformat/dv.c+2−2
@@ -211,7 +211,7 @@ static int dv_extract_audio_info(DVDemuxContext* c, uint8_t* frame) · 210 unmodified lines
211 /* Dynamic handling of the audio streams in DV */211 /* Dynamic handling of the audio streams in DV */
212 for (i = 0; i < ach; i++) {212 for (i = 0; i < ach; i++) {
213 if (!c->ast[i]) {213 if (!c->ast[i]) {
214 c->ast[i] = av_new_stream(c->fctx, 0);214 c->ast[i] = avformat_new_stream(c->fctx, NULL);
215 if (!c->ast[i])215 if (!c->ast[i])
216 break;216 break;
217 av_set_pts_info(c->ast[i], 64, 1, 30000);217 av_set_pts_info(c->ast[i], 64, 1, 30000);
@@ -278,7 +278,7 @@ DVDemuxContext* dv_init_demux(AVFormatContext *s) · 60 unmodified lines
278 if (!c)278 if (!c)
279 return NULL;279 return NULL;
280 280
281 c->vst = av_new_stream(s, 0);281 c->vst = avformat_new_stream(s, NULL);
282 if (!c->vst) {282 if (!c->vst) {
283 av_free(c);283 av_free(c);
284 return NULL;284 return NULL;
libavformat/dxa.c+2−2
@@ -87,7 +87,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) · 86 unmodified lines
87 h = avio_rb16(pb);87 h = avio_rb16(pb);
88 c->has_sound = 0;88 c->has_sound = 0;
89 89
90 st = av_new_stream(s, 0);90 st = avformat_new_stream(s, NULL);
91 if (!st)91 if (!st)
92 return -1;92 return -1;
93 93
@@ -100,7 +100,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) · 6 unmodified lines
100 avio_skip(pb, 16);100 avio_skip(pb, 16);
101 fsize = avio_rl32(pb);101 fsize = avio_rl32(pb);
102 102
103 ast = av_new_stream(s, 0);103 ast = avformat_new_stream(s, NULL);
104 if (!ast)104 if (!ast)
105 return -1;105 return -1;
106 ret = ff_get_wav_header(pb, ast->codec, fsize);106 ret = ff_get_wav_header(pb, ast->codec, fsize);
libavformat/eacdata.c+1−1
@@ -66,7 +66,7 @@ static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap) · 65 unmodified lines
66 sample_rate = avio_rb16(pb);66 sample_rate = avio_rb16(pb);
67 avio_skip(pb, (avio_r8(pb) & 0x20) ? 15 : 11);67 avio_skip(pb, (avio_r8(pb) & 0x20) ? 15 : 11);
68 68
69 st = av_new_stream(s, 0);69 st = avformat_new_stream(s, NULL);
70 if (!st)70 if (!st)
71 return AVERROR(ENOMEM);71 return AVERROR(ENOMEM);
72 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;72 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
libavformat/electronicarts.c+2−2
@@ -408,7 +408,7 @@ static int ea_read_header(AVFormatContext *s, · 407 unmodified lines
408 408
409 if (ea->video_codec) {409 if (ea->video_codec) {
410 /* initialize the video decoder stream */410 /* initialize the video decoder stream */
411 st = av_new_stream(s, 0);411 st = avformat_new_stream(s, NULL);
412 if (!st)412 if (!st)
413 return AVERROR(ENOMEM);413 return AVERROR(ENOMEM);
414 ea->video_stream_index = st->index;414 ea->video_stream_index = st->index;
@@ -437,7 +437,7 @@ static int ea_read_header(AVFormatContext *s, · 22 unmodified lines
437 }437 }
438 438
439 /* initialize the audio decoder stream */439 /* initialize the audio decoder stream */
440 st = av_new_stream(s, 0);440 st = avformat_new_stream(s, NULL);
441 if (!st)441 if (!st)
442 return AVERROR(ENOMEM);442 return AVERROR(ENOMEM);
443 av_set_pts_info(st, 33, 1, ea->sample_rate);443 av_set_pts_info(st, 33, 1, ea->sample_rate);
libavformat/ffmdec.c+1−1
@@ -295,7 +295,7 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap) · 294 unmodified lines
295 for(i=0;i<nb_streams;i++) {295 for(i=0;i<nb_streams;i++) {
296 char rc_eq_buf[128];296 char rc_eq_buf[128];
297 297
298 st = av_new_stream(s, 0);298 st = avformat_new_stream(s, NULL);
299 if (!st)299 if (!st)
300 goto fail;300 goto fail;
301 301
libavformat/ffmetadec.c+1−1
@@ -132,7 +132,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) · 131 unmodified lines
132 get_line(s->pb, line, sizeof(line));132 get_line(s->pb, line, sizeof(line));
133 133
134 if (!memcmp(line, ID_STREAM, strlen(ID_STREAM))) {134 if (!memcmp(line, ID_STREAM, strlen(ID_STREAM))) {
135 AVStream *st = av_new_stream(s, 0);135 AVStream *st = avformat_new_stream(s, NULL);
136 136
137 if (!st)137 if (!st)
138 return -1;138 return -1;
libavformat/filmstripdec.c+1−1
@@ -49,7 +49,7 @@ static int read_header(AVFormatContext *s, · 48 unmodified lines
49 return AVERROR_INVALIDDATA;49 return AVERROR_INVALIDDATA;
50 }50 }
51 51
52 st = av_new_stream(s, 0);52 st = avformat_new_stream(s, NULL);
53 if (!st)53 if (!st)
54 return AVERROR(ENOMEM);54 return AVERROR(ENOMEM);
55 55
libavformat/flacdec.c+1−1
@@ -31,7 +31,7 @@ static int flac_read_header(AVFormatContext *s, · 30 unmodified lines
31 int ret, metadata_last=0, metadata_type, metadata_size, found_streaminfo=0;31 int ret, metadata_last=0, metadata_type, metadata_size, found_streaminfo=0;
32 uint8_t header[4];32 uint8_t header[4];
33 uint8_t *buffer=NULL;33 uint8_t *buffer=NULL;
34 AVStream *st = av_new_stream(s, 0);34 AVStream *st = avformat_new_stream(s, NULL);
35 if (!st)35 if (!st)
36 return AVERROR(ENOMEM);36 return AVERROR(ENOMEM);
37 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;37 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
libavformat/flic.c+2−2
@@ -105,7 +105,7 @@ static int flic_read_header(AVFormatContext *s, · 104 unmodified lines
105 speed = FLIC_DEFAULT_SPEED;105 speed = FLIC_DEFAULT_SPEED;
106 106
107 /* initialize the decoder streams */107 /* initialize the decoder streams */
108 st = av_new_stream(s, 0);108 st = avformat_new_stream(s, NULL);
109 if (!st)109 if (!st)
110 return AVERROR(ENOMEM);110 return AVERROR(ENOMEM);
111 flic->video_stream_index = st->index;111 flic->video_stream_index = st->index;
@@ -145,7 +145,7 @@ static int flic_read_header(AVFormatContext *s, · 33 unmodified lines
145 */145 */
146 if (AV_RL16(&preamble[4]) == FLIC_TFTD_CHUNK_AUDIO) {146 if (AV_RL16(&preamble[4]) == FLIC_TFTD_CHUNK_AUDIO) {
147 /* TFTD videos have an extra 22050 Hz 8-bit mono audio stream */147 /* TFTD videos have an extra 22050 Hz 8-bit mono audio stream */
148 ast = av_new_stream(s, 1);148 ast = avformat_new_stream(s, NULL);
149 if (!ast)149 if (!ast)
150 return AVERROR(ENOMEM);150 return AVERROR(ENOMEM);
151 151
libavformat/flvdec.c+2−1
@@ -347,9 +347,10 @@ static int flv_read_metabody(AVFormatContext *s, int64_t next_pos) { · 346 unmodified lines
347}347}
348 348
349static AVStream *create_stream(AVFormatContext *s, int stream_type){349static AVStream *create_stream(AVFormatContext *s, int stream_type){
350 AVStream *st = av_new_stream(s, stream_type);350 AVStream *st = avformat_new_stream(s, NULL);
351 if (!st)351 if (!st)
352 return NULL;352 return NULL;
353 st->id = stream_type;
353 switch(stream_type) {354 switch(stream_type) {
354 case FLV_STREAM_TYPE_VIDEO: st->codec->codec_type = AVMEDIA_TYPE_VIDEO; break;355 case FLV_STREAM_TYPE_VIDEO: st->codec->codec_type = AVMEDIA_TYPE_VIDEO; break;
355 case FLV_STREAM_TYPE_AUDIO: st->codec->codec_type = AVMEDIA_TYPE_AUDIO; break;356 case FLV_STREAM_TYPE_AUDIO: st->codec->codec_type = AVMEDIA_TYPE_AUDIO; break;
libavformat/gxf.c+2−1
@@ -81,9 +81,10 @@ static int get_sindex(AVFormatContext *s, int id, int format) { · 80 unmodified lines
81 i = ff_find_stream_index(s, id);81 i = ff_find_stream_index(s, id);
82 if (i >= 0)82 if (i >= 0)
83 return i;83 return i;
84 st = av_new_stream(s, id);84 st = avformat_new_stream(s, NULL);
85 if (!st)85 if (!st)
86 return AVERROR(ENOMEM);86 return AVERROR(ENOMEM);
87 st->id = id;
87 switch (format) {88 switch (format) {
88 case 3:89 case 3:
89 case 4:90 case 4:
libavformat/idcin.c+2−2
@@ -153,7 +153,7 @@ static int idcin_read_header(AVFormatContext *s, · 152 unmodified lines
153 bytes_per_sample = avio_rl32(pb);153 bytes_per_sample = avio_rl32(pb);
154 channels = avio_rl32(pb);154 channels = avio_rl32(pb);
155 155
156 st = av_new_stream(s, 0);156 st = avformat_new_stream(s, NULL);
157 if (!st)157 if (!st)
158 return AVERROR(ENOMEM);158 return AVERROR(ENOMEM);
159 av_set_pts_info(st, 33, 1, IDCIN_FPS);159 av_set_pts_info(st, 33, 1, IDCIN_FPS);
@@ -174,7 +174,7 @@ static int idcin_read_header(AVFormatContext *s, · 14 unmodified lines
174 /* if sample rate is 0, assume no audio */174 /* if sample rate is 0, assume no audio */
175 if (sample_rate) {175 if (sample_rate) {
176 idcin->audio_present = 1;176 idcin->audio_present = 1;
177 st = av_new_stream(s, 0);177 st = avformat_new_stream(s, NULL);
178 if (!st)178 if (!st)
179 return AVERROR(ENOMEM);179 return AVERROR(ENOMEM);
180 av_set_pts_info(st, 33, 1, IDCIN_FPS);180 av_set_pts_info(st, 33, 1, IDCIN_FPS);
libavformat/idroqdec.c+2−2
@@ -84,7 +84,7 @@ static int roq_read_header(AVFormatContext *s, · 83 unmodified lines
84 roq->audio_frame_count = 0;84 roq->audio_frame_count = 0;
85 roq->audio_stream_index = -1;85 roq->audio_stream_index = -1;
86 86
87 st = av_new_stream(s, 0);87 st = avformat_new_stream(s, NULL);
88 if (!st)88 if (!st)
89 return AVERROR(ENOMEM);89 return AVERROR(ENOMEM);
90 av_set_pts_info(st, 63, 1, framerate);90 av_set_pts_info(st, 63, 1, framerate);
@@ -166,7 +166,7 @@ static int roq_read_packet(AVFormatContext *s, · 75 unmodified lines
166 case RoQ_SOUND_MONO:166 case RoQ_SOUND_MONO:
167 case RoQ_SOUND_STEREO:167 case RoQ_SOUND_STEREO:
168 if (roq->audio_stream_index == -1) {168 if (roq->audio_stream_index == -1) {
169 AVStream *st = av_new_stream(s, 1);169 AVStream *st = avformat_new_stream(s, NULL);
170 if (!st)170 if (!st)
171 return AVERROR(ENOMEM);171 return AVERROR(ENOMEM);
172 av_set_pts_info(st, 32, 1, RoQ_AUDIO_SAMPLE_RATE);172 av_set_pts_info(st, 32, 1, RoQ_AUDIO_SAMPLE_RATE);
libavformat/iff.c+1−1
@@ -135,7 +135,7 @@ static int iff_read_header(AVFormatContext *s, · 134 unmodified lines
135 unsigned transparency = 0;135 unsigned transparency = 0;
136 unsigned masking = 0; // no mask136 unsigned masking = 0; // no mask
137 137
138 st = av_new_stream(s, 0);138 st = avformat_new_stream(s, NULL);
139 if (!st)139 if (!st)
140 return AVERROR(ENOMEM);140 return AVERROR(ENOMEM);
141 141
libavformat/img2.c+1−1
@@ -220,7 +220,7 @@ static int read_header(AVFormatContext *s1, AVFormatParameters *ap) · 219 unmodified lines
220 220
221 s1->ctx_flags |= AVFMTCTX_NOHEADER;221 s1->ctx_flags |= AVFMTCTX_NOHEADER;
222 222
223 st = av_new_stream(s1, 0);223 st = avformat_new_stream(s1, NULL);
224 if (!st) {224 if (!st) {
225 return AVERROR(ENOMEM);225 return AVERROR(ENOMEM);
226 }226 }
libavformat/ipmovie.c+2−2
@@ -559,7 +559,7 @@ static int ipmovie_read_header(AVFormatContext *s, · 558 unmodified lines
559 return AVERROR_INVALIDDATA;559 return AVERROR_INVALIDDATA;
560 560
561 /* initialize the stream decoders */561 /* initialize the stream decoders */
562 st = av_new_stream(s, 0);562 st = avformat_new_stream(s, NULL);
563 if (!st)563 if (!st)
564 return AVERROR(ENOMEM);564 return AVERROR(ENOMEM);
565 av_set_pts_info(st, 63, 1, 1000000);565 av_set_pts_info(st, 63, 1, 1000000);
@@ -572,7 +572,7 @@ static int ipmovie_read_header(AVFormatContext *s, · 6 unmodified lines
572 st->codec->bits_per_coded_sample = ipmovie->video_bpp;572 st->codec->bits_per_coded_sample = ipmovie->video_bpp;
573 573
574 if (ipmovie->audio_type) {574 if (ipmovie->audio_type) {
575 st = av_new_stream(s, 0);575 st = avformat_new_stream(s, NULL);
576 if (!st)576 if (!st)
577 return AVERROR(ENOMEM);577 return AVERROR(ENOMEM);
578 av_set_pts_info(st, 32, 1, ipmovie->audio_sample_rate);578 av_set_pts_info(st, 32, 1, ipmovie->audio_sample_rate);
libavformat/iss.c+1−1
@@ -88,7 +88,7 @@ static av_cold int iss_read_header(AVFormatContext *s, AVFormatParameters *ap) · 87 unmodified lines
88 88
89 iss->sample_start_pos = avio_tell(pb);89 iss->sample_start_pos = avio_tell(pb);
90 90
91 st = av_new_stream(s, 0);91 st = avformat_new_stream(s, NULL);
92 if (!st)92 if (!st)
93 return AVERROR(ENOMEM);93 return AVERROR(ENOMEM);
94 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;94 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
libavformat/iv8.c+1−1
@@ -40,7 +40,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) · 39 unmodified lines
40{40{
41 AVStream *st;41 AVStream *st;
42 42
43 st = av_new_stream(s, 0);43 st = avformat_new_stream(s, NULL);
44 if (!st)44 if (!st)
45 return AVERROR(ENOMEM);45 return AVERROR(ENOMEM);
46 46
libavformat/ivfdec.c+1−1
@@ -40,7 +40,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) · 39 unmodified lines
40 avio_rl16(s->pb); // version40 avio_rl16(s->pb); // version
41 avio_rl16(s->pb); // header size41 avio_rl16(s->pb); // header size
42 42
43 st = av_new_stream(s, 0);43 st = avformat_new_stream(s, NULL);
44 if (!st)44 if (!st)
45 return AVERROR(ENOMEM);45 return AVERROR(ENOMEM);
46 46
libavformat/jvdec.c+2−2
@@ -69,8 +69,8 @@ static int read_header(AVFormatContext *s, · 68 unmodified lines
69 69
70 avio_skip(pb, 80);70 avio_skip(pb, 80);
71 71
72 ast = av_new_stream(s, 0);72 ast = avformat_new_stream(s, NULL);
73 vst = av_new_stream(s, 1);73 vst = avformat_new_stream(s, NULL);
74 if (!ast || !vst)74 if (!ast || !vst)
75 return AVERROR(ENOMEM);75 return AVERROR(ENOMEM);
76 76
libavformat/libnut.c+1−1
@@ -213,7 +213,7 @@ static int nut_read_header(AVFormatContext * avf, AVFormatParameters * ap) { · 212 unmodified lines
213 priv->s = s;213 priv->s = s;
214 214
215 for (i = 0; s[i].type != -1 && i < 2; i++) {215 for (i = 0; s[i].type != -1 && i < 2; i++) {
216 AVStream * st = av_new_stream(avf, i);216 AVStream * st = avformat_new_stream(avf, NULL);
217 int j;217 int j;
218 218
219 for (j = 0; j < s[i].fourcc_len && j < 8; j++) st->codec->codec_tag |= s[i].fourcc[j]<<(j*8);219 for (j = 0; j < s[i].fourcc_len && j < 8; j++) st->codec->codec_tag |= s[i].fourcc[j]<<(j*8);
libavformat/lmlm4.c+2−2
@@ -60,14 +60,14 @@ static int lmlm4_probe(AVProbeData * pd) { · 59 unmodified lines
60static int lmlm4_read_header(AVFormatContext *s, AVFormatParameters *ap) {60static int lmlm4_read_header(AVFormatContext *s, AVFormatParameters *ap) {
61 AVStream *st;61 AVStream *st;
62 62
63 if (!(st = av_new_stream(s, 0)))63 if (!(st = avformat_new_stream(s, NULL)))
64 return AVERROR(ENOMEM);64 return AVERROR(ENOMEM);
65 st->codec->codec_type = AVMEDIA_TYPE_VIDEO;65 st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
66 st->codec->codec_id = CODEC_ID_MPEG4;66 st->codec->codec_id = CODEC_ID_MPEG4;
67 st->need_parsing = AVSTREAM_PARSE_HEADERS;67 st->need_parsing = AVSTREAM_PARSE_HEADERS;
68 av_set_pts_info(st, 64, 1001, 30000);68 av_set_pts_info(st, 64, 1001, 30000);
69 69
70 if (!(st = av_new_stream(s, 1)))70 if (!(st = avformat_new_stream(s, NULL)))
71 return AVERROR(ENOMEM);71 return AVERROR(ENOMEM);
72 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;72 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
73 st->codec->codec_id = CODEC_ID_MP2;73 st->codec->codec_id = CODEC_ID_MP2;
libavformat/lxfdec.c+2−2
@@ -217,7 +217,7 @@ static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap) · 216 unmodified lines
217 if ((ret = avio_read(pb, header_data, LXF_HEADER_DATA_SIZE)) != LXF_HEADER_DATA_SIZE)217 if ((ret = avio_read(pb, header_data, LXF_HEADER_DATA_SIZE)) != LXF_HEADER_DATA_SIZE)
218 return ret < 0 ? ret : AVERROR_EOF;218 return ret < 0 ? ret : AVERROR_EOF;
219 219
220 if (!(st = av_new_stream(s, 0)))220 if (!(st = avformat_new_stream(s, NULL)))
221 return AVERROR(ENOMEM);221 return AVERROR(ENOMEM);
222 222
223 st->duration = AV_RL32(&header_data[32]);223 st->duration = AV_RL32(&header_data[32]);
@@ -243,7 +243,7 @@ static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap) · 19 unmodified lines
243 av_log(s, AV_LOG_WARNING, "VBI data not yet supported\n");243 av_log(s, AV_LOG_WARNING, "VBI data not yet supported\n");
244 244
245 if ((lxf->channels = (disk_params >> 2) & 0xF)) {245 if ((lxf->channels = (disk_params >> 2) & 0xF)) {
246 if (!(st = av_new_stream(s, 1)))246 if (!(st = avformat_new_stream(s, NULL)))
247 return AVERROR(ENOMEM);247 return AVERROR(ENOMEM);
248 248
249 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;249 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
libavformat/matroskadec.c+2−2
@@ -1444,7 +1444,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) · 1443 unmodified lines
1444 }1444 }
1445 }1445 }
1446 1446
1447 st = track->stream = av_new_stream(s, 0);1447 st = track->stream = avformat_new_stream(s, NULL);
1448 if (st == NULL)1448 if (st == NULL)
1449 return AVERROR(ENOMEM);1449 return AVERROR(ENOMEM);
1450 1450
@@ -1639,7 +1639,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) · 188 unmodified lines
1639 attachements[j].bin.data && attachements[j].bin.size > 0)) {1639 attachements[j].bin.data && attachements[j].bin.size > 0)) {
1640 av_log(matroska->ctx, AV_LOG_ERROR, "incomplete attachment\n");1640 av_log(matroska->ctx, AV_LOG_ERROR, "incomplete attachment\n");
1641 } else {1641 } else {
1642 AVStream *st = av_new_stream(s, 0);1642 AVStream *st = avformat_new_stream(s, NULL);
1643 if (st == NULL)1643 if (st == NULL)
1644 break;1644 break;
1645 av_dict_set(&st->metadata, "filename",attachements[j].filename, 0);1645 av_dict_set(&st->metadata, "filename",attachements[j].filename, 0);
libavformat/mm.c+2−2
@@ -105,7 +105,7 @@ static int read_header(AVFormatContext *s, · 104 unmodified lines
105 avio_skip(pb, length - 10); /* unknown data */105 avio_skip(pb, length - 10); /* unknown data */
106 106
107 /* video stream */107 /* video stream */
108 st = av_new_stream(s, 0);108 st = avformat_new_stream(s, NULL);
109 if (!st)109 if (!st)
110 return AVERROR(ENOMEM);110 return AVERROR(ENOMEM);
111 st->codec->codec_type = AVMEDIA_TYPE_VIDEO;111 st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
@@ -117,7 +117,7 @@ static int read_header(AVFormatContext *s, · 5 unmodified lines
117 117
118 /* audio stream */118 /* audio stream */
119 if (length == MM_HEADER_LEN_AV) {119 if (length == MM_HEADER_LEN_AV) {
120 st = av_new_stream(s, 0);120 st = avformat_new_stream(s, NULL);
121 if (!st)121 if (!st)
122 return AVERROR(ENOMEM);122 return AVERROR(ENOMEM);
123 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;123 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
libavformat/mmf.c+1−1
@@ -241,7 +241,7 @@ static int mmf_read_header(AVFormatContext *s, · 240 unmodified lines
241 }241 }
242 mmf->data_size = size;242 mmf->data_size = size;
243 243
244 st = av_new_stream(s, 0);244 st = avformat_new_stream(s, NULL);
245 if (!st)245 if (!st)
246 return AVERROR(ENOMEM);246 return AVERROR(ENOMEM);
247 247
libavformat/mov.c+2−1
@@ -1843,8 +1843,9 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 1842 unmodified lines
1843 MOVStreamContext *sc;1843 MOVStreamContext *sc;
1844 int ret;1844 int ret;
1845 1845
1846 st = av_new_stream(c->fc, c->fc->nb_streams);1846 st = avformat_new_stream(c->fc, NULL);
1847 if (!st) return AVERROR(ENOMEM);1847 if (!st) return AVERROR(ENOMEM);
1848 st->id = c->fc->nb_streams;
1848 sc = av_mallocz(sizeof(MOVStreamContext));1849 sc = av_mallocz(sizeof(MOVStreamContext));
1849 if (!sc) return AVERROR(ENOMEM);1850 if (!sc) return AVERROR(ENOMEM);
1850 1851
libavformat/mp3dec.c+1−1
@@ -137,7 +137,7 @@ static int mp3_read_header(AVFormatContext *s, · 136 unmodified lines
137 AVStream *st;137 AVStream *st;
138 int64_t off;138 int64_t off;
139 139
140 st = av_new_stream(s, 0);140 st = avformat_new_stream(s, NULL);
141 if (!st)141 if (!st)
142 return AVERROR(ENOMEM);142 return AVERROR(ENOMEM);
143 143
libavformat/mpc.c+1−1
@@ -84,7 +84,7 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap) · 83 unmodified lines
84 c->curbits = 8;84 c->curbits = 8;
85 c->frames_noted = 0;85 c->frames_noted = 0;
86 86
87 st = av_new_stream(s, 0);87 st = avformat_new_stream(s, NULL);
88 if (!st)88 if (!st)
89 return AVERROR(ENOMEM);89 return AVERROR(ENOMEM);
90 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;90 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
libavformat/mpc8.c+1−1
@@ -222,7 +222,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap) · 221 unmodified lines
222 c->samples = ffio_read_varlen(pb);222 c->samples = ffio_read_varlen(pb);
223 ffio_read_varlen(pb); //silence samples at the beginning223 ffio_read_varlen(pb); //silence samples at the beginning
224 224
225 st = av_new_stream(s, 0);225 st = avformat_new_stream(s, NULL);
226 if (!st)226 if (!st)
227 return AVERROR(ENOMEM);227 return AVERROR(ENOMEM);
228 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;228 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
libavformat/mpeg.c+2−1
@@ -537,9 +537,10 @@ static int mpegps_read_packet(AVFormatContext *s, · 536 unmodified lines
537 goto redo;537 goto redo;
538 }538 }
539 /* no stream found: add a new stream */539 /* no stream found: add a new stream */
540 st = av_new_stream(s, startcode);540 st = avformat_new_stream(s, NULL);
541 if (!st)541 if (!st)
542 goto skip;542 goto skip;
543 st->id = startcode;
543 st->codec->codec_type = type;544 st->codec->codec_type = type;
544 st->codec->codec_id = codec_id;545 st->codec->codec_id = codec_id;
545 st->request_probe = request_probe;546 st->request_probe = request_probe;
libavformat/mpegts.c+13−7
@@ -620,12 +620,13 @@ static int mpegts_set_stream_info(AVStream *st, PESContext *pes, · 619 unmodified lines
620 return AVERROR(ENOMEM);620 return AVERROR(ENOMEM);
621 memcpy(sub_pes, pes, sizeof(*sub_pes));621 memcpy(sub_pes, pes, sizeof(*sub_pes));
622 622
623 sub_st = av_new_stream(pes->stream, pes->pid);623 sub_st = avformat_new_stream(pes->stream, NULL);
624 if (!sub_st) {624 if (!sub_st) {
625 av_free(sub_pes);625 av_free(sub_pes);
626 return AVERROR(ENOMEM);626 return AVERROR(ENOMEM);
627 }627 }
628 628
629 sub_st->id = pes->pid;
629 av_set_pts_info(sub_st, 33, 1, 90000);630 av_set_pts_info(sub_st, 33, 1, 90000);
630 sub_st->priv_data = sub_pes;631 sub_st->priv_data = sub_pes;
631 sub_st->codec->codec_type = AVMEDIA_TYPE_AUDIO;632 sub_st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
@@ -726,9 +727,10 @@ static int mpegts_push_data(MpegTSFilter *filter, · 94 unmodified lines
726 727
727 /* stream not present in PMT */728 /* stream not present in PMT */
728 if (!pes->st) {729 if (!pes->st) {
729 pes->st = av_new_stream(ts->stream, pes->pid);730 pes->st = avformat_new_stream(ts->stream, NULL);
730 if (!pes->st)731 if (!pes->st)
731 return AVERROR(ENOMEM);732 return AVERROR(ENOMEM);
733 pes->st->id = pes->pid;
732 mpegts_set_stream_info(pes->st, pes, 0, 0);734 mpegts_set_stream_info(pes->st, pes, 0, 0);
733 }735 }
734 736
@@ -1120,14 +1122,18 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len · 385 unmodified lines
1120 /* now create ffmpeg stream */1122 /* now create ffmpeg stream */
1121 if (ts->pids[pid] && ts->pids[pid]->type == MPEGTS_PES) {1123 if (ts->pids[pid] && ts->pids[pid]->type == MPEGTS_PES) {
1122 pes = ts->pids[pid]->u.pes_filter.opaque;1124 pes = ts->pids[pid]->u.pes_filter.opaque;
1123 if (!pes->st)1125 if (!pes->st) {
1124 pes->st = av_new_stream(pes->stream, pes->pid);1126 pes->st = avformat_new_stream(pes->stream, NULL);
1127 st->id = pes->pid;
1128 }
1125 st = pes->st;1129 st = pes->st;
1126 } else {1130 } else {
1127 if (ts->pids[pid]) mpegts_close_filter(ts, ts->pids[pid]); //wrongly added sdt filter probably1131 if (ts->pids[pid]) mpegts_close_filter(ts, ts->pids[pid]); //wrongly added sdt filter probably
1128 pes = add_pes_stream(ts, pid, pcr_pid);1132 pes = add_pes_stream(ts, pid, pcr_pid);
1129 if (pes)1133 if (pes) {
1130 st = av_new_stream(pes->stream, pes->pid);1134 st = avformat_new_stream(pes->stream, NULL);
1135 st->id = pes->pid;
1136 }
1131 }1137 }
1132 1138
1133 if (!st)1139 if (!st)
@@ -1594,7 +1600,7 @@ static int mpegts_read_header(AVFormatContext *s, · 460 unmodified lines
1594 1600
1595 /* only read packets */1601 /* only read packets */
1596 1602
1597 st = av_new_stream(s, 0);1603 st = avformat_new_stream(s, NULL);
1598 if (!st)1604 if (!st)
1599 goto fail;1605 goto fail;
1600 av_set_pts_info(st, 60, 1, 27000000);1606 av_set_pts_info(st, 60, 1, 27000000);
libavformat/msnwc_tcp.c+1−1
@@ -75,7 +75,7 @@ static int msnwc_tcp_read_header(AVFormatContext *ctx, AVFormatParameters *ap) · 74 unmodified lines
75 AVCodecContext *codec;75 AVCodecContext *codec;
76 AVStream *st;76 AVStream *st;
77 77
78 st = av_new_stream(ctx, 0);78 st = avformat_new_stream(ctx, NULL);
79 if(!st)79 if(!st)
80 return AVERROR(ENOMEM);80 return AVERROR(ENOMEM);
81 81
libavformat/mtv.c+4−6
@@ -32,8 +32,6 @@ · 31 unmodified lines
32#define MTV_HEADER_SIZE 51232#define MTV_HEADER_SIZE 512
33#define MTV_AUDIO_PADDING_SIZE 1233#define MTV_AUDIO_PADDING_SIZE 12
34#define AUDIO_SAMPLING_RATE 4410034#define AUDIO_SAMPLING_RATE 44100
35#define VIDEO_SID 0
36#define AUDIO_SID 1
37 35
38typedef struct MTVDemuxContext {36typedef struct MTVDemuxContext {
39 37
@@ -118,7 +116,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) · 78 unmodified lines
118 116
119 // video - raw rgb565117 // video - raw rgb565
120 118
121 st = av_new_stream(s, VIDEO_SID);119 st = avformat_new_stream(s, NULL);
122 if(!st)120 if(!st)
123 return AVERROR(ENOMEM);121 return AVERROR(ENOMEM);
124 122
@@ -134,7 +132,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) · 9 unmodified lines
134 132
135 // audio - mp3133 // audio - mp3
136 134
137 st = av_new_stream(s, AUDIO_SID);135 st = avformat_new_stream(s, NULL);
138 if(!st)136 if(!st)
139 return AVERROR(ENOMEM);137 return AVERROR(ENOMEM);
140 138
@@ -171,7 +169,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt) · 30 unmodified lines
171 return ret;169 return ret;
172 170
173 pkt->pos -= MTV_AUDIO_PADDING_SIZE;171 pkt->pos -= MTV_AUDIO_PADDING_SIZE;
174 pkt->stream_index = AUDIO_SID;172 pkt->stream_index = 1;
175 173
176 }else174 }else
177 {175 {
@@ -190,7 +188,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt) · 12 unmodified lines
190 for(i=0;i<mtv->img_segment_size/2;i++)188 for(i=0;i<mtv->img_segment_size/2;i++)
191 *((uint16_t *)pkt->data+i) = av_bswap16(*((uint16_t *)pkt->data+i));189 *((uint16_t *)pkt->data+i) = av_bswap16(*((uint16_t *)pkt->data+i));
192#endif190#endif
193 pkt->stream_index = VIDEO_SID;191 pkt->stream_index = 0;
194 }192 }
195 193
196 return ret;194 return ret;
libavformat/mvi.c+2−2
@@ -42,11 +42,11 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) · 41 unmodified lines
42 AVStream *ast, *vst;42 AVStream *ast, *vst;
43 unsigned int version, frames_count, msecs_per_frame, player_version;43 unsigned int version, frames_count, msecs_per_frame, player_version;
44 44
45 ast = av_new_stream(s, 0);45 ast = avformat_new_stream(s, NULL);
46 if (!ast)46 if (!ast)
47 return AVERROR(ENOMEM);47 return AVERROR(ENOMEM);
48 48
49 vst = av_new_stream(s, 0);49 vst = avformat_new_stream(s, NULL);
50 if (!vst)50 if (!vst)
51 return AVERROR(ENOMEM);51 return AVERROR(ENOMEM);
52 52
libavformat/mxfdec.c+2−1
@@ -852,11 +852,12 @@ static int mxf_parse_structural_metadata(MXFContext *mxf) · 851 unmodified lines
852 if (!source_track)852 if (!source_track)
853 continue;853 continue;
854 854
855 st = av_new_stream(mxf->fc, source_track->track_id);855 st = avformat_new_stream(mxf->fc, NULL);
856 if (!st) {856 if (!st) {
857 av_log(mxf->fc, AV_LOG_ERROR, "could not allocate stream\n");857 av_log(mxf->fc, AV_LOG_ERROR, "could not allocate stream\n");
858 return -1;858 return -1;
859 }859 }
860 st->id = source_track->track_id;
860 st->priv_data = source_track;861 st->priv_data = source_track;
861 st->duration = component->duration;862 st->duration = component->duration;
862 if (st->duration == -1)863 if (st->duration == -1)
libavformat/mxg.c+4−6
@@ -24,8 +24,6 @@ · 23 unmodified lines
24#include "avformat.h"24#include "avformat.h"
25#include "avio.h"25#include "avio.h"
26 26
27#define VIDEO_STREAM_INDEX 0
28#define AUDIO_STREAM_INDEX 1
29#define DEFAULT_PACKET_SIZE 102427#define DEFAULT_PACKET_SIZE 1024
30#define OVERREAD_SIZE 328#define OVERREAD_SIZE 3
31 29
@@ -44,14 +42,14 @@ static int mxg_read_header(AVFormatContext *s, AVFormatParameters *ap) · 12 unmodified lines
44 MXGContext *mxg = s->priv_data;42 MXGContext *mxg = s->priv_data;
45 43
46 /* video parameters will be extracted from the compressed bitstream */44 /* video parameters will be extracted from the compressed bitstream */
47 video_st = av_new_stream(s, VIDEO_STREAM_INDEX);45 video_st = avformat_new_stream(s, NULL);
48 if (!video_st)46 if (!video_st)
49 return AVERROR(ENOMEM);47 return AVERROR(ENOMEM);
50 video_st->codec->codec_type = AVMEDIA_TYPE_VIDEO;48 video_st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
51 video_st->codec->codec_id = CODEC_ID_MXPEG;49 video_st->codec->codec_id = CODEC_ID_MXPEG;
52 av_set_pts_info(video_st, 64, 1, 1000000);50 av_set_pts_info(video_st, 64, 1, 1000000);
53 51
54 audio_st = av_new_stream(s, AUDIO_STREAM_INDEX);52 audio_st = avformat_new_stream(s, NULL);
55 if (!audio_st)53 if (!audio_st)
56 return AVERROR(ENOMEM);54 return AVERROR(ENOMEM);
57 audio_st->codec->codec_type = AVMEDIA_TYPE_AUDIO;55 audio_st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
@@ -166,7 +164,7 @@ static int mxg_read_packet(AVFormatContext *s, AVPacket *pkt) · 108 unmodified lines
166 }164 }
167 165
168 pkt->pts = pkt->dts = mxg->dts;166 pkt->pts = pkt->dts = mxg->dts;
169 pkt->stream_index = VIDEO_STREAM_INDEX;167 pkt->stream_index = 0;
170 pkt->destruct = NULL;168 pkt->destruct = NULL;
171 pkt->size = mxg->buffer_ptr - mxg->soi_ptr;169 pkt->size = mxg->buffer_ptr - mxg->soi_ptr;
172 pkt->data = mxg->soi_ptr;170 pkt->data = mxg->soi_ptr;
@@ -204,7 +202,7 @@ static int mxg_read_packet(AVFormatContext *s, AVPacket *pkt) · 31 unmodified lines
204 if (marker == APP13 && size >= 16) { /* audio data */202 if (marker == APP13 && size >= 16) { /* audio data */
205 /* time (GMT) of first sample in usec since 1970, little-endian */203 /* time (GMT) of first sample in usec since 1970, little-endian */
206 pkt->pts = pkt->dts = AV_RL64(startmarker_ptr + 8);204 pkt->pts = pkt->dts = AV_RL64(startmarker_ptr + 8);
207 pkt->stream_index = AUDIO_STREAM_INDEX;205 pkt->stream_index = 1;
208 pkt->destruct = NULL;206 pkt->destruct = NULL;
209 pkt->size = size - 14;207 pkt->size = size - 14;
210 pkt->data = startmarker_ptr + 16;208 pkt->data = startmarker_ptr + 16;
libavformat/ncdec.c+1−1
@@ -45,7 +45,7 @@ static int nc_probe(AVProbeData *probe_packet) · 44 unmodified lines
45 45
46static int nc_read_header(AVFormatContext *s, AVFormatParameters *ap)46static int nc_read_header(AVFormatContext *s, AVFormatParameters *ap)
47{47{
48 AVStream *st = av_new_stream(s, 0);48 AVStream *st = avformat_new_stream(s, NULL);
49 49
50 if (!st)50 if (!st)
51 return AVERROR(ENOMEM);51 return AVERROR(ENOMEM);
libavformat/nsvdec.c+4−2
@@ -438,10 +438,11 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap) · 437 unmodified lines
438 nsv->vheight = vwidth;438 nsv->vheight = vwidth;
439 if (vtag != T_NONE) {439 if (vtag != T_NONE) {
440 int i;440 int i;
441 st = av_new_stream(s, NSV_ST_VIDEO);441 st = avformat_new_stream(s, NULL);
442 if (!st)442 if (!st)
443 goto fail;443 goto fail;
444 444
445 st->id = NSV_ST_VIDEO;
445 nst = av_mallocz(sizeof(NSVStream));446 nst = av_mallocz(sizeof(NSVStream));
446 if (!nst)447 if (!nst)
447 goto fail;448 goto fail;
@@ -469,10 +470,11 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap) · 21 unmodified lines
469 }470 }
470 if (atag != T_NONE) {471 if (atag != T_NONE) {
471#ifndef DISABLE_AUDIO472#ifndef DISABLE_AUDIO
472 st = av_new_stream(s, NSV_ST_AUDIO);473 st = avformat_new_stream(s, NULL);
473 if (!st)474 if (!st)
474 goto fail;475 goto fail;
475 476
477 st->id = NSV_ST_AUDIO;
476 nst = av_mallocz(sizeof(NSVStream));478 nst = av_mallocz(sizeof(NSVStream));
477 if (!nst)479 if (!nst)
478 goto fail;480 goto fail;
libavformat/nutdec.c+1−1
@@ -288,7 +288,7 @@ static int decode_main_header(NUTContext *nut){ · 287 unmodified lines
288 288
289 nut->stream = av_mallocz(sizeof(StreamContext)*stream_count);289 nut->stream = av_mallocz(sizeof(StreamContext)*stream_count);
290 for(i=0; i<stream_count; i++){290 for(i=0; i<stream_count; i++){
291 av_new_stream(s, i);291 avformat_new_stream(s, NULL);
292 }292 }
293 293
294 return 0;294 return 0;
libavformat/nuv.c+2−2
@@ -153,7 +153,7 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) { · 152 unmodified lines
153 153
154 if (v_packs) {154 if (v_packs) {
155 ctx->v_id = stream_nr++;155 ctx->v_id = stream_nr++;
156 vst = av_new_stream(s, ctx->v_id);156 vst = avformat_new_stream(s, NULL);
157 if (!vst)157 if (!vst)
158 return AVERROR(ENOMEM);158 return AVERROR(ENOMEM);
159 vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;159 vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
@@ -169,7 +169,7 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) { · 9 unmodified lines
169 169
170 if (a_packs) {170 if (a_packs) {
171 ctx->a_id = stream_nr++;171 ctx->a_id = stream_nr++;
172 ast = av_new_stream(s, ctx->a_id);172 ast = avformat_new_stream(s, NULL);
173 if (!ast)173 if (!ast)
174 return AVERROR(ENOMEM);174 return AVERROR(ENOMEM);
175 ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;175 ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
libavformat/oggdec.c+2−1
@@ -171,10 +171,11 @@ static int ogg_new_stream(AVFormatContext *s, uint32_t serial, int new_avstream) · 170 unmodified lines
171 os->header = -1;171 os->header = -1;
172 172
173 if (new_avstream) {173 if (new_avstream) {
174 st = av_new_stream(s, idx);174 st = avformat_new_stream(s, NULL);
175 if (!st)175 if (!st)
176 return AVERROR(ENOMEM);176 return AVERROR(ENOMEM);
177 177
178 st->id = idx;
178 av_set_pts_info(st, 64, 1, 1000000);179 av_set_pts_info(st, 64, 1, 1000000);
179 }180 }
180 181
libavformat/oma.c+1−1
@@ -307,7 +307,7 @@ static int oma_read_header(AVFormatContext *s, · 306 unmodified lines
307 307
308 codec_params = AV_RB24(&buf[33]);308 codec_params = AV_RB24(&buf[33]);
309 309
310 st = av_new_stream(s, 0);310 st = avformat_new_stream(s, NULL);
311 if (!st)311 if (!st)
312 return AVERROR(ENOMEM);312 return AVERROR(ENOMEM);
313 313
libavformat/psxstr.c+2−2
@@ -196,7 +196,7 @@ static int str_read_packet(AVFormatContext *s, · 195 unmodified lines
196 196
197 if(str->channels[channel].video_stream_index < 0){197 if(str->channels[channel].video_stream_index < 0){
198 /* allocate a new AVStream */198 /* allocate a new AVStream */
199 st = av_new_stream(s, 0);199 st = avformat_new_stream(s, NULL);
200 if (!st)200 if (!st)
201 return AVERROR(ENOMEM);201 return AVERROR(ENOMEM);
202 av_set_pts_info(st, 64, 1, 15);202 av_set_pts_info(st, 64, 1, 15);
@@ -244,7 +244,7 @@ static int str_read_packet(AVFormatContext *s, · 41 unmodified lines
244 if(str->channels[channel].audio_stream_index < 0){244 if(str->channels[channel].audio_stream_index < 0){
245 int fmt = sector[0x13];245 int fmt = sector[0x13];
246 /* allocate a new AVStream */246 /* allocate a new AVStream */
247 st = av_new_stream(s, 0);247 st = avformat_new_stream(s, NULL);
248 if (!st)248 if (!st)
249 return AVERROR(ENOMEM);249 return AVERROR(ENOMEM);
250 250
libavformat/pva.c+2−2
@@ -56,7 +56,7 @@ static int pva_probe(AVProbeData * pd) { · 55 unmodified lines
56static int pva_read_header(AVFormatContext *s, AVFormatParameters *ap) {56static int pva_read_header(AVFormatContext *s, AVFormatParameters *ap) {
57 AVStream *st;57 AVStream *st;
58 58
59 if (!(st = av_new_stream(s, 0)))59 if (!(st = avformat_new_stream(s, NULL)))
60 return AVERROR(ENOMEM);60 return AVERROR(ENOMEM);
61 st->codec->codec_type = AVMEDIA_TYPE_VIDEO;61 st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
62 st->codec->codec_id = CODEC_ID_MPEG2VIDEO;62 st->codec->codec_id = CODEC_ID_MPEG2VIDEO;
@@ -64,7 +64,7 @@ static int pva_read_header(AVFormatContext *s, AVFormatParameters *ap) { · 1 unmodified line
64 av_set_pts_info(st, 32, 1, 90000);64 av_set_pts_info(st, 32, 1, 90000);
65 av_add_index_entry(st, 0, 0, 0, 0, AVINDEX_KEYFRAME);65 av_add_index_entry(st, 0, 0, 0, 0, AVINDEX_KEYFRAME);
66 66
67 if (!(st = av_new_stream(s, 1)))67 if (!(st = avformat_new_stream(s, NULL)))
68 return AVERROR(ENOMEM);68 return AVERROR(ENOMEM);
69 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;69 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
70 st->codec->codec_id = CODEC_ID_MP2;70 st->codec->codec_id = CODEC_ID_MP2;
libavformat/qcp.c+1−1
@@ -84,7 +84,7 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap) · 83 unmodified lines
84{84{
85 AVIOContext *pb = s->pb;85 AVIOContext *pb = s->pb;
86 QCPContext *c = s->priv_data;86 QCPContext *c = s->priv_data;
87 AVStream *st = av_new_stream(s, 0);87 AVStream *st = avformat_new_stream(s, NULL);
88 uint8_t buf[16];88 uint8_t buf[16];
89 int i, nb_rates;89 int i, nb_rates;
90 90
libavformat/r3d.c+2−2
@@ -52,7 +52,7 @@ static int read_atom(AVFormatContext *s, Atom *atom) · 51 unmodified lines
52 52
53static int r3d_read_red1(AVFormatContext *s)53static int r3d_read_red1(AVFormatContext *s)
54{54{
55 AVStream *st = av_new_stream(s, 0);55 AVStream *st = avformat_new_stream(s, NULL);
56 char filename[258];56 char filename[258];
57 int tmp;57 int tmp;
58 int av_unused tmp2;58 int av_unused tmp2;
@@ -89,7 +89,7 @@ static int r3d_read_red1(AVFormatContext *s) · 30 unmodified lines
89 tmp = avio_r8(s->pb); // audio channels89 tmp = avio_r8(s->pb); // audio channels
90 av_dlog(s, "audio channels %d\n", tmp);90 av_dlog(s, "audio channels %d\n", tmp);
91 if (tmp > 0) {91 if (tmp > 0) {
92 AVStream *ast = av_new_stream(s, 1);92 AVStream *ast = avformat_new_stream(s, NULL);
93 if (!ast)93 if (!ast)
94 return AVERROR(ENOMEM);94 return AVERROR(ENOMEM);
95 ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;95 ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
libavformat/rawdec.c+3−3
@@ -33,7 +33,7 @@ int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap) · 32 unmodified lines
33 AVStream *st;33 AVStream *st;
34 enum CodecID id;34 enum CodecID id;
35 35
36 st = av_new_stream(s, 0);36 st = avformat_new_stream(s, NULL);
37 if (!st)37 if (!st)
38 return AVERROR(ENOMEM);38 return AVERROR(ENOMEM);
39 39
@@ -122,7 +122,7 @@ int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt) · 82 unmodified lines
122int ff_raw_audio_read_header(AVFormatContext *s,122int ff_raw_audio_read_header(AVFormatContext *s,
123 AVFormatParameters *ap)123 AVFormatParameters *ap)
124{124{
125 AVStream *st = av_new_stream(s, 0);125 AVStream *st = avformat_new_stream(s, NULL);
126 if (!st)126 if (!st)
127 return AVERROR(ENOMEM);127 return AVERROR(ENOMEM);
128 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;128 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
@@ -144,7 +144,7 @@ int ff_raw_video_read_header(AVFormatContext *s, · 15 unmodified lines
144 int ret = 0;144 int ret = 0;
145 145
146 146
147 st = av_new_stream(s, 0);147 st = avformat_new_stream(s, NULL);
148 if (!st) {148 if (!st) {
149 ret = AVERROR(ENOMEM);149 ret = AVERROR(ENOMEM);
150 goto fail;150 goto fail;
libavformat/rdt.c+2−1
@@ -459,8 +459,9 @@ add_dstream(AVFormatContext *s, AVStream *orig_st) · 458 unmodified lines
459{459{
460 AVStream *st;460 AVStream *st;
461 461
462 if (!(st = av_new_stream(s, orig_st->id)))462 if (!(st = avformat_new_stream(s, NULL)))
463 return NULL;463 return NULL;
464 st->id = orig_st->id;
464 st->codec->codec_type = orig_st->codec->codec_type;465 st->codec->codec_type = orig_st->codec->codec_type;
465 st->first_dts = orig_st->first_dts;466 st->first_dts = orig_st->first_dts;
466 467
libavformat/riff.c+2−2
@@ -281,10 +281,10 @@ const AVCodecTag ff_codec_bmp_tags[] = { · 280 unmodified lines
281 { CODEC_ID_G2M, MKTAG('G', '2', 'M', '3') },281 { CODEC_ID_G2M, MKTAG('G', '2', 'M', '3') },
282 { CODEC_ID_G2M, MKTAG('G', '2', 'M', '4') },282 { CODEC_ID_G2M, MKTAG('G', '2', 'M', '4') },
283 { CODEC_ID_AMV, MKTAG('A', 'M', 'V', 'F') },283 { CODEC_ID_AMV, MKTAG('A', 'M', 'V', 'F') },
284 { CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'R', 'A') },
285 { CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'R', 'G') },
284 { CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'Y', '0') },286 { CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'Y', '0') },
285 { CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'Y', '2') },287 { CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'Y', '2') },
286 { CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'R', 'G') },
287 { CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'R', 'A') },
288 { CODEC_ID_NONE, 0 }288 { CODEC_ID_NONE, 0 }
289};289};
290 290
libavformat/rl2.c+2−2
@@ -110,7 +110,7 @@ static av_cold int rl2_read_header(AVFormatContext *s, · 109 unmodified lines
110 def_sound_size = avio_rl16(pb);110 def_sound_size = avio_rl16(pb);
111 111
112 /** setup video stream */112 /** setup video stream */
113 st = av_new_stream(s, 0);113 st = avformat_new_stream(s, NULL);
114 if(!st)114 if(!st)
115 return AVERROR(ENOMEM);115 return AVERROR(ENOMEM);
116 116
@@ -140,7 +140,7 @@ static av_cold int rl2_read_header(AVFormatContext *s, · 23 unmodified lines
140 pts_num = def_sound_size;140 pts_num = def_sound_size;
141 pts_den = rate;141 pts_den = rate;
142 142
143 st = av_new_stream(s, 0);143 st = avformat_new_stream(s, NULL);
144 if (!st)144 if (!st)
145 return AVERROR(ENOMEM);145 return AVERROR(ENOMEM);
146 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;146 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
libavformat/rmdec.c+2−2
@@ -397,7 +397,7 @@ static int rm_read_header_old(AVFormatContext *s) · 396 unmodified lines
397 AVStream *st;397 AVStream *st;
398 398
399 rm->old_format = 1;399 rm->old_format = 1;
400 st = av_new_stream(s, 0);400 st = avformat_new_stream(s, NULL);
401 if (!st)401 if (!st)
402 return -1;402 return -1;
403 st->priv_data = ff_rm_alloc_rmstream();403 st->priv_data = ff_rm_alloc_rmstream();
@@ -463,7 +463,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) · 59 unmodified lines
463 rm_read_metadata(s, 1);463 rm_read_metadata(s, 1);
464 break;464 break;
465 case MKTAG('M', 'D', 'P', 'R'):465 case MKTAG('M', 'D', 'P', 'R'):
466 st = av_new_stream(s, 0);466 st = avformat_new_stream(s, NULL);
467 if (!st)467 if (!st)
468 return AVERROR(ENOMEM);468 return AVERROR(ENOMEM);
469 st->id = avio_rb16(pb);469 st->id = avio_rb16(pb);
libavformat/rpl.c+2−2
@@ -139,7 +139,7 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap) · 138 unmodified lines
139 av_dict_set(&s->metadata, "author" , line, 0);139 av_dict_set(&s->metadata, "author" , line, 0);
140 140
141 // video headers141 // video headers
142 vst = av_new_stream(s, 0);142 vst = avformat_new_stream(s, NULL);
143 if (!vst)143 if (!vst)
144 return AVERROR(ENOMEM);144 return AVERROR(ENOMEM);
145 vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;145 vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
@@ -181,7 +181,7 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap) · 35 unmodified lines
181 // samples, though. This code will ignore additional tracks.181 // samples, though. This code will ignore additional tracks.
182 audio_format = read_line_and_int(pb, &error); // audio format ID182 audio_format = read_line_and_int(pb, &error); // audio format ID
183 if (audio_format) {183 if (audio_format) {
184 ast = av_new_stream(s, 0);184 ast = avformat_new_stream(s, NULL);
185 if (!ast)185 if (!ast)
186 return AVERROR(ENOMEM);186 return AVERROR(ENOMEM);
187 ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;187 ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
libavformat/rsodec.c+1−1
@@ -54,7 +54,7 @@ static int rso_read_header(AVFormatContext *s, AVFormatParameters *ap) · 53 unmodified lines
54 }54 }
55 55
56 /* now we are ready: build format streams */56 /* now we are ready: build format streams */
57 st = av_new_stream(s, 0);57 st = avformat_new_stream(s, NULL);
58 if (!st)58 if (!st)
59 return AVERROR(ENOMEM);59 return AVERROR(ENOMEM);
60 60
libavformat/rtpenc_chain.c+1−1
@@ -43,7 +43,7 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st, · 42 unmodified lines
43 return NULL;43 return NULL;
44 44
45 rtpctx->oformat = rtp_format;45 rtpctx->oformat = rtp_format;
46 if (!av_new_stream(rtpctx, 0)) {46 if (!avformat_new_stream(rtpctx, NULL)) {
47 av_free(rtpctx);47 av_free(rtpctx);
48 return NULL;48 return NULL;
49 }49 }
libavformat/rtsp.c+2−1
@@ -357,9 +357,10 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, · 356 unmodified lines
357 if (!strcmp(ff_rtp_enc_name(rtsp_st->sdp_payload_type), "MP2T")) {357 if (!strcmp(ff_rtp_enc_name(rtsp_st->sdp_payload_type), "MP2T")) {
358 /* no corresponding stream */358 /* no corresponding stream */
359 } else {359 } else {
360 st = av_new_stream(s, rt->nb_rtsp_streams - 1);360 st = avformat_new_stream(s, NULL);
361 if (!st)361 if (!st)
362 return;362 return;
363 st->id = rt->nb_rtsp_streams - 1;
363 rtsp_st->stream_index = st->index;364 rtsp_st->stream_index = st->index;
364 st->codec->codec_type = codec_type;365 st->codec->codec_type = codec_type;
365 if (rtsp_st->sdp_payload_type < RTP_PT_PRIVATE) {366 if (rtsp_st->sdp_payload_type < RTP_PT_PRIVATE) {
libavformat/sapdec.c+4−2
@@ -163,11 +163,12 @@ static int sap_read_header(AVFormatContext *s, · 162 unmodified lines
163 if (sap->sdp_ctx->ctx_flags & AVFMTCTX_NOHEADER)163 if (sap->sdp_ctx->ctx_flags & AVFMTCTX_NOHEADER)
164 s->ctx_flags |= AVFMTCTX_NOHEADER;164 s->ctx_flags |= AVFMTCTX_NOHEADER;
165 for (i = 0; i < sap->sdp_ctx->nb_streams; i++) {165 for (i = 0; i < sap->sdp_ctx->nb_streams; i++) {
166 AVStream *st = av_new_stream(s, i);166 AVStream *st = avformat_new_stream(s, NULL);
167 if (!st) {167 if (!st) {
168 ret = AVERROR(ENOMEM);168 ret = AVERROR(ENOMEM);
169 goto fail;169 goto fail;
170 }170 }
171 st->id = i;
171 avcodec_copy_context(st->codec, sap->sdp_ctx->streams[i]->codec);172 avcodec_copy_context(st->codec, sap->sdp_ctx->streams[i]->codec);
172 st->time_base = sap->sdp_ctx->streams[i]->time_base;173 st->time_base = sap->sdp_ctx->streams[i]->time_base;
173 }174 }
@@ -211,11 +212,12 @@ static int sap_fetch_packet(AVFormatContext *s, AVPacket *pkt) · 37 unmodified lines
211 if (s->ctx_flags & AVFMTCTX_NOHEADER) {212 if (s->ctx_flags & AVFMTCTX_NOHEADER) {
212 while (sap->sdp_ctx->nb_streams > s->nb_streams) {213 while (sap->sdp_ctx->nb_streams > s->nb_streams) {
213 int i = s->nb_streams;214 int i = s->nb_streams;
214 AVStream *st = av_new_stream(s, i);215 AVStream *st = avformat_new_stream(s, NULL);
215 if (!st) {216 if (!st) {
216 av_free_packet(pkt);217 av_free_packet(pkt);
217 return AVERROR(ENOMEM);218 return AVERROR(ENOMEM);
218 }219 }
220 st->id = i;
219 avcodec_copy_context(st->codec, sap->sdp_ctx->streams[i]->codec);221 avcodec_copy_context(st->codec, sap->sdp_ctx->streams[i]->codec);
220 st->time_base = sap->sdp_ctx->streams[i]->time_base;222 st->time_base = sap->sdp_ctx->streams[i]->time_base;
221 }223 }
libavformat/segafilm.c+2−2
@@ -134,7 +134,7 @@ static int film_read_header(AVFormatContext *s, · 133 unmodified lines
134 134
135 /* initialize the decoder streams */135 /* initialize the decoder streams */
136 if (film->video_type) {136 if (film->video_type) {
137 st = av_new_stream(s, 0);137 st = avformat_new_stream(s, NULL);
138 if (!st)138 if (!st)
139 return AVERROR(ENOMEM);139 return AVERROR(ENOMEM);
140 film->video_stream_index = st->index;140 film->video_stream_index = st->index;
@@ -146,7 +146,7 @@ static int film_read_header(AVFormatContext *s, · 5 unmodified lines
146 }146 }
147 147
148 if (film->audio_type) {148 if (film->audio_type) {
149 st = av_new_stream(s, 0);149 st = avformat_new_stream(s, NULL);
150 if (!st)150 if (!st)
151 return AVERROR(ENOMEM);151 return AVERROR(ENOMEM);
152 film->audio_stream_index = st->index;152 film->audio_stream_index = st->index;
libavformat/sierravmd.c+2−2
@@ -104,7 +104,7 @@ static int vmd_read_header(AVFormatContext *s, · 103 unmodified lines
104 else104 else
105 vmd->is_indeo3 = 0;105 vmd->is_indeo3 = 0;
106 /* start up the decoders */106 /* start up the decoders */
107 vst = av_new_stream(s, 0);107 vst = avformat_new_stream(s, NULL);
108 if (!vst)108 if (!vst)
109 return AVERROR(ENOMEM);109 return AVERROR(ENOMEM);
110 av_set_pts_info(vst, 33, 1, 10);110 av_set_pts_info(vst, 33, 1, 10);
@@ -125,7 +125,7 @@ static int vmd_read_header(AVFormatContext *s, · 14 unmodified lines
125 /* if sample rate is 0, assume no audio */125 /* if sample rate is 0, assume no audio */
126 vmd->sample_rate = AV_RL16(&vmd->vmd_header[804]);126 vmd->sample_rate = AV_RL16(&vmd->vmd_header[804]);
127 if (vmd->sample_rate) {127 if (vmd->sample_rate) {
128 st = av_new_stream(s, 0);128 st = avformat_new_stream(s, NULL);
129 if (!st)129 if (!st)
130 return AVERROR(ENOMEM);130 return AVERROR(ENOMEM);
131 vmd->audio_stream_index = st->index;131 vmd->audio_stream_index = st->index;
libavformat/siff.c+2−2
@@ -71,7 +71,7 @@ static int siff_probe(AVProbeData *p) · 70 unmodified lines
71static int create_audio_stream(AVFormatContext *s, SIFFContext *c)71static int create_audio_stream(AVFormatContext *s, SIFFContext *c)
72{72{
73 AVStream *ast;73 AVStream *ast;
74 ast = av_new_stream(s, 0);74 ast = avformat_new_stream(s, NULL);
75 if (!ast)75 if (!ast)
76 return -1;76 return -1;
77 ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;77 ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
@@ -115,7 +115,7 @@ static int siff_parse_vbv1(AVFormatContext *s, SIFFContext *c, AVIOContext *pb) · 37 unmodified lines
115 115
116 avio_skip(pb, 16); //zeroes116 avio_skip(pb, 16); //zeroes
117 117
118 st = av_new_stream(s, 0);118 st = avformat_new_stream(s, NULL);
119 if (!st)119 if (!st)
120 return -1;120 return -1;
121 st->codec->codec_type = AVMEDIA_TYPE_VIDEO;121 st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
libavformat/smacker.c+2−2
@@ -154,7 +154,7 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap) · 153 unmodified lines
154 }154 }
155 155
156 /* init video codec */156 /* init video codec */
157 st = av_new_stream(s, 0);157 st = avformat_new_stream(s, NULL);
158 if (!st)158 if (!st)
159 return -1;159 return -1;
160 smk->videoindex = st->index;160 smk->videoindex = st->index;
@@ -177,7 +177,7 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap) · 16 unmodified lines
177 for(i = 0; i < 7; i++) {177 for(i = 0; i < 7; i++) {
178 smk->indexes[i] = -1;178 smk->indexes[i] = -1;
179 if (smk->rates[i]) {179 if (smk->rates[i]) {
180 ast[i] = av_new_stream(s, 0);180 ast[i] = avformat_new_stream(s, NULL);
181 smk->indexes[i] = ast[i]->index;181 smk->indexes[i] = ast[i]->index;
182 ast[i]->codec->codec_type = AVMEDIA_TYPE_AUDIO;182 ast[i]->codec->codec_type = AVMEDIA_TYPE_AUDIO;
183 if (smk->aflags[i] & SMK_AUD_BINKAUD) {183 if (smk->aflags[i] & SMK_AUD_BINKAUD) {
libavformat/sol.c+1−1
@@ -110,7 +110,7 @@ static int sol_read_header(AVFormatContext *s, · 109 unmodified lines
110 else id = 0;110 else id = 0;
111 111
112 /* now we are ready: build format streams */112 /* now we are ready: build format streams */
113 st = av_new_stream(s, 0);113 st = avformat_new_stream(s, NULL);
114 if (!st)114 if (!st)
115 return -1;115 return -1;
116 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;116 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
libavformat/soxdec.c+1−1
@@ -51,7 +51,7 @@ static int sox_read_header(AVFormatContext *s, · 50 unmodified lines
51 double sample_rate, sample_rate_frac;51 double sample_rate, sample_rate_frac;
52 AVStream *st;52 AVStream *st;
53 53
54 st = av_new_stream(s, 0);54 st = avformat_new_stream(s, NULL);
55 if (!st)55 if (!st)
56 return AVERROR(ENOMEM);56 return AVERROR(ENOMEM);
57 57
libavformat/spdifdec.c+1−1
@@ -205,7 +205,7 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt) · 204 unmodified lines
205 205
206 if (!s->nb_streams) {206 if (!s->nb_streams) {
207 /* first packet, create a stream */207 /* first packet, create a stream */
208 AVStream *st = av_new_stream(s, 0);208 AVStream *st = avformat_new_stream(s, NULL);
209 if (!st) {209 if (!st) {
210 av_free_packet(pkt);210 av_free_packet(pkt);
211 return AVERROR(ENOMEM);211 return AVERROR(ENOMEM);
libavformat/srtdec.c+1−1
@@ -42,7 +42,7 @@ static int srt_probe(AVProbeData *p) · 41 unmodified lines
42 42
43static int srt_read_header(AVFormatContext *s, AVFormatParameters *ap)43static int srt_read_header(AVFormatContext *s, AVFormatParameters *ap)
44{44{
45 AVStream *st = av_new_stream(s, 0);45 AVStream *st = avformat_new_stream(s, NULL);
46 if (!st)46 if (!st)
47 return -1;47 return -1;
48 av_set_pts_info(st, 64, 1, 1000);48 av_set_pts_info(st, 64, 1, 1000);
libavformat/swfdec.c+6−3
@@ -106,9 +106,10 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) · 105 unmodified lines
106 avio_rl16(pb);106 avio_rl16(pb);
107 avio_r8(pb);107 avio_r8(pb);
108 /* Check for FLV1 */108 /* Check for FLV1 */
109 vst = av_new_stream(s, ch_id);109 vst = avformat_new_stream(s, NULL);
110 if (!vst)110 if (!vst)
111 return -1;111 return -1;
112 vst->id = ch_id;
112 vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;113 vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
113 vst->codec->codec_id = ff_codec_get_id(swf_codec_tags, avio_r8(pb));114 vst->codec->codec_id = ff_codec_get_id(swf_codec_tags, avio_r8(pb));
114 av_set_pts_info(vst, 16, 256, swf->frame_rate);115 av_set_pts_info(vst, 16, 256, swf->frame_rate);
@@ -127,9 +128,10 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) · 12 unmodified lines
127 avio_r8(pb);128 avio_r8(pb);
128 v = avio_r8(pb);129 v = avio_r8(pb);
129 swf->samples_per_frame = avio_rl16(pb);130 swf->samples_per_frame = avio_rl16(pb);
130 ast = av_new_stream(s, -1); /* -1 to avoid clash with video stream ch_id */131 ast = avformat_new_stream(s, NULL);
131 if (!ast)132 if (!ast)
132 return -1;133 return -1;
134 ast->id = -1; /* -1 to avoid clash with video stream ch_id */
133 ast->codec->channels = 1 + (v&1);135 ast->codec->channels = 1 + (v&1);
134 ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;136 ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
135 ast->codec->codec_id = ff_codec_get_id(swf_audio_codec_tags, (v>>4) & 15);137 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) · 41 unmodified lines
177 break;179 break;
178 }180 }
179 if (i == s->nb_streams) {181 if (i == s->nb_streams) {
180 vst = av_new_stream(s, -2); /* -2 to avoid clash with video stream and audio stream */182 vst = avformat_new_stream(s, NULL);
181 if (!vst)183 if (!vst)
182 return -1;184 return -1;
185 vst->id = -2; /* -2 to avoid clash with video stream and audio stream */
183 vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;186 vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
184 vst->codec->codec_id = CODEC_ID_MJPEG;187 vst->codec->codec_id = CODEC_ID_MJPEG;
185 av_set_pts_info(vst, 64, 256, swf->frame_rate);188 av_set_pts_info(vst, 64, 256, swf->frame_rate);
libavformat/thp.c+2−2
@@ -94,7 +94,7 @@ static int thp_read_header(AVFormatContext *s, · 93 unmodified lines
94 break;94 break;
95 95
96 /* Video component. */96 /* Video component. */
97 st = av_new_stream(s, 0);97 st = avformat_new_stream(s, NULL);
98 if (!st)98 if (!st)
99 return AVERROR(ENOMEM);99 return AVERROR(ENOMEM);
100 100
@@ -117,7 +117,7 @@ static int thp_read_header(AVFormatContext *s, · 16 unmodified lines
117 break;117 break;
118 118
119 /* Audio component. */119 /* Audio component. */
120 st = av_new_stream(s, 0);120 st = avformat_new_stream(s, NULL);
121 if (!st)121 if (!st)
122 return AVERROR(ENOMEM);122 return AVERROR(ENOMEM);
123 123
libavformat/tiertexseq.c+2−2
@@ -206,7 +206,7 @@ static int seq_read_header(AVFormatContext *s, AVFormatParameters *ap) · 205 unmodified lines
206 seq->audio_buffer_full = 0;206 seq->audio_buffer_full = 0;
207 207
208 /* initialize the video decoder stream */208 /* initialize the video decoder stream */
209 st = av_new_stream(s, 0);209 st = avformat_new_stream(s, NULL);
210 if (!st)210 if (!st)
211 return AVERROR(ENOMEM);211 return AVERROR(ENOMEM);
212 212
@@ -219,7 +219,7 @@ static int seq_read_header(AVFormatContext *s, AVFormatParameters *ap) · 6 unmodified lines
219 st->codec->height = SEQ_FRAME_H;219 st->codec->height = SEQ_FRAME_H;
220 220
221 /* initialize the audio decoder stream */221 /* initialize the audio decoder stream */
222 st = av_new_stream(s, 0);222 st = avformat_new_stream(s, NULL);
223 if (!st)223 if (!st)
224 return AVERROR(ENOMEM);224 return AVERROR(ENOMEM);
225 225
libavformat/tmv.c+2−2
@@ -73,10 +73,10 @@ static int tmv_read_header(AVFormatContext *s, AVFormatParameters *ap) · 72 unmodified lines
73 if (avio_rl32(pb) != TMV_TAG)73 if (avio_rl32(pb) != TMV_TAG)
74 return -1;74 return -1;
75 75
76 if (!(vst = av_new_stream(s, 0)))76 if (!(vst = avformat_new_stream(s, NULL)))
77 return AVERROR(ENOMEM);77 return AVERROR(ENOMEM);
78 78
79 if (!(ast = av_new_stream(s, 0)))79 if (!(ast = avformat_new_stream(s, NULL)))
80 return AVERROR(ENOMEM);80 return AVERROR(ENOMEM);
81 81
82 ast->codec->sample_rate = avio_rl16(pb);82 ast->codec->sample_rate = avio_rl16(pb);
libavformat/tta.c+1−1
@@ -77,7 +77,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) · 76 unmodified lines
77 return -1;77 return -1;
78 }78 }
79 79
80 st = av_new_stream(s, 0);80 st = avformat_new_stream(s, NULL);
81 if (!st)81 if (!st)
82 return AVERROR(ENOMEM);82 return AVERROR(ENOMEM);
83 83
libavformat/tty.c+1−1
@@ -76,7 +76,7 @@ static int read_header(AVFormatContext *avctx, · 75 unmodified lines
76{76{
77 TtyDemuxContext *s = avctx->priv_data;77 TtyDemuxContext *s = avctx->priv_data;
78 int width = 0, height = 0, ret = 0;78 int width = 0, height = 0, ret = 0;
79 AVStream *st = av_new_stream(avctx, 0);79 AVStream *st = avformat_new_stream(avctx, NULL);
80 AVRational framerate;80 AVRational framerate;
81 81
82 if (!st) {82 if (!st) {
libavformat/txd.c+1−1
@@ -40,7 +40,7 @@ static int txd_probe(AVProbeData * pd) { · 39 unmodified lines
40static int txd_read_header(AVFormatContext *s, AVFormatParameters *ap) {40static int txd_read_header(AVFormatContext *s, AVFormatParameters *ap) {
41 AVStream *st;41 AVStream *st;
42 42
43 st = av_new_stream(s, 0);43 st = avformat_new_stream(s, NULL);
44 if (!st)44 if (!st)
45 return AVERROR(ENOMEM);45 return AVERROR(ENOMEM);
46 st->codec->codec_type = AVMEDIA_TYPE_VIDEO;46 st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
libavformat/utils.c+11−2
@@ -2762,7 +2762,17 @@ void av_close_input_file(AVFormatContext *s) · 2761 unmodified lines
2762 avio_close(pb);2762 avio_close(pb);
2763}2763}
2764 2764
2765#if FF_API_NEW_STREAM
2765AVStream *av_new_stream(AVFormatContext *s, int id)2766AVStream *av_new_stream(AVFormatContext *s, int id)
2767{
2768 AVStream *st = avformat_new_stream(s, NULL);
2769 if (st)
2770 st->id = id;
2771 return st;
2772}
2773#endif
2774
2775AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c)
2766{2776{
2767 AVStream *st;2777 AVStream *st;
2768 int i;2778 int i;
@@ -2783,13 +2793,12 @@ AVStream *av_new_stream(AVFormatContext *s, int id) · 14 unmodified lines
2783 return NULL;2793 return NULL;
2784 }2794 }
2785 2795
2786 st->codec = avcodec_alloc_context3(NULL);2796 st->codec = avcodec_alloc_context3(c);
2787 if (s->iformat) {2797 if (s->iformat) {
2788 /* no default bitrate if decoding */2798 /* no default bitrate if decoding */
2789 st->codec->bit_rate = 0;2799 st->codec->bit_rate = 0;
2790 }2800 }
2791 st->index = s->nb_streams;2801 st->index = s->nb_streams;
2792 st->id = id;
2793 st->start_time = AV_NOPTS_VALUE;2802 st->start_time = AV_NOPTS_VALUE;
2794 st->duration = AV_NOPTS_VALUE;2803 st->duration = AV_NOPTS_VALUE;
2795 /* we set the current DTS to 0 so that formats without any timestamps2804 /* we set the current DTS to 0 so that formats without any timestamps
libavformat/vc1test.c+1−1
@@ -54,7 +54,7 @@ static int vc1t_read_header(AVFormatContext *s, · 53 unmodified lines
54 return -1;54 return -1;
55 55
56 /* init video codec */56 /* init video codec */
57 st = av_new_stream(s, 0);57 st = avformat_new_stream(s, NULL);
58 if (!st)58 if (!st)
59 return -1;59 return -1;
60 60
libavformat/version.h+5−2
@@ -24,8 +24,8 @@ · 23 unmodified lines
24#include "libavutil/avutil.h"24#include "libavutil/avutil.h"
25 25
26#define LIBAVFORMAT_VERSION_MAJOR 5326#define LIBAVFORMAT_VERSION_MAJOR 53
27#define LIBAVFORMAT_VERSION_MINOR 1627#define LIBAVFORMAT_VERSION_MINOR 17
28#define LIBAVFORMAT_VERSION_MICRO 128#define LIBAVFORMAT_VERSION_MICRO 0
29 29
30#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \30#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
31 LIBAVFORMAT_VERSION_MINOR, \31 LIBAVFORMAT_VERSION_MINOR, \
@@ -98,5 +98,8 @@ · 66 unmodified lines
98#ifndef FF_API_RTSP_URL_OPTIONS98#ifndef FF_API_RTSP_URL_OPTIONS
99#define FF_API_RTSP_URL_OPTIONS (LIBAVFORMAT_VERSION_MAJOR < 54)99#define FF_API_RTSP_URL_OPTIONS (LIBAVFORMAT_VERSION_MAJOR < 54)
100#endif100#endif
101#ifndef FF_API_NEW_STREAM
102#define FF_API_NEW_STREAM (LIBAVFORMAT_VERSION_MAJOR < 54)
103#endif
101 104
102#endif /* AVFORMAT_VERSION_H */105#endif /* AVFORMAT_VERSION_H */
libavformat/vocdec.c+1−1
@@ -52,7 +52,7 @@ static int voc_read_header(AVFormatContext *s, AVFormatParameters *ap) · 51 unmodified lines
52 return AVERROR(ENOSYS);52 return AVERROR(ENOSYS);
53 }53 }
54 avio_skip(pb, header_size);54 avio_skip(pb, header_size);
55 st = av_new_stream(s, 0);55 st = avformat_new_stream(s, NULL);
56 if (!st)56 if (!st)
57 return AVERROR(ENOMEM);57 return AVERROR(ENOMEM);
58 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;58 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
libavformat/vqf.c+1−1
@@ -64,7 +64,7 @@ static void add_metadata(AVFormatContext *s, const char *tag, · 63 unmodified lines
64static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap)64static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap)
65{65{
66 VqfContext *c = s->priv_data;66 VqfContext *c = s->priv_data;
67 AVStream *st = av_new_stream(s, 0);67 AVStream *st = avformat_new_stream(s, NULL);
68 int chunk_tag;68 int chunk_tag;
69 int rate_flag = -1;69 int rate_flag = -1;
70 int header_size;70 int header_size;
libavformat/wav.c+2−2
@@ -280,7 +280,7 @@ static int wav_parse_fmt_tag(AVFormatContext *s, int64_t size, AVStream **st) · 279 unmodified lines
280 int ret;280 int ret;
281 281
282 /* parse fmt header */282 /* parse fmt header */
283 *st = av_new_stream(s, 0);283 *st = avformat_new_stream(s, NULL);
284 if (!*st)284 if (!*st)
285 return AVERROR(ENOMEM);285 return AVERROR(ENOMEM);
286 286
@@ -726,7 +726,7 @@ static int w64_read_header(AVFormatContext *s, AVFormatParameters *ap) · 439 unmodified lines
726 return -1;726 return -1;
727 }727 }
728 728
729 st = av_new_stream(s, 0);729 st = avformat_new_stream(s, NULL);
730 if (!st)730 if (!st)
731 return AVERROR(ENOMEM);731 return AVERROR(ENOMEM);
732 732
libavformat/wc3movie.c+2−2
@@ -163,7 +163,7 @@ static int wc3_read_header(AVFormatContext *s, · 162 unmodified lines
163 } while (fourcc_tag != BRCH_TAG);163 } while (fourcc_tag != BRCH_TAG);
164 164
165 /* initialize the decoder streams */165 /* initialize the decoder streams */
166 st = av_new_stream(s, 0);166 st = avformat_new_stream(s, NULL);
167 if (!st)167 if (!st)
168 return AVERROR(ENOMEM);168 return AVERROR(ENOMEM);
169 av_set_pts_info(st, 33, 1, WC3_FRAME_FPS);169 av_set_pts_info(st, 33, 1, WC3_FRAME_FPS);
@@ -174,7 +174,7 @@ static int wc3_read_header(AVFormatContext *s, · 4 unmodified lines
174 st->codec->width = wc3->width;174 st->codec->width = wc3->width;
175 st->codec->height = wc3->height;175 st->codec->height = wc3->height;
176 176
177 st = av_new_stream(s, 0);177 st = avformat_new_stream(s, NULL);
178 if (!st)178 if (!st)
179 return AVERROR(ENOMEM);179 return AVERROR(ENOMEM);
180 av_set_pts_info(st, 33, 1, WC3_FRAME_FPS);180 av_set_pts_info(st, 33, 1, WC3_FRAME_FPS);
libavformat/westwood.c+3−3
@@ -144,7 +144,7 @@ static int wsaud_read_header(AVFormatContext *s, · 143 unmodified lines
144 wsaud->audio_bits = (((header[10] & 0x2) >> 1) + 1) * 8;144 wsaud->audio_bits = (((header[10] & 0x2) >> 1) + 1) * 8;
145 145
146 /* initialize the audio decoder stream */146 /* initialize the audio decoder stream */
147 st = av_new_stream(s, 0);147 st = avformat_new_stream(s, NULL);
148 if (!st)148 if (!st)
149 return AVERROR(ENOMEM);149 return AVERROR(ENOMEM);
150 av_set_pts_info(st, 33, 1, wsaud->audio_samplerate);150 av_set_pts_info(st, 33, 1, wsaud->audio_samplerate);
@@ -221,7 +221,7 @@ static int wsvqa_read_header(AVFormatContext *s, · 70 unmodified lines
221 unsigned int chunk_size;221 unsigned int chunk_size;
222 222
223 /* initialize the video decoder stream */223 /* initialize the video decoder stream */
224 st = av_new_stream(s, 0);224 st = avformat_new_stream(s, NULL);
225 if (!st)225 if (!st)
226 return AVERROR(ENOMEM);226 return AVERROR(ENOMEM);
227 av_set_pts_info(st, 33, 1, VQA_FRAMERATE);227 av_set_pts_info(st, 33, 1, VQA_FRAMERATE);
@@ -247,7 +247,7 @@ static int wsvqa_read_header(AVFormatContext *s, · 19 unmodified lines
247 247
248 /* initialize the audio decoder stream for VQA v1 or nonzero samplerate */248 /* initialize the audio decoder stream for VQA v1 or nonzero samplerate */
249 if (AV_RL16(&header[24]) || (AV_RL16(&header[0]) == 1 && AV_RL16(&header[2]) == 1)) {249 if (AV_RL16(&header[24]) || (AV_RL16(&header[0]) == 1 && AV_RL16(&header[2]) == 1)) {
250 st = av_new_stream(s, 0);250 st = avformat_new_stream(s, NULL);
251 if (!st)251 if (!st)
252 return AVERROR(ENOMEM);252 return AVERROR(ENOMEM);
253 av_set_pts_info(st, 33, 1, VQA_FRAMERATE);253 av_set_pts_info(st, 33, 1, VQA_FRAMERATE);
libavformat/wtvdec.c+3−2
@@ -414,7 +414,7 @@ static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length) · 413 unmodified lines
414 if (!filesize)414 if (!filesize)
415 goto done;415 goto done;
416 416
417 st = av_new_stream(s, 0);417 st = avformat_new_stream(s, NULL);
418 if (!st)418 if (!st)
419 goto done;419 goto done;
420 av_dict_set(&st->metadata, "title", description, 0);420 av_dict_set(&st->metadata, "title", description, 0);
@@ -562,9 +562,10 @@ static AVStream * new_stream(AVFormatContext *s, AVStream *st, int sid, int code · 141 unmodified lines
562 WtvStream *wst = av_mallocz(sizeof(WtvStream));562 WtvStream *wst = av_mallocz(sizeof(WtvStream));
563 if (!wst)563 if (!wst)
564 return NULL;564 return NULL;
565 st = av_new_stream(s, sid);565 st = avformat_new_stream(s, NULL);
566 if (!st)566 if (!st)
567 return NULL;567 return NULL;
568 st->id = sid;
568 st->priv_data = wst;569 st->priv_data = wst;
569 }570 }
570 st->codec->codec_type = codec_type;571 st->codec->codec_type = codec_type;
libavformat/wv.c+1−1
@@ -220,7 +220,7 @@ static int wv_read_header(AVFormatContext *s, · 219 unmodified lines
220 }220 }
221 221
222 /* now we are ready: build format streams */222 /* now we are ready: build format streams */
223 st = av_new_stream(s, 0);223 st = avformat_new_stream(s, NULL);
224 if (!st)224 if (!st)
225 return -1;225 return -1;
226 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;226 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
libavformat/xa.c+1−1
@@ -70,7 +70,7 @@ static int xa_read_header(AVFormatContext *s, · 69 unmodified lines
70 AVStream *st;70 AVStream *st;
71 71
72 /*Set up the XA Audio Decoder*/72 /*Set up the XA Audio Decoder*/
73 st = av_new_stream(s, 0);73 st = avformat_new_stream(s, NULL);
74 if (!st)74 if (!st)
75 return AVERROR(ENOMEM);75 return AVERROR(ENOMEM);
76 76
libavformat/xmv.c+2−2
@@ -147,7 +147,7 @@ static int xmv_read_header(AVFormatContext *s, · 146 unmodified lines
147 147
148 /* Video track */148 /* Video track */
149 149
150 vst = av_new_stream(s, 0);150 vst = avformat_new_stream(s, NULL);
151 if (!vst)151 if (!vst)
152 return AVERROR(ENOMEM);152 return AVERROR(ENOMEM);
153 153
@@ -202,7 +202,7 @@ static int xmv_read_header(AVFormatContext *s, · 48 unmodified lines
202 av_log(s, AV_LOG_WARNING, "Unsupported 5.1 ADPCM audio stream "202 av_log(s, AV_LOG_WARNING, "Unsupported 5.1 ADPCM audio stream "
203 "(0x%04X)\n", packet->flags);203 "(0x%04X)\n", packet->flags);
204 204
205 ast = av_new_stream(s, audio_track);205 ast = avformat_new_stream(s, NULL);
206 if (!ast)206 if (!ast)
207 return AVERROR(ENOMEM);207 return AVERROR(ENOMEM);
208 208
libavformat/xwma.c+1−1
@@ -69,7 +69,7 @@ static int xwma_read_header(AVFormatContext *s, AVFormatParameters *ap) · 68 unmodified lines
69 if (tag != MKTAG('f', 'm', 't', ' '))69 if (tag != MKTAG('f', 'm', 't', ' '))
70 return -1;70 return -1;
71 size = avio_rl32(pb);71 size = avio_rl32(pb);
72 st = av_new_stream(s, 0);72 st = avformat_new_stream(s, NULL);
73 if (!st)73 if (!st)
74 return AVERROR(ENOMEM);74 return AVERROR(ENOMEM);
75 75
libavformat/yop.c+2−2
@@ -56,8 +56,8 @@ static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap) · 55 unmodified lines
56 56
57 int frame_rate, ret;57 int frame_rate, ret;
58 58
59 audio_stream = av_new_stream(s, 0);59 audio_stream = avformat_new_stream(s, NULL);
60 video_stream = av_new_stream(s, 1);60 video_stream = avformat_new_stream(s, NULL);
61 61
62 // Extra data that will be passed to the decoder62 // Extra data that will be passed to the decoder
63 video_stream->codec->extradata_size = 8;63 video_stream->codec->extradata_size = 8;
libavformat/yuv4mpeg.c+1−1
@@ -333,7 +333,7 @@ static int yuv4_read_header(AVFormatContext *s, AVFormatParameters *ap) · 332 unmodified lines
333 aspectd = 1;333 aspectd = 1;
334 }334 }
335 335
336 st = av_new_stream(s, 0);336 st = avformat_new_stream(s, NULL);
337 if(!st)337 if(!st)
338 return AVERROR(ENOMEM);338 return AVERROR(ENOMEM);
339 st->codec->width = width;339 st->codec->width = width;
libavutil/opt.h+183−0
@@ -32,6 +32,189 @@ · 31 unmodified lines
32#include "dict.h"32#include "dict.h"
33#include "log.h"33#include "log.h"
34 34
35/**
36 * @defgroup avoptions AVOptions
37 * @{
38 * AVOptions provide a generic system to declare options on arbitrary structs
39 * ("objects"). An option can have a help text, a type and a range of possible
40 * values. Options may then be enumerated, read and written to.
41 *
42 * @section avoptions_implement Implementing AVOptions
43 * This section describes how to add AVOptions capabilities to a struct.
44 *
45 * All AVOptions-related information is stored in an AVClass. Therefore
46 * the first member of the struct must be a pointer to an AVClass describing it.
47 * The option field of the AVClass must be set to a NULL-terminated static array
48 * of AVOptions. Each AVOption must have a non-empty name, a type, a default
49 * value and for number-type AVOptions also a range of allowed values. It must
50 * also declare an offset in bytes from the start of the struct, where the field
51 * associated with this AVOption is located. Other fields in the AVOption struct
52 * should also be set when applicable, but are not required.
53 *
54 * The following example illustrates an AVOptions-enabled struct:
55 * @code
56 * typedef struct test_struct {
57 * AVClass *class;
58 * int int_opt;
59 * char *str_opt;
60 * uint8_t *bin_opt;
61 * int bin_len;
62 * } test_struct;
63 *
64 * static const AVOption options[] = {
65 * { "test_int", "This is a test option of int type.", offsetof(test_struct, int_opt),
66 * AV_OPT_TYPE_INT, { -1 }, INT_MIN, INT_MAX },
67 * { "test_str", "This is a test option of string type.", offsetof(test_struct, str_opt),
68 * AV_OPT_TYPE_STRING },
69 * { "test_bin", "This is a test option of binary type.", offsetof(test_struct, bin_opt),
70 * AV_OPT_TYPE_BINARY },
71 * { NULL },
72 * };
73 *
74 * static const AVClass test_class = {
75 * .class_name = "test class",
76 * .item_name = av_default_item_name,
77 * .option = options,
78 * .version = LIBAVUTIL_VERSION_INT,
79 * };
80 * @endcode
81 *
82 * Next, when allocating your struct, you must ensure that the AVClass pointer
83 * is set to the correct value. Then, av_opt_set_defaults() must be called to
84 * initialize defaults. After that the struct is ready to be used with the
85 * AVOptions API.
86 *
87 * When cleaning up, you may use the av_opt_free() function to automatically
88 * free all the allocated string and binary options.
89 *
90 * Continuing with the above example:
91 *
92 * @code
93 * test_struct *alloc_test_struct(void)
94 * {
95 * test_struct *ret = av_malloc(sizeof(*ret));
96 * ret->class = &test_class;
97 * av_opt_set_defaults(ret);
98 * return ret;
99 * }
100 * void free_test_struct(test_struct **foo)
101 * {
102 * av_opt_free(*foo);
103 * av_freep(foo);
104 * }
105 * @endcode
106 *
107 * @subsection avoptions_implement_nesting Nesting
108 * It may happen that an AVOptions-enabled struct contains another
109 * AVOptions-enabled struct as a member (e.g. AVCodecContext in
110 * libavcodec exports generic options, while its priv_data field exports
111 * codec-specific options). In such a case, it is possible to set up the
112 * parent struct to export a child's options. To do that, simply
113 * implement AVClass.child_next() and AVClass.child_class_next() in the
114 * parent struct's AVClass.
115 * Assuming that the test_struct from above now also contains a
116 * child_struct field:
117 *
118 * @code
119 * typedef struct child_struct {
120 * AVClass *class;
121 * int flags_opt;
122 * } child_struct;
123 * static const AVOption child_opts[] = {
124 * { "test_flags", "This is a test option of flags type.",
125 * offsetof(child_struct, flags_opt), AV_OPT_TYPE_FLAGS, { 0 }, INT_MIN, INT_MAX },
126 * { NULL },
127 * };
128 * static const AVClass child_class = {
129 * .class_name = "child class",
130 * .item_name = av_default_item_name,
131 * .option = child_opts,
132 * .version = LIBAVUTIL_VERSION_INT,
133 * };
134 *
135 * void *child_next(void *obj, void *prev)
136 * {
137 * test_struct *t = obj;
138 * if (!prev && t->child_struct)
139 * return t->child_struct;
140 * return NULL
141 * }
142 * const AVClass child_class_next(const AVClass *prev)
143 * {
144 * return prev ? NULL : &child_class;
145 * }
146 * @endcode
147 * Putting child_next() and child_class_next() as defined above into
148 * test_class will now make child_struct's options accessible through
149 * test_struct (again, proper setup as described above needs to be done on
150 * child_struct right after it is created).
151 *
152 * From the above example it might not be clear why both child_next()
153 * and child_class_next() are needed. The distinction is that child_next()
154 * iterates over actually existing objects, while child_class_next()
155 * iterates over all possible child classes. E.g. if an AVCodecContext
156 * was initialized to use a codec which has private options, then its
157 * child_next() will return AVCodecContext.priv_data and finish
158 * iterating. OTOH child_class_next() on AVCodecContext.av_class will
159 * iterate over all available codecs with private options.
160 *
161 * @subsection avoptions_implement_named_constants Named constants
162 * It is possible to create named constants for options. Simply set the unit
163 * field of the option the constants should apply to to a string and
164 * create the constants themselves as options of type AV_OPT_TYPE_CONST
165 * with their unit field set to the same string.
166 * Their default_val field should contain the value of the named
167 * constant.
168 * For example, to add some named constants for the test_flags option
169 * above, put the following into the child_opts array:
170 * @code
171 * { "test_flags", "This is a test option of flags type.",
172 * offsetof(child_struct, flags_opt), AV_OPT_TYPE_FLAGS, { 0 }, INT_MIN, INT_MAX, "test_unit" },
173 * { "flag1", "This is a flag with value 16", 0, AV_OPT_TYPE_CONST, { 16 }, 0, 0, "test_unit" },
174 * @endcode
175 *
176 * @section avoptions_use Using AVOptions
177 * This section deals with accessing options in an AVOptions-enabled struct.
178 * Such structs in Libav are e.g. AVCodecContext in libavcodec or
179 * AVFormatContext in libavformat.
180 *
181 * @subsection avoptions_use_examine Examining AVOptions
182 * The basic functions for examining options are av_opt_next(), which iterates
183 * over all options defined for one object, and av_opt_find(), which searches
184 * for an option with the given name.
185 *
186 * The situation is more complicated with nesting. An AVOptions-enabled struct
187 * may have AVOptions-enabled children. Passing the AV_OPT_SEARCH_CHILDREN flag
188 * to av_opt_find() will make the function search children recursively.
189 *
190 * For enumerating there are basically two cases. The first is when you want to
191 * get all options that may potentially exist on the struct and its children
192 * (e.g. when constructing documentation). In that case you should call
193 * av_opt_child_class_next() recursively on the parent struct's AVClass. The
194 * second case is when you have an already initialized struct with all its
195 * children and you want to get all options that can be actually written or read
196 * from it. In that case you should call av_opt_child_next() recursively (and
197 * av_opt_next() on each result).
198 *
199 * @subsection avoptions_use_get_set Reading and writing AVOptions
200 * When setting options, you often have a string read directly from the
201 * user. In such a case, simply passing it to av_opt_set() is enough. For
202 * non-string type options, av_opt_set() will parse the string according to the
203 * option type.
204 *
205 * Similarly av_opt_get() will read any option type and convert it to a string
206 * which will be returned. Do not forget that the string is allocated, so you
207 * have to free it with av_free().
208 *
209 * In some cases it may be more convenient to put all options into an
210 * AVDictionary and call av_opt_set_dict() on it. A specific case of this
211 * are the format/codec open functions in lavf/lavc which take a dictionary
212 * filled with option as a parameter. This allows to set some options
213 * that cannot be set otherwise, since e.g. the input file format is not known
214 * before the file is actually opened.
215 * @}
216 */
217
35enum AVOptionType{218enum AVOptionType{
36 AV_OPT_TYPE_FLAGS,219 AV_OPT_TYPE_FLAGS,
37 AV_OPT_TYPE_INT,220 AV_OPT_TYPE_INT,
presets/libvpx-1080p.ffpresetrenamed from ffpresets/libvpx-1080p.avpreset+0−0

File renamed without changes.

presets/libvpx-1080p50_60.ffpresetrenamed from ffpresets/libvpx-1080p50_60.avpreset+0−0

File renamed without changes.

presets/libvpx-360p.ffpresetrenamed from ffpresets/libvpx-360p.avpreset+0−0

File renamed without changes.

presets/libvpx-720p.ffpresetrenamed from ffpresets/libvpx-720p.avpreset+0−0

File renamed without changes.

presets/libvpx-720p50_60.ffpresetrenamed from ffpresets/libvpx-720p50_60.avpreset+0−0

File renamed without changes.

presets/libx264-baseline.ffpreset+1−0
@@ -0,0 +1 @@
1profile=baseline
presets/libx264-fast.ffpreset+1−0
@@ -0,0 +1 @@
1preset=fast
presets/libx264-fast_firstpass.ffpreset+2−0
@@ -0,0 +1,2 @@
1preset=fast
2fastfirstpass=1
presets/libx264-faster.ffpreset+1−0
@@ -0,0 +1 @@
1preset=faster
presets/libx264-faster_firstpass.ffpreset+2−0
@@ -0,0 +1,2 @@
1preset=faster
2fastfirstpass=1
presets/libx264-ipod320.ffpreset+4−0
@@ -0,0 +1,4 @@
1profile=baseline
2level=13
3maxrate=768000
4bufsize=3000000
presets/libx264-ipod640.ffpreset+4−0
@@ -0,0 +1,4 @@
1profile=baseline
2level=30
3maxrate=10000000
4bufsize=10000000
presets/libx264-lossless_fast.ffpreset+2−0
@@ -0,0 +1,2 @@
1preset=fast
2qp=0
presets/libx264-lossless_max.ffpreset+2−0
@@ -0,0 +1,2 @@
1preset=placebo
2qp=0
presets/libx264-lossless_medium.ffpreset+2−0
@@ -0,0 +1,2 @@
1preset=medium
2qp=0
presets/libx264-lossless_slow.ffpreset+2−0
@@ -0,0 +1,2 @@
1preset=slow
2qp=0
presets/libx264-lossless_slower.ffpreset+2−0
@@ -0,0 +1,2 @@
1preset=slower
2qp=0
presets/libx264-lossless_ultrafast.ffpreset+2−0
@@ -0,0 +1,2 @@
1preset=ultrafast
2qp=0
presets/libx264-main.ffpreset+1−0
@@ -0,0 +1 @@
1profile=main
presets/libx264-medium.ffpreset+1−0
@@ -0,0 +1 @@
1preset=medium
presets/libx264-medium_firstpass.ffpreset+2−0
@@ -0,0 +1,2 @@
1preset=medium
2fastfirstpass=1
presets/libx264-placebo.ffpreset+1−0
@@ -0,0 +1 @@
1preset=placebo
presets/libx264-placebo_firstpass.ffpreset+2−0
@@ -0,0 +1,2 @@
1preset=placebo
2fastfirstpass=1
presets/libx264-slow.ffpreset+1−0
@@ -0,0 +1 @@
1preset=slow
presets/libx264-slow_firstpass.ffpreset+2−0
@@ -0,0 +1,2 @@
1preset=slow
2fastfirstpass=1
presets/libx264-slower.ffpreset+1−0
@@ -0,0 +1 @@
1preset=slower
presets/libx264-slower_firstpass.ffpreset+2−0
@@ -0,0 +1,2 @@
1preset=slower
2fastfirstpass=1
presets/libx264-superfast.ffpreset+1−0
@@ -0,0 +1 @@
1preset=superfast
presets/libx264-superfast_firstpass.ffpreset+2−0
@@ -0,0 +1,2 @@
1preset=superfast
2fastfirstpass=1
presets/libx264-ultrafast.ffpreset+1−0
@@ -0,0 +1 @@
1preset=ultrafast
presets/libx264-ultrafast_firstpass.ffpreset+2−0
@@ -0,0 +1,2 @@
1preset=ultrafast
2fastfirstpass=1
presets/libx264-veryfast.ffpreset+1−0
@@ -0,0 +1 @@
1preset=veryfast
presets/libx264-veryfast_firstpass.ffpreset+2−0
@@ -0,0 +1,2 @@
1preset=veryfast
2fastfirstpass=1
presets/libx264-veryslow.ffpreset+1−0
@@ -0,0 +1 @@
1preset=veryslow
presets/libx264-veryslow_firstpass.ffpreset+2−0
@@ -0,0 +1,2 @@
1preset=veryslow
2fastfirstpass=1

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t