* 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
Merged-by: Michael Niedermayer <michaelni@gmx.at>
| ... | ... |
@@ -3137,7 +3137,7 @@ static int get_preset_file_2(const char *preset_name, const char *codec_name, AV |
| 3137 | 3137 |
static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type) |
| 3138 | 3138 |
{
|
| 3139 | 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 | 3141 |
int idx = oc->nb_streams - 1, ret = 0; |
| 3142 | 3142 |
int64_t max_frames = INT64_MAX; |
| 3143 | 3143 |
char *bsf = NULL, *next, *codec_tag = NULL; |
| ... | ... |
@@ -3151,6 +3151,9 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e |
| 3151 | 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 | 3157 |
output_streams = grow_array(output_streams, sizeof(*output_streams), &nb_output_streams, |
| 3155 | 3158 |
nb_output_streams + 1); |
| 3156 | 3159 |
ost = &output_streams[nb_output_streams - 1]; |
| ... | ... |
@@ -16,6 +16,9 @@ API changes, most recent first: |
| 16 | 16 |
2011-10-20 - b35e9e1 - lavu 51.22.0 |
| 17 | 17 |
Add av_strtok() to avstring.h. |
| 18 | 18 |
|
| 19 |
+2011-10-xx - xxxxxxx - lavf 53.10.0 |
|
| 20 |
+ Add avformat_new_stream(). Deprecate av_new_stream(). |
|
| 21 |
+ |
|
| 19 | 22 |
2011-xx-xx - xxxxxxx - lavf 53.9.0 |
| 20 | 23 |
Add AVFMT_NO_BYTE_SEEK AVInputFormat flag. |
| 21 | 24 |
|
| ... | ... |
@@ -778,7 +778,7 @@ A preset file contains a sequence of @var{option=value} pairs, one for
|
| 778 | 778 |
each line, specifying a sequence of options which can be specified also on |
| 779 | 779 |
the command line. Lines starting with the hash ('#') character are ignored and
|
| 780 | 780 |
are 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 |
|
| 783 | 783 |
Preset files are specified with the @code{pre} option, this option takes a
|
| 784 | 784 |
preset name as input. Avconv searches for a file named @var{preset_name}.avpreset in
|
| ... | ... |
@@ -199,7 +199,7 @@ static AVStream *add_video_stream(AVFormatContext *oc, enum CodecID codec_id) |
| 199 | 199 |
AVCodecContext *c; |
| 200 | 200 |
AVStream *st; |
| 201 | 201 |
|
| 202 |
- st = av_new_stream(oc, 0); |
|
| 202 |
+ st = avformat_new_stream(oc, NULL); |
|
| 203 | 203 |
if (!st) {
|
| 204 | 204 |
fprintf(stderr, "Could not alloc stream\n"); |
| 205 | 205 |
exit(1); |
| ... | ... |
@@ -873,7 +873,7 @@ A preset file contains a sequence of @var{option}=@var{value} pairs,
|
| 873 | 873 |
one for each line, specifying a sequence of options which would be |
| 874 | 874 |
awkward to specify on the command line. Lines starting with the hash |
| 875 | 875 |
('#') character are ignored and are used to provide comments. Check
|
| 876 |
-the @file{ffpresets} directory in the FFmpeg source tree for examples.
|
|
| 876 |
+the @file{presets} directory in the FFmpeg source tree for examples.
|
|
| 877 | 877 |
|
| 878 | 878 |
Preset files are specified with the @code{vpre}, @code{apre},
|
| 879 | 879 |
@code{spre}, and @code{fpre} options. The @code{fpre} option takes the
|
| ... | ... |
@@ -527,6 +527,7 @@ following image formats are supported: |
| 527 | 527 |
@tab encoding supported through external library libtheora |
| 528 | 528 |
@item Tiertex Limited SEQ video @tab @tab X |
| 529 | 529 |
@tab Codec used in DOS CD-ROM FlashBack game. |
| 530 |
+@item Ut Video @tab @tab X |
|
| 530 | 531 |
@item V210 Quicktime Uncompressed 4:2:2 10-bit @tab X @tab X |
| 531 | 532 |
@item VMware Screen Codec / VMware Video @tab @tab X |
| 532 | 533 |
@tab Codec used in videos captured by VMware. |
| ... | ... |
@@ -3252,7 +3252,7 @@ static int get_preset_file_2(const char *preset_name, const char *codec_name, AV |
| 3252 | 3252 |
static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type) |
| 3253 | 3253 |
{
|
| 3254 | 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 | 3256 |
int idx = oc->nb_streams - 1, ret = 0; |
| 3257 | 3257 |
int64_t max_frames = INT64_MAX; |
| 3258 | 3258 |
char *bsf = NULL, *next, *codec_tag = NULL; |
| ... | ... |
@@ -3266,6 +3266,9 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e |
| 3266 | 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 | 3272 |
output_streams = grow_array(output_streams, sizeof(*output_streams), &nb_output_streams, |
| 3270 | 3273 |
nb_output_streams + 1); |
| 3271 | 3274 |
ost = &output_streams[nb_output_streams - 1]; |
| 3272 | 3275 |
deleted file mode 100644 |
| ... | ... |
@@ -1,17 +0,0 @@ |
| 1 |
-g=120 |
|
| 2 |
-lag-in-frames=16 |
|
| 3 |
-deadline=good |
|
| 4 |
-cpu-used=0 |
|
| 5 |
-profile=1 |
|
| 6 |
-qmax=51 |
|
| 7 |
-qmin=11 |
|
| 8 |
-slices=4 |
|
| 9 |
-b=2M |
|
| 10 |
- |
|
| 11 |
-#ignored unless using -pass 2 |
|
| 12 |
-maxrate=24M |
|
| 13 |
-minrate=100k |
|
| 14 |
-auto-alt-ref=1 |
|
| 15 |
-arnr-maxframes=7 |
|
| 16 |
-arnr-strength=5 |
|
| 17 |
-arnr-type=centered |
| 18 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,17 +0,0 @@ |
| 1 |
-g=120 |
|
| 2 |
-lag-in-frames=25 |
|
| 3 |
-deafline=good |
|
| 4 |
-cpu-used=0 |
|
| 5 |
-profile=1 |
|
| 6 |
-qmax=51 |
|
| 7 |
-qmin=11 |
|
| 8 |
-slices=4 |
|
| 9 |
-b=2M |
|
| 10 |
- |
|
| 11 |
-#ignored unless using -pass 2 |
|
| 12 |
-maxrate=24M |
|
| 13 |
-minrate=100k |
|
| 14 |
-auto-alt-ref=1 |
|
| 15 |
-arnr-maxframes=7 |
|
| 16 |
-arnr-strength=5 |
|
| 17 |
-arnr-type=centered |
| 18 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,16 +0,0 @@ |
| 1 |
-g=120 |
|
| 2 |
-lag-in-frames=16 |
|
| 3 |
-deadline=good |
|
| 4 |
-cpu-used=0 |
|
| 5 |
-profile=0 |
|
| 6 |
-qmax=63 |
|
| 7 |
-qmin=0 |
|
| 8 |
-b=768k |
|
| 9 |
- |
|
| 10 |
-#ignored unless using -pass 2 |
|
| 11 |
-maxrate=1.5M |
|
| 12 |
-minrate=40k |
|
| 13 |
-auto-alt-ref=1 |
|
| 14 |
-arnr-maxframes=7 |
|
| 15 |
-arnr-strength=5 |
|
| 16 |
-arnr-type=centered |
| 17 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,17 +0,0 @@ |
| 1 |
-g=120 |
|
| 2 |
-lag-in-frames=16 |
|
| 3 |
-deadline=good |
|
| 4 |
-cpu-used=0 |
|
| 5 |
-profile=0 |
|
| 6 |
-qmax=51 |
|
| 7 |
-qmin=11 |
|
| 8 |
-slices=4 |
|
| 9 |
-b=2M |
|
| 10 |
- |
|
| 11 |
-#ignored unless using -pass 2 |
|
| 12 |
-maxrate=24M |
|
| 13 |
-minrate=100k |
|
| 14 |
-auto-alt-ref=1 |
|
| 15 |
-arnr-maxframes=7 |
|
| 16 |
-arnr-strength=5 |
|
| 17 |
-arnr-type=centered |
| 18 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,17 +0,0 @@ |
| 1 |
-g=120 |
|
| 2 |
-lag-in-frames=25 |
|
| 3 |
-deadline=good |
|
| 4 |
-cpu-used=0 |
|
| 5 |
-profile=0 |
|
| 6 |
-qmax=51 |
|
| 7 |
-qmin=11 |
|
| 8 |
-slices=4 |
|
| 9 |
-b=2M |
|
| 10 |
- |
|
| 11 |
-#ignored unless using -pass 2 |
|
| 12 |
-maxrate=24M |
|
| 13 |
-minrate=100k |
|
| 14 |
-auto-alt-ref=1 |
|
| 15 |
-arnr-maxframes=7 |
|
| 16 |
-arnr-strength=5 |
|
| 17 |
-arnr-type=centered |
| ... | ... |
@@ -4236,6 +4236,7 @@ static int parse_ffconfig(const char *filename) |
| 4236 | 4236 |
stream->fmt = ffserver_guess_format(NULL, stream->filename, NULL); |
| 4237 | 4237 |
avcodec_get_context_defaults2(&video_enc, AVMEDIA_TYPE_VIDEO); |
| 4238 | 4238 |
avcodec_get_context_defaults2(&audio_enc, AVMEDIA_TYPE_AUDIO); |
| 4239 |
+ |
|
| 4239 | 4240 |
audio_id = CODEC_ID_NONE; |
| 4240 | 4241 |
video_id = CODEC_ID_NONE; |
| 4241 | 4242 |
if (stream->fmt) {
|
| ... | ... |
@@ -401,6 +401,7 @@ OBJS-$(CONFIG_TTA_DECODER) += tta.o |
| 401 | 401 |
OBJS-$(CONFIG_TWINVQ_DECODER) += twinvq.o celp_math.o |
| 402 | 402 |
OBJS-$(CONFIG_TXD_DECODER) += txd.o s3tc.o |
| 403 | 403 |
OBJS-$(CONFIG_ULTI_DECODER) += ulti.o |
| 404 |
+OBJS-$(CONFIG_UTVIDEO_DECODER) += utvideo.o |
|
| 404 | 405 |
OBJS-$(CONFIG_V210_DECODER) += v210dec.o |
| 405 | 406 |
OBJS-$(CONFIG_V210_ENCODER) += v210enc.o |
| 406 | 407 |
OBJS-$(CONFIG_V210X_DECODER) += v210x.o |
| ... | ... |
@@ -208,6 +208,7 @@ void avcodec_register_all(void) |
| 208 | 208 |
REGISTER_DECODER (TSCC, tscc); |
| 209 | 209 |
REGISTER_DECODER (TXD, txd); |
| 210 | 210 |
REGISTER_DECODER (ULTI, ulti); |
| 211 |
+ REGISTER_DECODER (UTVIDEO, utvideo); |
|
| 211 | 212 |
REGISTER_ENCDEC (V210, v210); |
| 212 | 213 |
REGISTER_DECODER (V210X, v210x); |
| 213 | 214 |
REGISTER_DECODER (VB, vb); |
| ... | ... |
@@ -212,6 +212,7 @@ enum CodecID {
|
| 212 | 212 |
CODEC_ID_VC1IMAGE, |
| 213 | 213 |
CODEC_ID_8SVX_RAW, |
| 214 | 214 |
CODEC_ID_G2M, |
| 215 |
+ CODEC_ID_UTVIDEO_DEPRECATED, |
|
| 215 | 216 |
CODEC_ID_UTVIDEO = 0x800, |
| 216 | 217 |
|
| 217 | 218 |
/* various PCM "codecs" */ |
| ... | ... |
@@ -3707,19 +3708,31 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode); |
| 3707 | 3707 |
*/ |
| 3708 | 3708 |
const char *av_get_profile_name(const AVCodec *codec, int profile); |
| 3709 | 3709 |
|
| 3710 |
+#if FF_API_ALLOC_CONTEXT |
|
| 3710 | 3711 |
/** |
| 3711 | 3712 |
* Set the fields of the given AVCodecContext to default values. |
| 3712 | 3713 |
* |
| 3713 | 3714 |
* @param s The AVCodecContext of which the fields should be set to default values. |
| 3715 |
+ * @deprecated use avcodec_get_context_defaults3 |
|
| 3714 | 3716 |
*/ |
| 3717 |
+attribute_deprecated |
|
| 3715 | 3718 |
void avcodec_get_context_defaults(AVCodecContext *s); |
| 3716 | 3719 |
|
| 3717 | 3720 |
/** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API! |
| 3718 | 3721 |
* we WILL change its arguments and name a few times! */ |
| 3722 |
+attribute_deprecated |
|
| 3719 | 3723 |
void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType); |
| 3724 |
+#endif |
|
| 3720 | 3725 |
|
| 3721 |
-/** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API! |
|
| 3722 |
- * we WILL change its arguments and name a few times! */ |
|
| 3726 |
+/** |
|
| 3727 |
+ * Set the fields of the given AVCodecContext to default values corresponding |
|
| 3728 |
+ * to the given codec (defaults may be codec-dependent). |
|
| 3729 |
+ * |
|
| 3730 |
+ * Do not call this function if a non-NULL codec has been passed |
|
| 3731 |
+ * to avcodec_alloc_context3() that allocated this AVCodecContext. |
|
| 3732 |
+ * If codec is non-NULL, it is illegal to call avcodec_open2() with a |
|
| 3733 |
+ * different codec on this AVCodecContext. |
|
| 3734 |
+ */ |
|
| 3723 | 3735 |
int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec); |
| 3724 | 3736 |
|
| 3725 | 3737 |
#if FF_API_ALLOC_CONTEXT |
| ... | ... |
@@ -532,37 +532,41 @@ static const AVClass av_codec_context_class = {
|
| 532 | 532 |
.child_class_next = codec_child_class_next, |
| 533 | 533 |
}; |
| 534 | 534 |
|
| 535 |
+#if FF_API_ALLOC_CONTEXT |
|
| 535 | 536 |
void 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 |
+ |
|
| 543 |
+int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec){
|
|
| 536 | 544 |
int flags=0; |
| 537 | 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; |
|
| 542 |
- if(codec_type == AVMEDIA_TYPE_AUDIO) |
|
| 549 |
+ s->codec_type = codec ? codec->type : AVMEDIA_TYPE_UNKNOWN; |
|
| 550 |
+ if(s->codec_type == AVMEDIA_TYPE_AUDIO) |
|
| 543 | 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 | 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 | 555 |
flags= AV_OPT_FLAG_SUBTITLE_PARAM; |
| 548 | 556 |
av_opt_set_defaults2(s, flags, flags); |
| 549 | 557 |
|
| 550 |
- s->time_base= (AVRational){0,1};
|
|
| 551 |
- s->get_buffer= avcodec_default_get_buffer; |
|
| 552 |
- s->release_buffer= avcodec_default_release_buffer; |
|
| 553 |
- s->get_format= avcodec_default_get_format; |
|
| 554 |
- s->execute= avcodec_default_execute; |
|
| 555 |
- s->execute2= avcodec_default_execute2; |
|
| 556 |
- s->sample_aspect_ratio= (AVRational){0,1};
|
|
| 557 |
- s->pix_fmt= PIX_FMT_NONE; |
|
| 558 |
- s->sample_fmt= AV_SAMPLE_FMT_NONE; |
|
| 559 |
- |
|
| 560 |
- s->reget_buffer= avcodec_default_reget_buffer; |
|
| 561 |
- s->reordered_opaque= AV_NOPTS_VALUE; |
|
| 562 |
-} |
|
| 563 |
- |
|
| 564 |
-int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec){
|
|
| 565 |
- avcodec_get_context_defaults2(s, codec ? codec->type : AVMEDIA_TYPE_UNKNOWN); |
|
| 558 |
+ s->time_base = (AVRational){0,1};
|
|
| 559 |
+ s->get_buffer = avcodec_default_get_buffer; |
|
| 560 |
+ s->release_buffer = avcodec_default_release_buffer; |
|
| 561 |
+ s->get_format = avcodec_default_get_format; |
|
| 562 |
+ s->execute = avcodec_default_execute; |
|
| 563 |
+ s->execute2 = avcodec_default_execute2; |
|
| 564 |
+ s->sample_aspect_ratio = (AVRational){0,1};
|
|
| 565 |
+ s->pix_fmt = PIX_FMT_NONE; |
|
| 566 |
+ s->sample_fmt = AV_SAMPLE_FMT_NONE; |
|
| 567 |
+ |
|
| 568 |
+ s->reget_buffer = avcodec_default_reget_buffer; |
|
| 569 |
+ s->reordered_opaque = AV_NOPTS_VALUE; |
|
| 566 | 570 |
if(codec && codec->priv_data_size){
|
| 567 | 571 |
if(!s->priv_data){
|
| 568 | 572 |
s->priv_data= av_mallocz(codec->priv_data_size); |
| ... | ... |
@@ -610,13 +614,11 @@ AVCodecContext *avcodec_alloc_context2(enum AVMediaType codec_type){
|
| 610 | 610 |
|
| 611 | 611 |
return avctx; |
| 612 | 612 |
} |
| 613 |
-#endif |
|
| 614 | 613 |
|
| 615 | 614 |
void avcodec_get_context_defaults(AVCodecContext *s){
|
| 616 | 615 |
avcodec_get_context_defaults2(s, AVMEDIA_TYPE_UNKNOWN); |
| 617 | 616 |
} |
| 618 | 617 |
|
| 619 |
-#if FF_API_ALLOC_CONTEXT |
|
| 620 | 618 |
AVCodecContext *avcodec_alloc_context(void){
|
| 621 | 619 |
return avcodec_alloc_context2(AVMEDIA_TYPE_UNKNOWN); |
| 622 | 620 |
} |
| 623 | 621 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,460 @@ |
| 0 |
+/* |
|
| 1 |
+ * Ut Video decoder |
|
| 2 |
+ * Copyright (c) 2011 Konstantin Shishkov |
|
| 3 |
+ * |
|
| 4 |
+ * This file is part of Libav. |
|
| 5 |
+ * |
|
| 6 |
+ * Libav is free software; you can redistribute it and/or |
|
| 7 |
+ * modify it under the terms of the GNU Lesser General Public |
|
| 8 |
+ * License as published by the Free Software Foundation; either |
|
| 9 |
+ * version 2.1 of the License, or (at your option) any later version. |
|
| 10 |
+ * |
|
| 11 |
+ * Libav is distributed in the hope that it will be useful, |
|
| 12 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 13 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
| 14 |
+ * Lesser General Public License for more details. |
|
| 15 |
+ * |
|
| 16 |
+ * You should have received a copy of the GNU Lesser General Public |
|
| 17 |
+ * License along with Libav; if not, write to the Free Software |
|
| 18 |
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
| 19 |
+ */ |
|
| 20 |
+ |
|
| 21 |
+/** |
|
| 22 |
+ * @file |
|
| 23 |
+ * Ut Video decoder |
|
| 24 |
+ */ |
|
| 25 |
+ |
|
| 26 |
+#include <stdlib.h> |
|
| 27 |
+ |
|
| 28 |
+#include "libavutil/intreadwrite.h" |
|
| 29 |
+#include "avcodec.h" |
|
| 30 |
+#include "bytestream.h" |
|
| 31 |
+#include "get_bits.h" |
|
| 32 |
+#include "dsputil.h" |
|
| 33 |
+ |
|
| 34 |
+enum {
|
|
| 35 |
+ PRED_NONE = 0, |
|
| 36 |
+ PRED_LEFT, |
|
| 37 |
+ PRED_GRADIENT, |
|
| 38 |
+ PRED_MEDIAN, |
|
| 39 |
+}; |
|
| 40 |
+ |
|
| 41 |
+typedef struct UtvideoContext {
|
|
| 42 |
+ AVCodecContext *avctx; |
|
| 43 |
+ AVFrame pic; |
|
| 44 |
+ DSPContext dsp; |
|
| 45 |
+ |
|
| 46 |
+ uint32_t frame_info_size, flags, frame_info; |
|
| 47 |
+ int planes; |
|
| 48 |
+ int slices; |
|
| 49 |
+ int compression; |
|
| 50 |
+ int interlaced; |
|
| 51 |
+ int frame_pred; |
|
| 52 |
+ |
|
| 53 |
+ uint8_t *slice_bits; |
|
| 54 |
+ int slice_bits_size; |
|
| 55 |
+} UtvideoContext; |
|
| 56 |
+ |
|
| 57 |
+typedef struct HuffEntry {
|
|
| 58 |
+ uint8_t sym; |
|
| 59 |
+ uint8_t len; |
|
| 60 |
+} HuffEntry; |
|
| 61 |
+ |
|
| 62 |
+static int huff_cmp(const void *a, const void *b) |
|
| 63 |
+{
|
|
| 64 |
+ const HuffEntry *aa = a, *bb = b; |
|
| 65 |
+ return (aa->len - bb->len)*256 + aa->sym - bb->sym; |
|
| 66 |
+} |
|
| 67 |
+ |
|
| 68 |
+static int build_huff(const uint8_t *src, VLC *vlc) |
|
| 69 |
+{
|
|
| 70 |
+ int i; |
|
| 71 |
+ HuffEntry he[256]; |
|
| 72 |
+ int last; |
|
| 73 |
+ uint32_t codes[256]; |
|
| 74 |
+ uint8_t bits[256]; |
|
| 75 |
+ uint8_t syms[256]; |
|
| 76 |
+ uint32_t code; |
|
| 77 |
+ |
|
| 78 |
+ for (i = 0; i < 256; i++) {
|
|
| 79 |
+ he[i].sym = i; |
|
| 80 |
+ he[i].len = *src++; |
|
| 81 |
+ } |
|
| 82 |
+ qsort(he, 256, sizeof(*he), huff_cmp); |
|
| 83 |
+ |
|
| 84 |
+ if (!he[0].len || he[0].len > 32) |
|
| 85 |
+ return -1; |
|
| 86 |
+ |
|
| 87 |
+ last = 255; |
|
| 88 |
+ while (he[last].len == 255 && last) |
|
| 89 |
+ last--; |
|
| 90 |
+ |
|
| 91 |
+ code = 1; |
|
| 92 |
+ for (i = last; i >= 0; i--) {
|
|
| 93 |
+ codes[i] = code >> (32 - he[i].len); |
|
| 94 |
+ bits[i] = he[i].len; |
|
| 95 |
+ syms[i] = he[i].sym; |
|
| 96 |
+ code += 0x80000000u >> (he[i].len - 1); |
|
| 97 |
+ } |
|
| 98 |
+ |
|
| 99 |
+ return init_vlc_sparse(vlc, FFMIN(he[last].len, 9), last + 1, |
|
| 100 |
+ bits, sizeof(*bits), sizeof(*bits), |
|
| 101 |
+ codes, sizeof(*codes), sizeof(*codes), |
|
| 102 |
+ syms, sizeof(*syms), sizeof(*syms), 0); |
|
| 103 |
+} |
|
| 104 |
+ |
|
| 105 |
+static int decode_plane(UtvideoContext *c, int plane_no, |
|
| 106 |
+ uint8_t *dst, int step, int stride, |
|
| 107 |
+ int width, int height, |
|
| 108 |
+ const uint8_t *src, int src_size, int use_pred) |
|
| 109 |
+{
|
|
| 110 |
+ int i, j, slice, pix; |
|
| 111 |
+ int sstart, send; |
|
| 112 |
+ VLC vlc; |
|
| 113 |
+ GetBitContext gb; |
|
| 114 |
+ int prev; |
|
| 115 |
+ |
|
| 116 |
+ if (build_huff(src, &vlc)) {
|
|
| 117 |
+ av_log(c->avctx, AV_LOG_ERROR, "Cannot build Huffman codes\n"); |
|
| 118 |
+ return AVERROR_INVALIDDATA; |
|
| 119 |
+ } |
|
| 120 |
+ |
|
| 121 |
+ src += 256; |
|
| 122 |
+ src_size -= 256; |
|
| 123 |
+ |
|
| 124 |
+ send = 0; |
|
| 125 |
+ for (slice = 0; slice < c->slices; slice++) {
|
|
| 126 |
+ uint8_t *dest; |
|
| 127 |
+ int slice_data_start, slice_data_end, slice_size; |
|
| 128 |
+ |
|
| 129 |
+ sstart = send; |
|
| 130 |
+ send = height * (slice + 1) / c->slices; |
|
| 131 |
+ dest = dst + sstart * stride; |
|
| 132 |
+ |
|
| 133 |
+ // slice offset and size validation was done earlier |
|
| 134 |
+ slice_data_start = slice ? AV_RL32(src + slice * 4 - 4) : 0; |
|
| 135 |
+ slice_data_end = AV_RL32(src + slice * 4); |
|
| 136 |
+ slice_size = slice_data_end - slice_data_start; |
|
| 137 |
+ |
|
| 138 |
+ if (!slice_size) {
|
|
| 139 |
+ for (j = sstart; j < send; j++) {
|
|
| 140 |
+ for (i = 0; i < width * step; i += step) |
|
| 141 |
+ dest[i] = 0x80; |
|
| 142 |
+ dest += stride; |
|
| 143 |
+ } |
|
| 144 |
+ continue; |
|
| 145 |
+ } |
|
| 146 |
+ |
|
| 147 |
+ memcpy(c->slice_bits, src + slice_data_start + c->slices * 4, slice_size); |
|
| 148 |
+ memset(c->slice_bits + slice_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); |
|
| 149 |
+ c->dsp.bswap_buf((uint32_t*)c->slice_bits, (uint32_t*)c->slice_bits, |
|
| 150 |
+ (slice_data_end - slice_data_start + 3) >> 2); |
|
| 151 |
+ init_get_bits(&gb, c->slice_bits, slice_size * 8); |
|
| 152 |
+ |
|
| 153 |
+ prev = 0x80; |
|
| 154 |
+ for (j = sstart; j < send; j++) {
|
|
| 155 |
+ for (i = 0; i < width * step; i += step) {
|
|
| 156 |
+ if (get_bits_left(&gb) <= 0) {
|
|
| 157 |
+ av_log(c->avctx, AV_LOG_ERROR, "Slice decoding ran out of bits\n"); |
|
| 158 |
+ goto fail; |
|
| 159 |
+ } |
|
| 160 |
+ pix = get_vlc2(&gb, vlc.table, vlc.bits, 4); |
|
| 161 |
+ if (pix < 0) {
|
|
| 162 |
+ av_log(c->avctx, AV_LOG_ERROR, "Decoding error\n"); |
|
| 163 |
+ goto fail; |
|
| 164 |
+ } |
|
| 165 |
+ if (use_pred) {
|
|
| 166 |
+ prev += pix; |
|
| 167 |
+ pix = prev; |
|
| 168 |
+ } |
|
| 169 |
+ dest[i] = pix; |
|
| 170 |
+ } |
|
| 171 |
+ dest += stride; |
|
| 172 |
+ } |
|
| 173 |
+ if (get_bits_left(&gb) > 32) |
|
| 174 |
+ av_log(c->avctx, AV_LOG_WARNING, "%d bits left after decoding slice\n", |
|
| 175 |
+ get_bits_left(&gb)); |
|
| 176 |
+ } |
|
| 177 |
+ |
|
| 178 |
+ free_vlc(&vlc); |
|
| 179 |
+ |
|
| 180 |
+ return 0; |
|
| 181 |
+fail: |
|
| 182 |
+ free_vlc(&vlc); |
|
| 183 |
+ return AVERROR_INVALIDDATA; |
|
| 184 |
+} |
|
| 185 |
+ |
|
| 186 |
+static const int rgb_order[4] = { 1, 2, 0, 3 };
|
|
| 187 |
+ |
|
| 188 |
+static void restore_rgb_planes(uint8_t *src, int step, int stride, int width, int height) |
|
| 189 |
+{
|
|
| 190 |
+ int i, j; |
|
| 191 |
+ uint8_t r, g, b; |
|
| 192 |
+ |
|
| 193 |
+ for (j = 0; j < height; j++) {
|
|
| 194 |
+ for (i = 0; i < width * step; i += step) {
|
|
| 195 |
+ r = src[i]; |
|
| 196 |
+ g = src[i + 1]; |
|
| 197 |
+ b = src[i + 2]; |
|
| 198 |
+ src[i] = r + g - 0x80; |
|
| 199 |
+ src[i + 2] = b + g - 0x80; |
|
| 200 |
+ } |
|
| 201 |
+ src += stride; |
|
| 202 |
+ } |
|
| 203 |
+} |
|
| 204 |
+ |
|
| 205 |
+static void restore_median(uint8_t *src, int step, int stride, |
|
| 206 |
+ int width, int height, int slices) |
|
| 207 |
+{
|
|
| 208 |
+ int i, j, slice; |
|
| 209 |
+ int A, B, C; |
|
| 210 |
+ uint8_t *bsrc; |
|
| 211 |
+ int slice_start, slice_height; |
|
| 212 |
+ |
|
| 213 |
+ for (slice = 0; slice < slices; slice++) {
|
|
| 214 |
+ slice_start = (slice * height) / slices; |
|
| 215 |
+ slice_height = ((slice + 1) * height) / slices - slice_start; |
|
| 216 |
+ |
|
| 217 |
+ bsrc = src + slice_start * stride; |
|
| 218 |
+ |
|
| 219 |
+ // first line - left neighbour prediction |
|
| 220 |
+ bsrc[0] += 0x80; |
|
| 221 |
+ A = bsrc[0]; |
|
| 222 |
+ for (i = step; i < width * step; i += step) {
|
|
| 223 |
+ bsrc[i] += A; |
|
| 224 |
+ A = bsrc[i]; |
|
| 225 |
+ } |
|
| 226 |
+ bsrc += stride; |
|
| 227 |
+ if (slice_height == 1) |
|
| 228 |
+ continue; |
|
| 229 |
+ // second line - first element has top predition, the rest uses median |
|
| 230 |
+ C = bsrc[-stride]; |
|
| 231 |
+ bsrc[0] += C; |
|
| 232 |
+ A = bsrc[0]; |
|
| 233 |
+ for (i = step; i < width * step; i += step) {
|
|
| 234 |
+ B = bsrc[i - stride]; |
|
| 235 |
+ bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C)); |
|
| 236 |
+ C = B; |
|
| 237 |
+ A = bsrc[i]; |
|
| 238 |
+ } |
|
| 239 |
+ bsrc += stride; |
|
| 240 |
+ // the rest of lines use continuous median prediction |
|
| 241 |
+ for (j = 2; j < slice_height; j++) {
|
|
| 242 |
+ for (i = 0; i < width * step; i += step) {
|
|
| 243 |
+ B = bsrc[i - stride]; |
|
| 244 |
+ bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C)); |
|
| 245 |
+ C = B; |
|
| 246 |
+ A = bsrc[i]; |
|
| 247 |
+ } |
|
| 248 |
+ bsrc += stride; |
|
| 249 |
+ } |
|
| 250 |
+ } |
|
| 251 |
+} |
|
| 252 |
+ |
|
| 253 |
+static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) |
|
| 254 |
+{
|
|
| 255 |
+ const uint8_t *buf = avpkt->data; |
|
| 256 |
+ int buf_size = avpkt->size; |
|
| 257 |
+ const uint8_t *buf_end = buf + buf_size; |
|
| 258 |
+ UtvideoContext *c = avctx->priv_data; |
|
| 259 |
+ const uint8_t *ptr; |
|
| 260 |
+ int i, j; |
|
| 261 |
+ const uint8_t *plane_start[5]; |
|
| 262 |
+ int plane_size, max_slice_size = 0, slice_start, slice_end, slice_size; |
|
| 263 |
+ int ret; |
|
| 264 |
+ |
|
| 265 |
+ if (c->pic.data[0]) |
|
| 266 |
+ avctx->release_buffer(avctx, &c->pic); |
|
| 267 |
+ |
|
| 268 |
+ c->pic.reference = 1; |
|
| 269 |
+ c->pic.buffer_hints = FF_BUFFER_HINTS_VALID; |
|
| 270 |
+ if ((ret = avctx->get_buffer(avctx, &c->pic)) < 0) {
|
|
| 271 |
+ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); |
|
| 272 |
+ return ret; |
|
| 273 |
+ } |
|
| 274 |
+ |
|
| 275 |
+ /* parse plane structure to retrieve frame flags and validate slice offsets */ |
|
| 276 |
+ ptr = buf; |
|
| 277 |
+ for (i = 0; i < c->planes; i++) {
|
|
| 278 |
+ plane_start[i] = ptr; |
|
| 279 |
+ if (buf_end - ptr < 256 + 4 * c->slices) {
|
|
| 280 |
+ av_log(avctx, AV_LOG_ERROR, "Insufficient data for a plane\n"); |
|
| 281 |
+ return AVERROR_INVALIDDATA; |
|
| 282 |
+ } |
|
| 283 |
+ ptr += 256; |
|
| 284 |
+ slice_start = 0; |
|
| 285 |
+ slice_end = 0; |
|
| 286 |
+ for (j = 0; j < c->slices; j++) {
|
|
| 287 |
+ slice_end = bytestream_get_le32(&ptr); |
|
| 288 |
+ slice_size = slice_end - slice_start; |
|
| 289 |
+ if (slice_size < 0) {
|
|
| 290 |
+ av_log(avctx, AV_LOG_ERROR, "Incorrect slice size\n"); |
|
| 291 |
+ return AVERROR_INVALIDDATA; |
|
| 292 |
+ } |
|
| 293 |
+ slice_start = slice_end; |
|
| 294 |
+ max_slice_size = FFMAX(max_slice_size, slice_size); |
|
| 295 |
+ } |
|
| 296 |
+ plane_size = slice_end; |
|
| 297 |
+ if (buf_end - ptr < plane_size) {
|
|
| 298 |
+ av_log(avctx, AV_LOG_ERROR, "Plane size is bigger than available data\n"); |
|
| 299 |
+ return AVERROR_INVALIDDATA; |
|
| 300 |
+ } |
|
| 301 |
+ ptr += plane_size; |
|
| 302 |
+ } |
|
| 303 |
+ plane_start[c->planes] = ptr; |
|
| 304 |
+ if (buf_end - ptr < c->frame_info_size) {
|
|
| 305 |
+ av_log(avctx, AV_LOG_ERROR, "Not enough data for frame information\n"); |
|
| 306 |
+ return AVERROR_INVALIDDATA; |
|
| 307 |
+ } |
|
| 308 |
+ c->frame_info = AV_RL32(ptr); |
|
| 309 |
+ av_log(avctx, AV_LOG_DEBUG, "frame information flags %X\n", c->frame_info); |
|
| 310 |
+ |
|
| 311 |
+ c->frame_pred = (c->frame_info >> 8) & 3; |
|
| 312 |
+ |
|
| 313 |
+ if (c->frame_pred == PRED_GRADIENT) {
|
|
| 314 |
+ av_log_ask_for_sample(avctx, "Frame uses gradient prediction\n"); |
|
| 315 |
+ return AVERROR_PATCHWELCOME; |
|
| 316 |
+ } |
|
| 317 |
+ |
|
| 318 |
+ av_fast_malloc(&c->slice_bits, &c->slice_bits_size, |
|
| 319 |
+ max_slice_size + FF_INPUT_BUFFER_PADDING_SIZE); |
|
| 320 |
+ |
|
| 321 |
+ if (!c->slice_bits) {
|
|
| 322 |
+ av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer\n"); |
|
| 323 |
+ return AVERROR(ENOMEM); |
|
| 324 |
+ } |
|
| 325 |
+ |
|
| 326 |
+ switch (c->avctx->pix_fmt) {
|
|
| 327 |
+ case PIX_FMT_RGB24: |
|
| 328 |
+ case PIX_FMT_RGBA: |
|
| 329 |
+ for (i = 0; i < c->planes; i++) {
|
|
| 330 |
+ ret = decode_plane(c, i, c->pic.data[0] + rgb_order[i], c->planes, |
|
| 331 |
+ c->pic.linesize[0], avctx->width, avctx->height, |
|
| 332 |
+ plane_start[i], plane_start[i + 1] - plane_start[i], |
|
| 333 |
+ c->frame_pred == PRED_LEFT); |
|
| 334 |
+ if (ret) |
|
| 335 |
+ return ret; |
|
| 336 |
+ if (c->frame_pred == PRED_MEDIAN) |
|
| 337 |
+ restore_median(c->pic.data[0] + rgb_order[i], c->planes, |
|
| 338 |
+ c->pic.linesize[0], avctx->width, avctx->height, |
|
| 339 |
+ c->slices); |
|
| 340 |
+ } |
|
| 341 |
+ restore_rgb_planes(c->pic.data[0], c->planes, c->pic.linesize[0], |
|
| 342 |
+ avctx->width, avctx->height); |
|
| 343 |
+ break; |
|
| 344 |
+ case PIX_FMT_YUV420P: |
|
| 345 |
+ for (i = 0; i < 3; i++) {
|
|
| 346 |
+ ret = decode_plane(c, i, c->pic.data[i], 1, |
|
| 347 |
+ c->pic.linesize[i], avctx->width >> !!i, avctx->height >> !!i, |
|
| 348 |
+ plane_start[i], plane_start[i + 1] - plane_start[i], |
|
| 349 |
+ c->frame_pred == PRED_LEFT); |
|
| 350 |
+ if (ret) |
|
| 351 |
+ return ret; |
|
| 352 |
+ if (c->frame_pred == PRED_MEDIAN) |
|
| 353 |
+ restore_median(c->pic.data[i], 1, c->pic.linesize[i], |
|
| 354 |
+ avctx->width >> !!i, avctx->height >> !!i, |
|
| 355 |
+ c->slices); |
|
| 356 |
+ } |
|
| 357 |
+ break; |
|
| 358 |
+ case PIX_FMT_YUV422P: |
|
| 359 |
+ for (i = 0; i < 3; i++) {
|
|
| 360 |
+ ret = decode_plane(c, i, c->pic.data[i], 1, |
|
| 361 |
+ c->pic.linesize[i], avctx->width >> !!i, avctx->height, |
|
| 362 |
+ plane_start[i], plane_start[i + 1] - plane_start[i], |
|
| 363 |
+ c->frame_pred == PRED_LEFT); |
|
| 364 |
+ if (ret) |
|
| 365 |
+ return ret; |
|
| 366 |
+ if (c->frame_pred == PRED_MEDIAN) |
|
| 367 |
+ restore_median(c->pic.data[i], 1, c->pic.linesize[i], |
|
| 368 |
+ avctx->width >> !!i, avctx->height, c->slices); |
|
| 369 |
+ } |
|
| 370 |
+ break; |
|
| 371 |
+ } |
|
| 372 |
+ |
|
| 373 |
+ *data_size = sizeof(AVFrame); |
|
| 374 |
+ *(AVFrame*)data = c->pic; |
|
| 375 |
+ |
|
| 376 |
+ /* always report that the buffer was completely consumed */ |
|
| 377 |
+ return buf_size; |
|
| 378 |
+} |
|
| 379 |
+ |
|
| 380 |
+static av_cold int decode_init(AVCodecContext *avctx) |
|
| 381 |
+{
|
|
| 382 |
+ UtvideoContext * const c = avctx->priv_data; |
|
| 383 |
+ |
|
| 384 |
+ c->avctx = avctx; |
|
| 385 |
+ |
|
| 386 |
+ dsputil_init(&c->dsp, avctx); |
|
| 387 |
+ |
|
| 388 |
+ if (avctx->extradata_size < 16) {
|
|
| 389 |
+ av_log(avctx, AV_LOG_ERROR, "Insufficient extradata size %d, should be at least 16\n", |
|
| 390 |
+ avctx->extradata_size); |
|
| 391 |
+ return AVERROR_INVALIDDATA; |
|
| 392 |
+ } |
|
| 393 |
+ |
|
| 394 |
+ av_log(avctx, AV_LOG_DEBUG, "Encoder version %d.%d.%d.%d\n", |
|
| 395 |
+ avctx->extradata[3], avctx->extradata[2], |
|
| 396 |
+ avctx->extradata[1], avctx->extradata[0]); |
|
| 397 |
+ av_log(avctx, AV_LOG_DEBUG, "Original format %X\n", AV_RB32(avctx->extradata + 4)); |
|
| 398 |
+ c->frame_info_size = AV_RL32(avctx->extradata + 8); |
|
| 399 |
+ c->flags = AV_RL32(avctx->extradata + 12); |
|
| 400 |
+ |
|
| 401 |
+ if (c->frame_info_size != 4) |
|
| 402 |
+ av_log_ask_for_sample(avctx, "Frame info is not 4 bytes\n"); |
|
| 403 |
+ av_log(avctx, AV_LOG_DEBUG, "Encoding parameters %08X\n", c->flags); |
|
| 404 |
+ c->slices = (c->flags >> 24) + 1; |
|
| 405 |
+ c->compression = c->flags & 1; |
|
| 406 |
+ c->interlaced = c->flags & 0x800; |
|
| 407 |
+ |
|
| 408 |
+ c->slice_bits_size = 0; |
|
| 409 |
+ |
|
| 410 |
+ switch (avctx->codec_tag) {
|
|
| 411 |
+ case MKTAG('U', 'L', 'R', 'G'):
|
|
| 412 |
+ c->planes = 3; |
|
| 413 |
+ avctx->pix_fmt = PIX_FMT_RGB24; |
|
| 414 |
+ break; |
|
| 415 |
+ case MKTAG('U', 'L', 'R', 'A'):
|
|
| 416 |
+ c->planes = 4; |
|
| 417 |
+ avctx->pix_fmt = PIX_FMT_RGBA; |
|
| 418 |
+ break; |
|
| 419 |
+ case MKTAG('U', 'L', 'Y', '0'):
|
|
| 420 |
+ c->planes = 3; |
|
| 421 |
+ avctx->pix_fmt = PIX_FMT_YUV420P; |
|
| 422 |
+ break; |
|
| 423 |
+ case MKTAG('U', 'L', 'Y', '2'):
|
|
| 424 |
+ c->planes = 3; |
|
| 425 |
+ avctx->pix_fmt = PIX_FMT_YUV422P; |
|
| 426 |
+ break; |
|
| 427 |
+ default: |
|
| 428 |
+ av_log(avctx, AV_LOG_ERROR, "Unknown Ut Video FOURCC provided (%08X)\n", |
|
| 429 |
+ avctx->codec_tag); |
|
| 430 |
+ return AVERROR_INVALIDDATA; |
|
| 431 |
+ } |
|
| 432 |
+ |
|
| 433 |
+ return 0; |
|
| 434 |
+} |
|
| 435 |
+ |
|
| 436 |
+static av_cold int decode_end(AVCodecContext *avctx) |
|
| 437 |
+{
|
|
| 438 |
+ UtvideoContext * const c = avctx->priv_data; |
|
| 439 |
+ |
|
| 440 |
+ if (c->pic.data[0]) |
|
| 441 |
+ avctx->release_buffer(avctx, &c->pic); |
|
| 442 |
+ |
|
| 443 |
+ av_freep(&c->slice_bits); |
|
| 444 |
+ |
|
| 445 |
+ return 0; |
|
| 446 |
+} |
|
| 447 |
+ |
|
| 448 |
+AVCodec ff_utvideo_decoder = {
|
|
| 449 |
+ .name = "utvideo", |
|
| 450 |
+ .type = AVMEDIA_TYPE_VIDEO, |
|
| 451 |
+ .id = CODEC_ID_UTVIDEO, |
|
| 452 |
+ .priv_data_size = sizeof(UtvideoContext), |
|
| 453 |
+ .init = decode_init, |
|
| 454 |
+ .close = decode_end, |
|
| 455 |
+ .decode = decode_frame, |
|
| 456 |
+ .capabilities = CODEC_CAP_DR1, |
|
| 457 |
+ .long_name = NULL_IF_CONFIG_SMALL("Ut Video"),
|
|
| 458 |
+}; |
|
| 459 |
+ |
| ... | ... |
@@ -1291,6 +1291,7 @@ static av_always_inline int scaleforsame_x(VC1Context *v, int n /* MV */, int di |
| 1291 | 1291 |
int scaledvalue, refdist; |
| 1292 | 1292 |
int scalesame1, scalesame2; |
| 1293 | 1293 |
int scalezone1_x, zone1offset_x; |
| 1294 |
+ int table_index = dir ^ v->second_field; |
|
| 1294 | 1295 |
|
| 1295 | 1296 |
if (v->s.pict_type != AV_PICTURE_TYPE_B) |
| 1296 | 1297 |
refdist = v->refdist; |
| ... | ... |
@@ -1298,10 +1299,10 @@ static av_always_inline int scaleforsame_x(VC1Context *v, int n /* MV */, int di |
| 1298 | 1298 |
refdist = dir ? v->brfd : v->frfd; |
| 1299 | 1299 |
if (refdist > 3) |
| 1300 | 1300 |
refdist = 3; |
| 1301 |
- scalesame1 = vc1_field_mvpred_scales[v->second_field][1][refdist]; |
|
| 1302 |
- scalesame2 = vc1_field_mvpred_scales[v->second_field][2][refdist]; |
|
| 1303 |
- scalezone1_x = vc1_field_mvpred_scales[v->second_field][3][refdist]; |
|
| 1304 |
- zone1offset_x = vc1_field_mvpred_scales[v->second_field][5][refdist]; |
|
| 1301 |
+ scalesame1 = vc1_field_mvpred_scales[table_index][1][refdist]; |
|
| 1302 |
+ scalesame2 = vc1_field_mvpred_scales[table_index][2][refdist]; |
|
| 1303 |
+ scalezone1_x = vc1_field_mvpred_scales[table_index][3][refdist]; |
|
| 1304 |
+ zone1offset_x = vc1_field_mvpred_scales[table_index][5][refdist]; |
|
| 1305 | 1305 |
|
| 1306 | 1306 |
if (FFABS(n) > 255) |
| 1307 | 1307 |
scaledvalue = n; |
| ... | ... |
@@ -1323,6 +1324,7 @@ static av_always_inline int scaleforsame_y(VC1Context *v, int i, int n /* MV */, |
| 1323 | 1323 |
int scaledvalue, refdist; |
| 1324 | 1324 |
int scalesame1, scalesame2; |
| 1325 | 1325 |
int scalezone1_y, zone1offset_y; |
| 1326 |
+ int table_index = dir ^ v->second_field; |
|
| 1326 | 1327 |
|
| 1327 | 1328 |
if (v->s.pict_type != AV_PICTURE_TYPE_B) |
| 1328 | 1329 |
refdist = v->refdist; |
| ... | ... |
@@ -1330,10 +1332,10 @@ static av_always_inline int scaleforsame_y(VC1Context *v, int i, int n /* MV */, |
| 1330 | 1330 |
refdist = dir ? v->brfd : v->frfd; |
| 1331 | 1331 |
if (refdist > 3) |
| 1332 | 1332 |
refdist = 3; |
| 1333 |
- scalesame1 = vc1_field_mvpred_scales[v->second_field][1][refdist]; |
|
| 1334 |
- scalesame2 = vc1_field_mvpred_scales[v->second_field][2][refdist]; |
|
| 1335 |
- scalezone1_y = vc1_field_mvpred_scales[v->second_field][4][refdist]; |
|
| 1336 |
- zone1offset_y = vc1_field_mvpred_scales[v->second_field][6][refdist]; |
|
| 1333 |
+ scalesame1 = vc1_field_mvpred_scales[table_index][1][refdist]; |
|
| 1334 |
+ scalesame2 = vc1_field_mvpred_scales[table_index][2][refdist]; |
|
| 1335 |
+ scalezone1_y = vc1_field_mvpred_scales[table_index][4][refdist]; |
|
| 1336 |
+ zone1offset_y = vc1_field_mvpred_scales[table_index][6][refdist]; |
|
| 1337 | 1337 |
|
| 1338 | 1338 |
if (FFABS(n) > 63) |
| 1339 | 1339 |
scaledvalue = n; |
| ... | ... |
@@ -1444,7 +1446,7 @@ static av_always_inline int scaleforopp(VC1Context *v, int n /* MV */, |
| 1444 | 1444 |
refdist = FFMIN(v->refdist, 3); |
| 1445 | 1445 |
else |
| 1446 | 1446 |
refdist = dir ? v->brfd : v->frfd; |
| 1447 |
- scaleopp = vc1_field_mvpred_scales[v->second_field][0][refdist]; |
|
| 1447 |
+ scaleopp = vc1_field_mvpred_scales[dir ^ v->second_field][0][refdist]; |
|
| 1448 | 1448 |
|
| 1449 | 1449 |
return n * scaleopp >> 8; |
| 1450 | 1450 |
} |
| ... | ... |
@@ -21,7 +21,7 @@ |
| 21 | 21 |
#define AVCODEC_VERSION_H |
| 22 | 22 |
|
| 23 | 23 |
#define LIBAVCODEC_VERSION_MAJOR 53 |
| 24 |
-#define LIBAVCODEC_VERSION_MINOR 21 |
|
| 24 |
+#define LIBAVCODEC_VERSION_MINOR 22 |
|
| 25 | 25 |
#define LIBAVCODEC_VERSION_MICRO 0 |
| 26 | 26 |
|
| 27 | 27 |
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |
| ... | ... |
@@ -108,7 +108,7 @@ av_cold static int fbdev_read_header(AVFormatContext *avctx, |
| 108 | 108 |
return ret; |
| 109 | 109 |
} |
| 110 | 110 |
|
| 111 |
- if (!(st = av_new_stream(avctx, 0))) |
|
| 111 |
+ if (!(st = avformat_new_stream(avctx, NULL))) |
|
| 112 | 112 |
return AVERROR(ENOMEM); |
| 113 | 113 |
av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in microseconds */ |
| 114 | 114 |
|
| ... | ... |
@@ -229,7 +229,7 @@ static int audio_read_header(AVFormatContext *context, AVFormatParameters *param |
| 229 | 229 |
if ((test = start_jack(context))) |
| 230 | 230 |
return test; |
| 231 | 231 |
|
| 232 |
- stream = av_new_stream(context, 0); |
|
| 232 |
+ stream = avformat_new_stream(context, NULL); |
|
| 233 | 233 |
if (!stream) {
|
| 234 | 234 |
stop_jack(self); |
| 235 | 235 |
return AVERROR(ENOMEM); |
| ... | ... |
@@ -54,7 +54,7 @@ static av_cold int read_header(AVFormatContext *ctx, AVFormatParameters *ap) |
| 54 | 54 |
int ret, i; |
| 55 | 55 |
char *err = NULL; |
| 56 | 56 |
|
| 57 |
- if (!(st = av_new_stream(ctx, 0))) |
|
| 57 |
+ if (!(st = avformat_new_stream(ctx, NULL))) |
|
| 58 | 58 |
return AVERROR(ENOMEM); |
| 59 | 59 |
s->drive = cdio_cddap_identify(ctx->filename, CDDA_MESSAGE_LOGIT, &err); |
| 60 | 60 |
if (!s->drive) {
|
| ... | ... |
@@ -253,7 +253,7 @@ static int dc1394_read_header(AVFormatContext *c, AVFormatParameters * ap) |
| 253 | 253 |
} |
| 254 | 254 |
|
| 255 | 255 |
/* create a video stream */ |
| 256 |
- vst = av_new_stream(c, 0); |
|
| 256 |
+ vst = avformat_new_stream(c, NULL); |
|
| 257 | 257 |
if (!vst) |
| 258 | 258 |
goto out_camera; |
| 259 | 259 |
av_set_pts_info(vst, 64, 1, 1000); |
| ... | ... |
@@ -98,7 +98,7 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap) |
| 98 | 98 |
s->video_win.width = ap->width; |
| 99 | 99 |
s->video_win.height = ap->height; |
| 100 | 100 |
|
| 101 |
- st = av_new_stream(s1, 0); |
|
| 101 |
+ st = avformat_new_stream(s1, NULL); |
|
| 102 | 102 |
if (!st) |
| 103 | 103 |
return AVERROR(ENOMEM); |
| 104 | 104 |
av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */ |
| ... | ... |
@@ -560,7 +560,7 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap) |
| 560 | 560 |
enum CodecID codec_id; |
| 561 | 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 | 564 |
if (!st) {
|
| 565 | 565 |
res = AVERROR(ENOMEM); |
| 566 | 566 |
goto out; |
| ... | ... |
@@ -293,7 +293,7 @@ static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 293 | 293 |
|
| 294 | 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 | 297 |
if(!st) {
|
| 298 | 298 |
vfw_read_close(s); |
| 299 | 299 |
return AVERROR(ENOMEM); |
| ... | ... |
@@ -30,7 +30,7 @@ |
| 30 | 30 |
|
| 31 | 31 |
#define LIBAVFILTER_VERSION_MAJOR 2 |
| 32 | 32 |
#define LIBAVFILTER_VERSION_MINOR 44 |
| 33 |
-#define LIBAVFILTER_VERSION_MICRO 0 |
|
| 33 |
+#define LIBAVFILTER_VERSION_MICRO 1 |
|
| 34 | 34 |
|
| 35 | 35 |
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ |
| 36 | 36 |
LIBAVFILTER_VERSION_MINOR, \ |
| ... | ... |
@@ -103,7 +103,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) |
| 103 | 103 |
test->nb_frame = 0; |
| 104 | 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 | 107 |
test->w, test->h, frame_rate_q.num, frame_rate_q.den, |
| 108 | 108 |
duration < 0 ? -1 : test->max_pts * av_q2d(test->time_base), |
| 109 | 109 |
test->sar.num, test->sar.den); |
| ... | ... |
@@ -156,9 +156,9 @@ static const char *testsrc_get_name(void *ctx) |
| 156 | 156 |
} |
| 157 | 157 |
|
| 158 | 158 |
static const AVClass testsrc_class = {
|
| 159 |
- "TestSourceContext", |
|
| 160 |
- testsrc_get_name, |
|
| 161 |
- testsrc_options |
|
| 159 |
+ .class_name = "TestSourceContext", |
|
| 160 |
+ .item_name = testsrc_get_name, |
|
| 161 |
+ .option = testsrc_options, |
|
| 162 | 162 |
}; |
| 163 | 163 |
|
| 164 | 164 |
/** |
| ... | ... |
@@ -378,9 +378,9 @@ static const char *rgbtestsrc_get_name(void *ctx) |
| 378 | 378 |
} |
| 379 | 379 |
|
| 380 | 380 |
static const AVClass rgbtestsrc_class = {
|
| 381 |
- "RGBTestSourceContext", |
|
| 382 |
- rgbtestsrc_get_name, |
|
| 383 |
- testsrc_options |
|
| 381 |
+ .class_name = "RGBTestSourceContext", |
|
| 382 |
+ .item_name = rgbtestsrc_get_name, |
|
| 383 |
+ .option = testsrc_options, |
|
| 384 | 384 |
}; |
| 385 | 385 |
|
| 386 | 386 |
#define R 0 |
| ... | ... |
@@ -141,7 +141,7 @@ static int fourxm_read_header(AVFormatContext *s, |
| 141 | 141 |
fourxm->height = AV_RL32(&header[i + 40]); |
| 142 | 142 |
|
| 143 | 143 |
/* allocate a new AVStream */ |
| 144 |
- st = av_new_stream(s, 0); |
|
| 144 |
+ st = avformat_new_stream(s, NULL); |
|
| 145 | 145 |
if (!st){
|
| 146 | 146 |
ret= AVERROR(ENOMEM); |
| 147 | 147 |
goto fail; |
| ... | ... |
@@ -199,12 +199,13 @@ static int fourxm_read_header(AVFormatContext *s, |
| 199 | 199 |
i += 8 + size; |
| 200 | 200 |
|
| 201 | 201 |
/* allocate a new AVStream */ |
| 202 |
- st = av_new_stream(s, current_track); |
|
| 202 |
+ st = avformat_new_stream(s, NULL); |
|
| 203 | 203 |
if (!st){
|
| 204 | 204 |
ret= AVERROR(ENOMEM); |
| 205 | 205 |
goto fail; |
| 206 | 206 |
} |
| 207 | 207 |
|
| 208 |
+ st->id = current_track; |
|
| 208 | 209 |
av_set_pts_info(st, 60, 1, fourxm->tracks[current_track].sample_rate); |
| 209 | 210 |
|
| 210 | 211 |
fourxm->tracks[current_track].stream_index = st->index; |
| ... | ... |
@@ -57,7 +57,7 @@ static int aea_read_probe(AVProbeData *p) |
| 57 | 57 |
static int aea_read_header(AVFormatContext *s, |
| 58 | 58 |
AVFormatParameters *ap) |
| 59 | 59 |
{
|
| 60 |
- AVStream *st = av_new_stream(s, 0); |
|
| 60 |
+ AVStream *st = avformat_new_stream(s, NULL); |
|
| 61 | 61 |
if (!st) |
| 62 | 62 |
return AVERROR(ENOMEM); |
| 63 | 63 |
|
| ... | ... |
@@ -97,7 +97,7 @@ static int read_header(AVFormatContext *s, |
| 97 | 97 |
return AVERROR_INVALIDDATA; |
| 98 | 98 |
|
| 99 | 99 |
/* video stream */ |
| 100 |
- st = av_new_stream(s, 0); |
|
| 100 |
+ st = avformat_new_stream(s, NULL); |
|
| 101 | 101 |
if (!st) |
| 102 | 102 |
return AVERROR(ENOMEM); |
| 103 | 103 |
st->codec->codec_type = AVMEDIA_TYPE_VIDEO; |
| ... | ... |
@@ -313,7 +313,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) |
| 313 | 313 |
ape->compressiontype); |
| 314 | 314 |
|
| 315 | 315 |
/* now we are ready: build format streams */ |
| 316 |
- st = av_new_stream(s, 0); |
|
| 316 |
+ st = avformat_new_stream(s, NULL); |
|
| 317 | 317 |
if (!st) |
| 318 | 318 |
return -1; |
| 319 | 319 |
|
| ... | ... |
@@ -505,11 +505,12 @@ static int applehttp_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 505 | 505 |
snprintf(bitrate_str, sizeof(bitrate_str), "%d", v->bandwidth); |
| 506 | 506 |
/* Create new AVStreams for each stream in this variant */ |
| 507 | 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 | 509 |
if (!st) {
|
| 510 | 510 |
ret = AVERROR(ENOMEM); |
| 511 | 511 |
goto fail; |
| 512 | 512 |
} |
| 513 |
+ st->id = i; |
|
| 513 | 514 |
avcodec_copy_context(st->codec, v->ctx->streams[j]->codec); |
| 514 | 515 |
if (v->bandwidth) |
| 515 | 516 |
av_dict_set(&st->metadata, "variant_bitrate", bitrate_str, |
| ... | ... |
@@ -224,7 +224,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) |
| 224 | 224 |
|
| 225 | 225 |
pos1 = avio_tell(pb); |
| 226 | 226 |
|
| 227 |
- st = av_new_stream(s, 0); |
|
| 227 |
+ st = avformat_new_stream(s, NULL); |
|
| 228 | 228 |
if (!st) |
| 229 | 229 |
return AVERROR(ENOMEM); |
| 230 | 230 |
av_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */ |
| ... | ... |
@@ -156,7 +156,7 @@ static int au_read_header(AVFormatContext *s, |
| 156 | 156 |
} |
| 157 | 157 |
|
| 158 | 158 |
/* now we are ready: build format streams */ |
| 159 |
- st = av_new_stream(s, 0); |
|
| 159 |
+ st = avformat_new_stream(s, NULL); |
|
| 160 | 160 |
if (!st) |
| 161 | 161 |
return -1; |
| 162 | 162 |
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| ... | ... |
@@ -1402,6 +1402,7 @@ void av_close_input_file(AVFormatContext *s); |
| 1402 | 1402 |
*/ |
| 1403 | 1403 |
void avformat_free_context(AVFormatContext *s); |
| 1404 | 1404 |
|
| 1405 |
+#if FF_API_NEW_STREAM |
|
| 1405 | 1406 |
/** |
| 1406 | 1407 |
* Add a new stream to a media file. |
| 1407 | 1408 |
* |
| ... | ... |
@@ -1412,7 +1413,27 @@ void avformat_free_context(AVFormatContext *s); |
| 1412 | 1412 |
* @param s media file handle |
| 1413 | 1413 |
* @param id file-format-dependent stream ID |
| 1414 | 1414 |
*/ |
| 1415 |
+attribute_deprecated |
|
| 1415 | 1416 |
AVStream *av_new_stream(AVFormatContext *s, int id); |
| 1417 |
+#endif |
|
| 1418 |
+ |
|
| 1419 |
+/** |
|
| 1420 |
+ * Add a new stream to a media file. |
|
| 1421 |
+ * |
|
| 1422 |
+ * When demuxing, it is called by the demuxer in read_header(). If the |
|
| 1423 |
+ * flag AVFMTCTX_NOHEADER is set in s.ctx_flags, then it may also |
|
| 1424 |
+ * be called in read_packet(). |
|
| 1425 |
+ * |
|
| 1426 |
+ * When muxing, should be called by the user before avformat_write_header(). |
|
| 1427 |
+ * |
|
| 1428 |
+ * @param c If non-NULL, the AVCodecContext corresponding to the new stream |
|
| 1429 |
+ * will be initialized to use this codec. This is needed for e.g. codec-specific |
|
| 1430 |
+ * defaults to be set, so codec should be provided if it is known. |
|
| 1431 |
+ * |
|
| 1432 |
+ * @return newly created stream or NULL on error. |
|
| 1433 |
+ */ |
|
| 1434 |
+AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c); |
|
| 1435 |
+ |
|
| 1416 | 1436 |
AVProgram *av_new_program(AVFormatContext *s, int id); |
| 1417 | 1437 |
|
| 1418 | 1438 |
/** |
| ... | ... |
@@ -454,10 +454,11 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 454 | 454 |
break; |
| 455 | 455 |
}else{
|
| 456 | 456 |
stream_index++; |
| 457 |
- st = av_new_stream(s, stream_index); |
|
| 457 |
+ st = avformat_new_stream(s, NULL); |
|
| 458 | 458 |
if (!st) |
| 459 | 459 |
goto fail; |
| 460 | 460 |
|
| 461 |
+ st->id = stream_index; |
|
| 461 | 462 |
ast = av_mallocz(sizeof(AVIStream)); |
| 462 | 463 |
if (!ast) |
| 463 | 464 |
goto fail; |
| ... | ... |
@@ -84,7 +84,8 @@ static int avisynth_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 84 | 84 |
if (AVIStreamReadFormat(stream->handle, 0, &wvfmt, &struct_size) != S_OK) |
| 85 | 85 |
continue; |
| 86 | 86 |
|
| 87 |
- st = av_new_stream(s, id); |
|
| 87 |
+ st = avformat_new_stream(s, NULL); |
|
| 88 |
+ st->id = id; |
|
| 88 | 89 |
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| 89 | 90 |
|
| 90 | 91 |
st->codec->block_align = wvfmt.nBlockAlign; |
| ... | ... |
@@ -110,7 +111,8 @@ static int avisynth_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 110 | 110 |
if (AVIStreamReadFormat(stream->handle, 0, &imgfmt, &struct_size) != S_OK) |
| 111 | 111 |
continue; |
| 112 | 112 |
|
| 113 |
- st = av_new_stream(s, id); |
|
| 113 |
+ st = avformat_new_stream(s, NULL); |
|
| 114 |
+ st->id = id; |
|
| 114 | 115 |
st->codec->codec_type = AVMEDIA_TYPE_VIDEO; |
| 115 | 116 |
st->r_frame_rate.num = stream->info.dwRate; |
| 116 | 117 |
st->r_frame_rate.den = stream->info.dwScale; |
| ... | ... |
@@ -179,7 +179,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt) |
| 179 | 179 |
|
| 180 | 180 |
case AVS_VIDEO: |
| 181 | 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 | 183 |
if (avs->st_video == NULL) |
| 184 | 184 |
return AVERROR(ENOMEM); |
| 185 | 185 |
avs->st_video->codec->codec_type = AVMEDIA_TYPE_VIDEO; |
| ... | ... |
@@ -196,7 +196,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt) |
| 196 | 196 |
|
| 197 | 197 |
case AVS_AUDIO: |
| 198 | 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 | 200 |
if (avs->st_audio == NULL) |
| 201 | 201 |
return AVERROR(ENOMEM); |
| 202 | 202 |
avs->st_audio->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| ... | ... |
@@ -70,7 +70,7 @@ static int vid_read_header(AVFormatContext *s, |
| 70 | 70 |
avio_skip(pb, 5); |
| 71 | 71 |
vid->nframes = avio_rl16(pb); |
| 72 | 72 |
|
| 73 |
- stream = av_new_stream(s, 0); |
|
| 73 |
+ stream = avformat_new_stream(s, NULL); |
|
| 74 | 74 |
if (!stream) |
| 75 | 75 |
return AVERROR(ENOMEM); |
| 76 | 76 |
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, |
| 83 | 83 |
avio_rl16(pb); |
| 84 | 84 |
|
| 85 | 85 |
// done with video codec, set up audio codec |
| 86 |
- stream = av_new_stream(s, 0); |
|
| 86 |
+ stream = avformat_new_stream(s, NULL); |
|
| 87 | 87 |
if (!stream) |
| 88 | 88 |
return AVERROR(ENOMEM); |
| 89 | 89 |
stream->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| ... | ... |
@@ -55,12 +55,12 @@ static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap) |
| 55 | 55 |
int fps, chunk_header; |
| 56 | 56 |
|
| 57 | 57 |
/* Initialize the video codec... */ |
| 58 |
- vstream = av_new_stream(s, 0); |
|
| 58 |
+ vstream = avformat_new_stream(s, NULL); |
|
| 59 | 59 |
if (!vstream) |
| 60 | 60 |
return AVERROR(ENOMEM); |
| 61 | 61 |
|
| 62 | 62 |
/* Initialize the audio codec... */ |
| 63 |
- astream = av_new_stream(s, 0); |
|
| 63 |
+ astream = avformat_new_stream(s, NULL); |
|
| 64 | 64 |
if (!astream) |
| 65 | 65 |
return AVERROR(ENOMEM); |
| 66 | 66 |
|
| ... | ... |
@@ -78,7 +78,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 78 | 78 |
uint16_t flags; |
| 79 | 79 |
int keyframe; |
| 80 | 80 |
|
| 81 |
- vst = av_new_stream(s, 0); |
|
| 81 |
+ vst = avformat_new_stream(s, NULL); |
|
| 82 | 82 |
if (!vst) |
| 83 | 83 |
return AVERROR(ENOMEM); |
| 84 | 84 |
|
| ... | ... |
@@ -130,7 +130,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 130 | 130 |
avio_skip(pb, 4 * bink->num_audio_tracks); |
| 131 | 131 |
|
| 132 | 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 | 134 |
if (!ast) |
| 135 | 135 |
return AVERROR(ENOMEM); |
| 136 | 136 |
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| ... | ... |
@@ -79,7 +79,7 @@ static int read_header(AVFormatContext *s, |
| 79 | 79 |
/* Audio streams are added if audio packets are found */ |
| 80 | 80 |
s->ctx_flags |= AVFMTCTX_NOHEADER; |
| 81 | 81 |
|
| 82 |
- video = av_new_stream(s, 0); |
|
| 82 |
+ video = avformat_new_stream(s, NULL); |
|
| 83 | 83 |
if (!video) |
| 84 | 84 |
return AVERROR(ENOMEM); |
| 85 | 85 |
|
| ... | ... |
@@ -117,7 +117,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) |
| 117 | 117 |
datasize = avio_rl16(pb); |
| 118 | 118 |
if (datasize > 42) {
|
| 119 | 119 |
if (!c93->audio) {
|
| 120 |
- c93->audio = av_new_stream(s, 1); |
|
| 120 |
+ c93->audio = avformat_new_stream(s, NULL); |
|
| 121 | 121 |
if (!c93->audio) |
| 122 | 122 |
return AVERROR(ENOMEM); |
| 123 | 123 |
c93->audio->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| ... | ... |
@@ -21,7 +21,7 @@ |
| 21 | 21 |
#include "avformat.h" |
| 22 | 22 |
|
| 23 | 23 |
static int daud_header(AVFormatContext *s, AVFormatParameters *ap) {
|
| 24 |
- AVStream *st = av_new_stream(s, 0); |
|
| 24 |
+ AVStream *st = avformat_new_stream(s, NULL); |
|
| 25 | 25 |
if (!st) |
| 26 | 26 |
return AVERROR(ENOMEM); |
| 27 | 27 |
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| ... | ... |
@@ -107,7 +107,7 @@ static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 107 | 107 |
cin->audio_buffer_size = 0; |
| 108 | 108 |
|
| 109 | 109 |
/* initialize the video decoder stream */ |
| 110 |
- st = av_new_stream(s, 0); |
|
| 110 |
+ st = avformat_new_stream(s, NULL); |
|
| 111 | 111 |
if (!st) |
| 112 | 112 |
return AVERROR(ENOMEM); |
| 113 | 113 |
|
| ... | ... |
@@ -120,7 +120,7 @@ static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 120 | 120 |
st->codec->height = hdr->video_frame_height; |
| 121 | 121 |
|
| 122 | 122 |
/* initialize the audio decoder stream */ |
| 123 |
- st = av_new_stream(s, 0); |
|
| 123 |
+ st = avformat_new_stream(s, NULL); |
|
| 124 | 124 |
if (!st) |
| 125 | 125 |
return AVERROR(ENOMEM); |
| 126 | 126 |
|
| ... | ... |
@@ -211,7 +211,7 @@ static int dv_extract_audio_info(DVDemuxContext* c, uint8_t* frame) |
| 211 | 211 |
/* Dynamic handling of the audio streams in DV */ |
| 212 | 212 |
for (i = 0; i < ach; i++) {
|
| 213 | 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 | 215 |
if (!c->ast[i]) |
| 216 | 216 |
break; |
| 217 | 217 |
av_set_pts_info(c->ast[i], 64, 1, 30000); |
| ... | ... |
@@ -278,7 +278,7 @@ DVDemuxContext* dv_init_demux(AVFormatContext *s) |
| 278 | 278 |
if (!c) |
| 279 | 279 |
return NULL; |
| 280 | 280 |
|
| 281 |
- c->vst = av_new_stream(s, 0); |
|
| 281 |
+ c->vst = avformat_new_stream(s, NULL); |
|
| 282 | 282 |
if (!c->vst) {
|
| 283 | 283 |
av_free(c); |
| 284 | 284 |
return NULL; |
| ... | ... |
@@ -87,7 +87,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 87 | 87 |
h = avio_rb16(pb); |
| 88 | 88 |
c->has_sound = 0; |
| 89 | 89 |
|
| 90 |
- st = av_new_stream(s, 0); |
|
| 90 |
+ st = avformat_new_stream(s, NULL); |
|
| 91 | 91 |
if (!st) |
| 92 | 92 |
return -1; |
| 93 | 93 |
|
| ... | ... |
@@ -100,7 +100,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 100 | 100 |
avio_skip(pb, 16); |
| 101 | 101 |
fsize = avio_rl32(pb); |
| 102 | 102 |
|
| 103 |
- ast = av_new_stream(s, 0); |
|
| 103 |
+ ast = avformat_new_stream(s, NULL); |
|
| 104 | 104 |
if (!ast) |
| 105 | 105 |
return -1; |
| 106 | 106 |
ret = ff_get_wav_header(pb, ast->codec, fsize); |
| ... | ... |
@@ -66,7 +66,7 @@ static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 66 | 66 |
sample_rate = avio_rb16(pb); |
| 67 | 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 | 70 |
if (!st) |
| 71 | 71 |
return AVERROR(ENOMEM); |
| 72 | 72 |
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| ... | ... |
@@ -408,7 +408,7 @@ static int ea_read_header(AVFormatContext *s, |
| 408 | 408 |
|
| 409 | 409 |
if (ea->video_codec) {
|
| 410 | 410 |
/* initialize the video decoder stream */ |
| 411 |
- st = av_new_stream(s, 0); |
|
| 411 |
+ st = avformat_new_stream(s, NULL); |
|
| 412 | 412 |
if (!st) |
| 413 | 413 |
return AVERROR(ENOMEM); |
| 414 | 414 |
ea->video_stream_index = st->index; |
| ... | ... |
@@ -437,7 +437,7 @@ static int ea_read_header(AVFormatContext *s, |
| 437 | 437 |
} |
| 438 | 438 |
|
| 439 | 439 |
/* initialize the audio decoder stream */ |
| 440 |
- st = av_new_stream(s, 0); |
|
| 440 |
+ st = avformat_new_stream(s, NULL); |
|
| 441 | 441 |
if (!st) |
| 442 | 442 |
return AVERROR(ENOMEM); |
| 443 | 443 |
av_set_pts_info(st, 33, 1, ea->sample_rate); |
| ... | ... |
@@ -132,7 +132,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 132 | 132 |
get_line(s->pb, line, sizeof(line)); |
| 133 | 133 |
|
| 134 | 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 | 137 |
if (!st) |
| 138 | 138 |
return -1; |
| ... | ... |
@@ -31,7 +31,7 @@ static int flac_read_header(AVFormatContext *s, |
| 31 | 31 |
int ret, metadata_last=0, metadata_type, metadata_size, found_streaminfo=0; |
| 32 | 32 |
uint8_t header[4]; |
| 33 | 33 |
uint8_t *buffer=NULL; |
| 34 |
- AVStream *st = av_new_stream(s, 0); |
|
| 34 |
+ AVStream *st = avformat_new_stream(s, NULL); |
|
| 35 | 35 |
if (!st) |
| 36 | 36 |
return AVERROR(ENOMEM); |
| 37 | 37 |
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| ... | ... |
@@ -105,7 +105,7 @@ static int flic_read_header(AVFormatContext *s, |
| 105 | 105 |
speed = FLIC_DEFAULT_SPEED; |
| 106 | 106 |
|
| 107 | 107 |
/* initialize the decoder streams */ |
| 108 |
- st = av_new_stream(s, 0); |
|
| 108 |
+ st = avformat_new_stream(s, NULL); |
|
| 109 | 109 |
if (!st) |
| 110 | 110 |
return AVERROR(ENOMEM); |
| 111 | 111 |
flic->video_stream_index = st->index; |
| ... | ... |
@@ -145,7 +145,7 @@ static int flic_read_header(AVFormatContext *s, |
| 145 | 145 |
*/ |
| 146 | 146 |
if (AV_RL16(&preamble[4]) == FLIC_TFTD_CHUNK_AUDIO) {
|
| 147 | 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 | 149 |
if (!ast) |
| 150 | 150 |
return AVERROR(ENOMEM); |
| 151 | 151 |
|
| ... | ... |
@@ -347,9 +347,10 @@ static int flv_read_metabody(AVFormatContext *s, int64_t next_pos) {
|
| 347 | 347 |
} |
| 348 | 348 |
|
| 349 | 349 |
static 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 | 351 |
if (!st) |
| 352 | 352 |
return NULL; |
| 353 |
+ st->id = stream_type; |
|
| 353 | 354 |
switch(stream_type) {
|
| 354 | 355 |
case FLV_STREAM_TYPE_VIDEO: st->codec->codec_type = AVMEDIA_TYPE_VIDEO; break; |
| 355 | 356 |
case FLV_STREAM_TYPE_AUDIO: st->codec->codec_type = AVMEDIA_TYPE_AUDIO; break; |
| ... | ... |
@@ -81,9 +81,10 @@ static int get_sindex(AVFormatContext *s, int id, int format) {
|
| 81 | 81 |
i = ff_find_stream_index(s, id); |
| 82 | 82 |
if (i >= 0) |
| 83 | 83 |
return i; |
| 84 |
- st = av_new_stream(s, id); |
|
| 84 |
+ st = avformat_new_stream(s, NULL); |
|
| 85 | 85 |
if (!st) |
| 86 | 86 |
return AVERROR(ENOMEM); |
| 87 |
+ st->id = id; |
|
| 87 | 88 |
switch (format) {
|
| 88 | 89 |
case 3: |
| 89 | 90 |
case 4: |
| ... | ... |
@@ -153,7 +153,7 @@ static int idcin_read_header(AVFormatContext *s, |
| 153 | 153 |
bytes_per_sample = avio_rl32(pb); |
| 154 | 154 |
channels = avio_rl32(pb); |
| 155 | 155 |
|
| 156 |
- st = av_new_stream(s, 0); |
|
| 156 |
+ st = avformat_new_stream(s, NULL); |
|
| 157 | 157 |
if (!st) |
| 158 | 158 |
return AVERROR(ENOMEM); |
| 159 | 159 |
av_set_pts_info(st, 33, 1, IDCIN_FPS); |
| ... | ... |
@@ -174,7 +174,7 @@ static int idcin_read_header(AVFormatContext *s, |
| 174 | 174 |
/* if sample rate is 0, assume no audio */ |
| 175 | 175 |
if (sample_rate) {
|
| 176 | 176 |
idcin->audio_present = 1; |
| 177 |
- st = av_new_stream(s, 0); |
|
| 177 |
+ st = avformat_new_stream(s, NULL); |
|
| 178 | 178 |
if (!st) |
| 179 | 179 |
return AVERROR(ENOMEM); |
| 180 | 180 |
av_set_pts_info(st, 33, 1, IDCIN_FPS); |
| ... | ... |
@@ -84,7 +84,7 @@ static int roq_read_header(AVFormatContext *s, |
| 84 | 84 |
roq->audio_frame_count = 0; |
| 85 | 85 |
roq->audio_stream_index = -1; |
| 86 | 86 |
|
| 87 |
- st = av_new_stream(s, 0); |
|
| 87 |
+ st = avformat_new_stream(s, NULL); |
|
| 88 | 88 |
if (!st) |
| 89 | 89 |
return AVERROR(ENOMEM); |
| 90 | 90 |
av_set_pts_info(st, 63, 1, framerate); |
| ... | ... |
@@ -166,7 +166,7 @@ static int roq_read_packet(AVFormatContext *s, |
| 166 | 166 |
case RoQ_SOUND_MONO: |
| 167 | 167 |
case RoQ_SOUND_STEREO: |
| 168 | 168 |
if (roq->audio_stream_index == -1) {
|
| 169 |
- AVStream *st = av_new_stream(s, 1); |
|
| 169 |
+ AVStream *st = avformat_new_stream(s, NULL); |
|
| 170 | 170 |
if (!st) |
| 171 | 171 |
return AVERROR(ENOMEM); |
| 172 | 172 |
av_set_pts_info(st, 32, 1, RoQ_AUDIO_SAMPLE_RATE); |
| ... | ... |
@@ -559,7 +559,7 @@ static int ipmovie_read_header(AVFormatContext *s, |
| 559 | 559 |
return AVERROR_INVALIDDATA; |
| 560 | 560 |
|
| 561 | 561 |
/* initialize the stream decoders */ |
| 562 |
- st = av_new_stream(s, 0); |
|
| 562 |
+ st = avformat_new_stream(s, NULL); |
|
| 563 | 563 |
if (!st) |
| 564 | 564 |
return AVERROR(ENOMEM); |
| 565 | 565 |
av_set_pts_info(st, 63, 1, 1000000); |
| ... | ... |
@@ -572,7 +572,7 @@ static int ipmovie_read_header(AVFormatContext *s, |
| 572 | 572 |
st->codec->bits_per_coded_sample = ipmovie->video_bpp; |
| 573 | 573 |
|
| 574 | 574 |
if (ipmovie->audio_type) {
|
| 575 |
- st = av_new_stream(s, 0); |
|
| 575 |
+ st = avformat_new_stream(s, NULL); |
|
| 576 | 576 |
if (!st) |
| 577 | 577 |
return AVERROR(ENOMEM); |
| 578 | 578 |
av_set_pts_info(st, 32, 1, ipmovie->audio_sample_rate); |
| ... | ... |
@@ -88,7 +88,7 @@ static av_cold int iss_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 88 | 88 |
|
| 89 | 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 | 92 |
if (!st) |
| 93 | 93 |
return AVERROR(ENOMEM); |
| 94 | 94 |
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| ... | ... |
@@ -69,8 +69,8 @@ static int read_header(AVFormatContext *s, |
| 69 | 69 |
|
| 70 | 70 |
avio_skip(pb, 80); |
| 71 | 71 |
|
| 72 |
- ast = av_new_stream(s, 0); |
|
| 73 |
- vst = av_new_stream(s, 1); |
|
| 72 |
+ ast = avformat_new_stream(s, NULL); |
|
| 73 |
+ vst = avformat_new_stream(s, NULL); |
|
| 74 | 74 |
if (!ast || !vst) |
| 75 | 75 |
return AVERROR(ENOMEM); |
| 76 | 76 |
|
| ... | ... |
@@ -213,7 +213,7 @@ static int nut_read_header(AVFormatContext * avf, AVFormatParameters * ap) {
|
| 213 | 213 |
priv->s = s; |
| 214 | 214 |
|
| 215 | 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 | 217 |
int j; |
| 218 | 218 |
|
| 219 | 219 |
for (j = 0; j < s[i].fourcc_len && j < 8; j++) st->codec->codec_tag |= s[i].fourcc[j]<<(j*8); |
| ... | ... |
@@ -60,14 +60,14 @@ static int lmlm4_probe(AVProbeData * pd) {
|
| 60 | 60 |
static int lmlm4_read_header(AVFormatContext *s, AVFormatParameters *ap) {
|
| 61 | 61 |
AVStream *st; |
| 62 | 62 |
|
| 63 |
- if (!(st = av_new_stream(s, 0))) |
|
| 63 |
+ if (!(st = avformat_new_stream(s, NULL))) |
|
| 64 | 64 |
return AVERROR(ENOMEM); |
| 65 | 65 |
st->codec->codec_type = AVMEDIA_TYPE_VIDEO; |
| 66 | 66 |
st->codec->codec_id = CODEC_ID_MPEG4; |
| 67 | 67 |
st->need_parsing = AVSTREAM_PARSE_HEADERS; |
| 68 | 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 | 71 |
return AVERROR(ENOMEM); |
| 72 | 72 |
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| 73 | 73 |
st->codec->codec_id = CODEC_ID_MP2; |
| ... | ... |
@@ -217,7 +217,7 @@ static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 217 | 217 |
if ((ret = avio_read(pb, header_data, LXF_HEADER_DATA_SIZE)) != LXF_HEADER_DATA_SIZE) |
| 218 | 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 | 221 |
return AVERROR(ENOMEM); |
| 222 | 222 |
|
| 223 | 223 |
st->duration = AV_RL32(&header_data[32]); |
| ... | ... |
@@ -243,7 +243,7 @@ static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 243 | 243 |
av_log(s, AV_LOG_WARNING, "VBI data not yet supported\n"); |
| 244 | 244 |
|
| 245 | 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 | 247 |
return AVERROR(ENOMEM); |
| 248 | 248 |
|
| 249 | 249 |
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| ... | ... |
@@ -1444,7 +1444,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 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 | 1448 |
if (st == NULL) |
| 1449 | 1449 |
return AVERROR(ENOMEM); |
| 1450 | 1450 |
|
| ... | ... |
@@ -1639,7 +1639,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 1639 | 1639 |
attachements[j].bin.data && attachements[j].bin.size > 0)) {
|
| 1640 | 1640 |
av_log(matroska->ctx, AV_LOG_ERROR, "incomplete attachment\n"); |
| 1641 | 1641 |
} else {
|
| 1642 |
- AVStream *st = av_new_stream(s, 0); |
|
| 1642 |
+ AVStream *st = avformat_new_stream(s, NULL); |
|
| 1643 | 1643 |
if (st == NULL) |
| 1644 | 1644 |
break; |
| 1645 | 1645 |
av_dict_set(&st->metadata, "filename",attachements[j].filename, 0); |
| ... | ... |
@@ -105,7 +105,7 @@ static int read_header(AVFormatContext *s, |
| 105 | 105 |
avio_skip(pb, length - 10); /* unknown data */ |
| 106 | 106 |
|
| 107 | 107 |
/* video stream */ |
| 108 |
- st = av_new_stream(s, 0); |
|
| 108 |
+ st = avformat_new_stream(s, NULL); |
|
| 109 | 109 |
if (!st) |
| 110 | 110 |
return AVERROR(ENOMEM); |
| 111 | 111 |
st->codec->codec_type = AVMEDIA_TYPE_VIDEO; |
| ... | ... |
@@ -117,7 +117,7 @@ static int read_header(AVFormatContext *s, |
| 117 | 117 |
|
| 118 | 118 |
/* audio stream */ |
| 119 | 119 |
if (length == MM_HEADER_LEN_AV) {
|
| 120 |
- st = av_new_stream(s, 0); |
|
| 120 |
+ st = avformat_new_stream(s, NULL); |
|
| 121 | 121 |
if (!st) |
| 122 | 122 |
return AVERROR(ENOMEM); |
| 123 | 123 |
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| ... | ... |
@@ -1843,8 +1843,9 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom) |
| 1843 | 1843 |
MOVStreamContext *sc; |
| 1844 | 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 | 1847 |
if (!st) return AVERROR(ENOMEM); |
| 1848 |
+ st->id = c->fc->nb_streams; |
|
| 1848 | 1849 |
sc = av_mallocz(sizeof(MOVStreamContext)); |
| 1849 | 1850 |
if (!sc) return AVERROR(ENOMEM); |
| 1850 | 1851 |
|
| ... | ... |
@@ -84,7 +84,7 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 84 | 84 |
c->curbits = 8; |
| 85 | 85 |
c->frames_noted = 0; |
| 86 | 86 |
|
| 87 |
- st = av_new_stream(s, 0); |
|
| 87 |
+ st = avformat_new_stream(s, NULL); |
|
| 88 | 88 |
if (!st) |
| 89 | 89 |
return AVERROR(ENOMEM); |
| 90 | 90 |
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| ... | ... |
@@ -222,7 +222,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 222 | 222 |
c->samples = ffio_read_varlen(pb); |
| 223 | 223 |
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 | 226 |
if (!st) |
| 227 | 227 |
return AVERROR(ENOMEM); |
| 228 | 228 |
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| ... | ... |
@@ -537,9 +537,10 @@ static int mpegps_read_packet(AVFormatContext *s, |
| 537 | 537 |
goto redo; |
| 538 | 538 |
} |
| 539 | 539 |
/* no stream found: add a new stream */ |
| 540 |
- st = av_new_stream(s, startcode); |
|
| 540 |
+ st = avformat_new_stream(s, NULL); |
|
| 541 | 541 |
if (!st) |
| 542 | 542 |
goto skip; |
| 543 |
+ st->id = startcode; |
|
| 543 | 544 |
st->codec->codec_type = type; |
| 544 | 545 |
st->codec->codec_id = codec_id; |
| 545 | 546 |
st->request_probe = request_probe; |
| ... | ... |
@@ -620,12 +620,13 @@ static int mpegts_set_stream_info(AVStream *st, PESContext *pes, |
| 620 | 620 |
return AVERROR(ENOMEM); |
| 621 | 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 | 624 |
if (!sub_st) {
|
| 625 | 625 |
av_free(sub_pes); |
| 626 | 626 |
return AVERROR(ENOMEM); |
| 627 | 627 |
} |
| 628 | 628 |
|
| 629 |
+ sub_st->id = pes->pid; |
|
| 629 | 630 |
av_set_pts_info(sub_st, 33, 1, 90000); |
| 630 | 631 |
sub_st->priv_data = sub_pes; |
| 631 | 632 |
sub_st->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| ... | ... |
@@ -726,9 +727,10 @@ static int mpegts_push_data(MpegTSFilter *filter, |
| 726 | 726 |
|
| 727 | 727 |
/* stream not present in PMT */ |
| 728 | 728 |
if (!pes->st) {
|
| 729 |
- pes->st = av_new_stream(ts->stream, pes->pid); |
|
| 729 |
+ pes->st = avformat_new_stream(ts->stream, NULL); |
|
| 730 | 730 |
if (!pes->st) |
| 731 | 731 |
return AVERROR(ENOMEM); |
| 732 |
+ pes->st->id = pes->pid; |
|
| 732 | 733 |
mpegts_set_stream_info(pes->st, pes, 0, 0); |
| 733 | 734 |
} |
| 734 | 735 |
|
| ... | ... |
@@ -1120,14 +1122,18 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len |
| 1120 | 1120 |
/* now create ffmpeg stream */ |
| 1121 | 1121 |
if (ts->pids[pid] && ts->pids[pid]->type == MPEGTS_PES) {
|
| 1122 | 1122 |
pes = ts->pids[pid]->u.pes_filter.opaque; |
| 1123 |
- if (!pes->st) |
|
| 1124 |
- pes->st = av_new_stream(pes->stream, pes->pid); |
|
| 1123 |
+ if (!pes->st) {
|
|
| 1124 |
+ pes->st = avformat_new_stream(pes->stream, NULL); |
|
| 1125 |
+ st->id = pes->pid; |
|
| 1126 |
+ } |
|
| 1125 | 1127 |
st = pes->st; |
| 1126 | 1128 |
} else {
|
| 1127 | 1129 |
if (ts->pids[pid]) mpegts_close_filter(ts, ts->pids[pid]); //wrongly added sdt filter probably |
| 1128 | 1130 |
pes = add_pes_stream(ts, pid, pcr_pid); |
| 1129 |
- if (pes) |
|
| 1130 |
- st = av_new_stream(pes->stream, pes->pid); |
|
| 1131 |
+ if (pes) {
|
|
| 1132 |
+ st = avformat_new_stream(pes->stream, NULL); |
|
| 1133 |
+ st->id = pes->pid; |
|
| 1134 |
+ } |
|
| 1131 | 1135 |
} |
| 1132 | 1136 |
|
| 1133 | 1137 |
if (!st) |
| ... | ... |
@@ -1594,7 +1600,7 @@ static int mpegts_read_header(AVFormatContext *s, |
| 1594 | 1594 |
|
| 1595 | 1595 |
/* only read packets */ |
| 1596 | 1596 |
|
| 1597 |
- st = av_new_stream(s, 0); |
|
| 1597 |
+ st = avformat_new_stream(s, NULL); |
|
| 1598 | 1598 |
if (!st) |
| 1599 | 1599 |
goto fail; |
| 1600 | 1600 |
av_set_pts_info(st, 60, 1, 27000000); |
| ... | ... |
@@ -32,8 +32,6 @@ |
| 32 | 32 |
#define MTV_HEADER_SIZE 512 |
| 33 | 33 |
#define MTV_AUDIO_PADDING_SIZE 12 |
| 34 | 34 |
#define AUDIO_SAMPLING_RATE 44100 |
| 35 |
-#define VIDEO_SID 0 |
|
| 36 |
-#define AUDIO_SID 1 |
|
| 37 | 35 |
|
| 38 | 36 |
typedef struct MTVDemuxContext {
|
| 39 | 37 |
|
| ... | ... |
@@ -118,7 +116,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 118 | 118 |
|
| 119 | 119 |
// video - raw rgb565 |
| 120 | 120 |
|
| 121 |
- st = av_new_stream(s, VIDEO_SID); |
|
| 121 |
+ st = avformat_new_stream(s, NULL); |
|
| 122 | 122 |
if(!st) |
| 123 | 123 |
return AVERROR(ENOMEM); |
| 124 | 124 |
|
| ... | ... |
@@ -134,7 +132,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 134 | 134 |
|
| 135 | 135 |
// audio - mp3 |
| 136 | 136 |
|
| 137 |
- st = av_new_stream(s, AUDIO_SID); |
|
| 137 |
+ st = avformat_new_stream(s, NULL); |
|
| 138 | 138 |
if(!st) |
| 139 | 139 |
return AVERROR(ENOMEM); |
| 140 | 140 |
|
| ... | ... |
@@ -171,7 +169,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt) |
| 171 | 171 |
return ret; |
| 172 | 172 |
|
| 173 | 173 |
pkt->pos -= MTV_AUDIO_PADDING_SIZE; |
| 174 |
- pkt->stream_index = AUDIO_SID; |
|
| 174 |
+ pkt->stream_index = 1; |
|
| 175 | 175 |
|
| 176 | 176 |
}else |
| 177 | 177 |
{
|
| ... | ... |
@@ -190,7 +188,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt) |
| 190 | 190 |
for(i=0;i<mtv->img_segment_size/2;i++) |
| 191 | 191 |
*((uint16_t *)pkt->data+i) = av_bswap16(*((uint16_t *)pkt->data+i)); |
| 192 | 192 |
#endif |
| 193 |
- pkt->stream_index = VIDEO_SID; |
|
| 193 |
+ pkt->stream_index = 0; |
|
| 194 | 194 |
} |
| 195 | 195 |
|
| 196 | 196 |
return ret; |
| ... | ... |
@@ -42,11 +42,11 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 42 | 42 |
AVStream *ast, *vst; |
| 43 | 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 | 46 |
if (!ast) |
| 47 | 47 |
return AVERROR(ENOMEM); |
| 48 | 48 |
|
| 49 |
- vst = av_new_stream(s, 0); |
|
| 49 |
+ vst = avformat_new_stream(s, NULL); |
|
| 50 | 50 |
if (!vst) |
| 51 | 51 |
return AVERROR(ENOMEM); |
| 52 | 52 |
|
| ... | ... |
@@ -852,11 +852,12 @@ static int mxf_parse_structural_metadata(MXFContext *mxf) |
| 852 | 852 |
if (!source_track) |
| 853 | 853 |
continue; |
| 854 | 854 |
|
| 855 |
- st = av_new_stream(mxf->fc, source_track->track_id); |
|
| 855 |
+ st = avformat_new_stream(mxf->fc, NULL); |
|
| 856 | 856 |
if (!st) {
|
| 857 | 857 |
av_log(mxf->fc, AV_LOG_ERROR, "could not allocate stream\n"); |
| 858 | 858 |
return -1; |
| 859 | 859 |
} |
| 860 |
+ st->id = source_track->track_id; |
|
| 860 | 861 |
st->priv_data = source_track; |
| 861 | 862 |
st->duration = component->duration; |
| 862 | 863 |
if (st->duration == -1) |
| ... | ... |
@@ -24,8 +24,6 @@ |
| 24 | 24 |
#include "avformat.h" |
| 25 | 25 |
#include "avio.h" |
| 26 | 26 |
|
| 27 |
-#define VIDEO_STREAM_INDEX 0 |
|
| 28 |
-#define AUDIO_STREAM_INDEX 1 |
|
| 29 | 27 |
#define DEFAULT_PACKET_SIZE 1024 |
| 30 | 28 |
#define OVERREAD_SIZE 3 |
| 31 | 29 |
|
| ... | ... |
@@ -44,14 +42,14 @@ static int mxg_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 44 | 44 |
MXGContext *mxg = s->priv_data; |
| 45 | 45 |
|
| 46 | 46 |
/* video parameters will be extracted from the compressed bitstream */ |
| 47 |
- video_st = av_new_stream(s, VIDEO_STREAM_INDEX); |
|
| 47 |
+ video_st = avformat_new_stream(s, NULL); |
|
| 48 | 48 |
if (!video_st) |
| 49 | 49 |
return AVERROR(ENOMEM); |
| 50 | 50 |
video_st->codec->codec_type = AVMEDIA_TYPE_VIDEO; |
| 51 | 51 |
video_st->codec->codec_id = CODEC_ID_MXPEG; |
| 52 | 52 |
av_set_pts_info(video_st, 64, 1, 1000000); |
| 53 | 53 |
|
| 54 |
- audio_st = av_new_stream(s, AUDIO_STREAM_INDEX); |
|
| 54 |
+ audio_st = avformat_new_stream(s, NULL); |
|
| 55 | 55 |
if (!audio_st) |
| 56 | 56 |
return AVERROR(ENOMEM); |
| 57 | 57 |
audio_st->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| ... | ... |
@@ -166,7 +164,7 @@ static int mxg_read_packet(AVFormatContext *s, AVPacket *pkt) |
| 166 | 166 |
} |
| 167 | 167 |
|
| 168 | 168 |
pkt->pts = pkt->dts = mxg->dts; |
| 169 |
- pkt->stream_index = VIDEO_STREAM_INDEX; |
|
| 169 |
+ pkt->stream_index = 0; |
|
| 170 | 170 |
pkt->destruct = NULL; |
| 171 | 171 |
pkt->size = mxg->buffer_ptr - mxg->soi_ptr; |
| 172 | 172 |
pkt->data = mxg->soi_ptr; |
| ... | ... |
@@ -204,7 +202,7 @@ static int mxg_read_packet(AVFormatContext *s, AVPacket *pkt) |
| 204 | 204 |
if (marker == APP13 && size >= 16) { /* audio data */
|
| 205 | 205 |
/* time (GMT) of first sample in usec since 1970, little-endian */ |
| 206 | 206 |
pkt->pts = pkt->dts = AV_RL64(startmarker_ptr + 8); |
| 207 |
- pkt->stream_index = AUDIO_STREAM_INDEX; |
|
| 207 |
+ pkt->stream_index = 1; |
|
| 208 | 208 |
pkt->destruct = NULL; |
| 209 | 209 |
pkt->size = size - 14; |
| 210 | 210 |
pkt->data = startmarker_ptr + 16; |
| ... | ... |
@@ -45,7 +45,7 @@ static int nc_probe(AVProbeData *probe_packet) |
| 45 | 45 |
|
| 46 | 46 |
static 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 | 50 |
if (!st) |
| 51 | 51 |
return AVERROR(ENOMEM); |
| ... | ... |
@@ -438,10 +438,11 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap) |
| 438 | 438 |
nsv->vheight = vwidth; |
| 439 | 439 |
if (vtag != T_NONE) {
|
| 440 | 440 |
int i; |
| 441 |
- st = av_new_stream(s, NSV_ST_VIDEO); |
|
| 441 |
+ st = avformat_new_stream(s, NULL); |
|
| 442 | 442 |
if (!st) |
| 443 | 443 |
goto fail; |
| 444 | 444 |
|
| 445 |
+ st->id = NSV_ST_VIDEO; |
|
| 445 | 446 |
nst = av_mallocz(sizeof(NSVStream)); |
| 446 | 447 |
if (!nst) |
| 447 | 448 |
goto fail; |
| ... | ... |
@@ -469,10 +470,11 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap) |
| 469 | 469 |
} |
| 470 | 470 |
if (atag != T_NONE) {
|
| 471 | 471 |
#ifndef DISABLE_AUDIO |
| 472 |
- st = av_new_stream(s, NSV_ST_AUDIO); |
|
| 472 |
+ st = avformat_new_stream(s, NULL); |
|
| 473 | 473 |
if (!st) |
| 474 | 474 |
goto fail; |
| 475 | 475 |
|
| 476 |
+ st->id = NSV_ST_AUDIO; |
|
| 476 | 477 |
nst = av_mallocz(sizeof(NSVStream)); |
| 477 | 478 |
if (!nst) |
| 478 | 479 |
goto fail; |
| ... | ... |
@@ -153,7 +153,7 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) {
|
| 153 | 153 |
|
| 154 | 154 |
if (v_packs) {
|
| 155 | 155 |
ctx->v_id = stream_nr++; |
| 156 |
- vst = av_new_stream(s, ctx->v_id); |
|
| 156 |
+ vst = avformat_new_stream(s, NULL); |
|
| 157 | 157 |
if (!vst) |
| 158 | 158 |
return AVERROR(ENOMEM); |
| 159 | 159 |
vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; |
| ... | ... |
@@ -169,7 +169,7 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) {
|
| 169 | 169 |
|
| 170 | 170 |
if (a_packs) {
|
| 171 | 171 |
ctx->a_id = stream_nr++; |
| 172 |
- ast = av_new_stream(s, ctx->a_id); |
|
| 172 |
+ ast = avformat_new_stream(s, NULL); |
|
| 173 | 173 |
if (!ast) |
| 174 | 174 |
return AVERROR(ENOMEM); |
| 175 | 175 |
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| ... | ... |
@@ -171,10 +171,11 @@ static int ogg_new_stream(AVFormatContext *s, uint32_t serial, int new_avstream) |
| 171 | 171 |
os->header = -1; |
| 172 | 172 |
|
| 173 | 173 |
if (new_avstream) {
|
| 174 |
- st = av_new_stream(s, idx); |
|
| 174 |
+ st = avformat_new_stream(s, NULL); |
|
| 175 | 175 |
if (!st) |
| 176 | 176 |
return AVERROR(ENOMEM); |
| 177 | 177 |
|
| 178 |
+ st->id = idx; |
|
| 178 | 179 |
av_set_pts_info(st, 64, 1, 1000000); |
| 179 | 180 |
} |
| 180 | 181 |
|
| ... | ... |
@@ -196,7 +196,7 @@ static int str_read_packet(AVFormatContext *s, |
| 196 | 196 |
|
| 197 | 197 |
if(str->channels[channel].video_stream_index < 0){
|
| 198 | 198 |
/* allocate a new AVStream */ |
| 199 |
- st = av_new_stream(s, 0); |
|
| 199 |
+ st = avformat_new_stream(s, NULL); |
|
| 200 | 200 |
if (!st) |
| 201 | 201 |
return AVERROR(ENOMEM); |
| 202 | 202 |
av_set_pts_info(st, 64, 1, 15); |
| ... | ... |
@@ -244,7 +244,7 @@ static int str_read_packet(AVFormatContext *s, |
| 244 | 244 |
if(str->channels[channel].audio_stream_index < 0){
|
| 245 | 245 |
int fmt = sector[0x13]; |
| 246 | 246 |
/* allocate a new AVStream */ |
| 247 |
- st = av_new_stream(s, 0); |
|
| 247 |
+ st = avformat_new_stream(s, NULL); |
|
| 248 | 248 |
if (!st) |
| 249 | 249 |
return AVERROR(ENOMEM); |
| 250 | 250 |
|
| ... | ... |
@@ -56,7 +56,7 @@ static int pva_probe(AVProbeData * pd) {
|
| 56 | 56 |
static int pva_read_header(AVFormatContext *s, AVFormatParameters *ap) {
|
| 57 | 57 |
AVStream *st; |
| 58 | 58 |
|
| 59 |
- if (!(st = av_new_stream(s, 0))) |
|
| 59 |
+ if (!(st = avformat_new_stream(s, NULL))) |
|
| 60 | 60 |
return AVERROR(ENOMEM); |
| 61 | 61 |
st->codec->codec_type = AVMEDIA_TYPE_VIDEO; |
| 62 | 62 |
st->codec->codec_id = CODEC_ID_MPEG2VIDEO; |
| ... | ... |
@@ -64,7 +64,7 @@ static int pva_read_header(AVFormatContext *s, AVFormatParameters *ap) {
|
| 64 | 64 |
av_set_pts_info(st, 32, 1, 90000); |
| 65 | 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 | 68 |
return AVERROR(ENOMEM); |
| 69 | 69 |
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| 70 | 70 |
st->codec->codec_id = CODEC_ID_MP2; |
| ... | ... |
@@ -84,7 +84,7 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 84 | 84 |
{
|
| 85 | 85 |
AVIOContext *pb = s->pb; |
| 86 | 86 |
QCPContext *c = s->priv_data; |
| 87 |
- AVStream *st = av_new_stream(s, 0); |
|
| 87 |
+ AVStream *st = avformat_new_stream(s, NULL); |
|
| 88 | 88 |
uint8_t buf[16]; |
| 89 | 89 |
int i, nb_rates; |
| 90 | 90 |
|
| ... | ... |
@@ -52,7 +52,7 @@ static int read_atom(AVFormatContext *s, Atom *atom) |
| 52 | 52 |
|
| 53 | 53 |
static 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 | 56 |
char filename[258]; |
| 57 | 57 |
int tmp; |
| 58 | 58 |
int av_unused tmp2; |
| ... | ... |
@@ -89,7 +89,7 @@ static int r3d_read_red1(AVFormatContext *s) |
| 89 | 89 |
tmp = avio_r8(s->pb); // audio channels |
| 90 | 90 |
av_dlog(s, "audio channels %d\n", tmp); |
| 91 | 91 |
if (tmp > 0) {
|
| 92 |
- AVStream *ast = av_new_stream(s, 1); |
|
| 92 |
+ AVStream *ast = avformat_new_stream(s, NULL); |
|
| 93 | 93 |
if (!ast) |
| 94 | 94 |
return AVERROR(ENOMEM); |
| 95 | 95 |
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| ... | ... |
@@ -33,7 +33,7 @@ int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 33 | 33 |
AVStream *st; |
| 34 | 34 |
enum CodecID id; |
| 35 | 35 |
|
| 36 |
- st = av_new_stream(s, 0); |
|
| 36 |
+ st = avformat_new_stream(s, NULL); |
|
| 37 | 37 |
if (!st) |
| 38 | 38 |
return AVERROR(ENOMEM); |
| 39 | 39 |
|
| ... | ... |
@@ -122,7 +122,7 @@ int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt) |
| 122 | 122 |
int ff_raw_audio_read_header(AVFormatContext *s, |
| 123 | 123 |
AVFormatParameters *ap) |
| 124 | 124 |
{
|
| 125 |
- AVStream *st = av_new_stream(s, 0); |
|
| 125 |
+ AVStream *st = avformat_new_stream(s, NULL); |
|
| 126 | 126 |
if (!st) |
| 127 | 127 |
return AVERROR(ENOMEM); |
| 128 | 128 |
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| ... | ... |
@@ -144,7 +144,7 @@ int ff_raw_video_read_header(AVFormatContext *s, |
| 144 | 144 |
int ret = 0; |
| 145 | 145 |
|
| 146 | 146 |
|
| 147 |
- st = av_new_stream(s, 0); |
|
| 147 |
+ st = avformat_new_stream(s, NULL); |
|
| 148 | 148 |
if (!st) {
|
| 149 | 149 |
ret = AVERROR(ENOMEM); |
| 150 | 150 |
goto fail; |
| ... | ... |
@@ -459,8 +459,9 @@ add_dstream(AVFormatContext *s, AVStream *orig_st) |
| 459 | 459 |
{
|
| 460 | 460 |
AVStream *st; |
| 461 | 461 |
|
| 462 |
- if (!(st = av_new_stream(s, orig_st->id))) |
|
| 462 |
+ if (!(st = avformat_new_stream(s, NULL))) |
|
| 463 | 463 |
return NULL; |
| 464 |
+ st->id = orig_st->id; |
|
| 464 | 465 |
st->codec->codec_type = orig_st->codec->codec_type; |
| 465 | 466 |
st->first_dts = orig_st->first_dts; |
| 466 | 467 |
|
| ... | ... |
@@ -281,10 +281,10 @@ const AVCodecTag ff_codec_bmp_tags[] = {
|
| 281 | 281 |
{ CODEC_ID_G2M, MKTAG('G', '2', 'M', '3') },
|
| 282 | 282 |
{ CODEC_ID_G2M, MKTAG('G', '2', 'M', '4') },
|
| 283 | 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 | 286 |
{ CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'Y', '0') },
|
| 285 | 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 | 288 |
{ CODEC_ID_NONE, 0 }
|
| 289 | 289 |
}; |
| 290 | 290 |
|
| ... | ... |
@@ -110,7 +110,7 @@ static av_cold int rl2_read_header(AVFormatContext *s, |
| 110 | 110 |
def_sound_size = avio_rl16(pb); |
| 111 | 111 |
|
| 112 | 112 |
/** setup video stream */ |
| 113 |
- st = av_new_stream(s, 0); |
|
| 113 |
+ st = avformat_new_stream(s, NULL); |
|
| 114 | 114 |
if(!st) |
| 115 | 115 |
return AVERROR(ENOMEM); |
| 116 | 116 |
|
| ... | ... |
@@ -140,7 +140,7 @@ static av_cold int rl2_read_header(AVFormatContext *s, |
| 140 | 140 |
pts_num = def_sound_size; |
| 141 | 141 |
pts_den = rate; |
| 142 | 142 |
|
| 143 |
- st = av_new_stream(s, 0); |
|
| 143 |
+ st = avformat_new_stream(s, NULL); |
|
| 144 | 144 |
if (!st) |
| 145 | 145 |
return AVERROR(ENOMEM); |
| 146 | 146 |
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| ... | ... |
@@ -397,7 +397,7 @@ static int rm_read_header_old(AVFormatContext *s) |
| 397 | 397 |
AVStream *st; |
| 398 | 398 |
|
| 399 | 399 |
rm->old_format = 1; |
| 400 |
- st = av_new_stream(s, 0); |
|
| 400 |
+ st = avformat_new_stream(s, NULL); |
|
| 401 | 401 |
if (!st) |
| 402 | 402 |
return -1; |
| 403 | 403 |
st->priv_data = ff_rm_alloc_rmstream(); |
| ... | ... |
@@ -463,7 +463,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 463 | 463 |
rm_read_metadata(s, 1); |
| 464 | 464 |
break; |
| 465 | 465 |
case MKTAG('M', 'D', 'P', 'R'):
|
| 466 |
- st = av_new_stream(s, 0); |
|
| 466 |
+ st = avformat_new_stream(s, NULL); |
|
| 467 | 467 |
if (!st) |
| 468 | 468 |
return AVERROR(ENOMEM); |
| 469 | 469 |
st->id = avio_rb16(pb); |
| ... | ... |
@@ -139,7 +139,7 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 139 | 139 |
av_dict_set(&s->metadata, "author" , line, 0); |
| 140 | 140 |
|
| 141 | 141 |
// video headers |
| 142 |
- vst = av_new_stream(s, 0); |
|
| 142 |
+ vst = avformat_new_stream(s, NULL); |
|
| 143 | 143 |
if (!vst) |
| 144 | 144 |
return AVERROR(ENOMEM); |
| 145 | 145 |
vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; |
| ... | ... |
@@ -181,7 +181,7 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 181 | 181 |
// samples, though. This code will ignore additional tracks. |
| 182 | 182 |
audio_format = read_line_and_int(pb, &error); // audio format ID |
| 183 | 183 |
if (audio_format) {
|
| 184 |
- ast = av_new_stream(s, 0); |
|
| 184 |
+ ast = avformat_new_stream(s, NULL); |
|
| 185 | 185 |
if (!ast) |
| 186 | 186 |
return AVERROR(ENOMEM); |
| 187 | 187 |
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| ... | ... |
@@ -357,9 +357,10 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, |
| 357 | 357 |
if (!strcmp(ff_rtp_enc_name(rtsp_st->sdp_payload_type), "MP2T")) {
|
| 358 | 358 |
/* no corresponding stream */ |
| 359 | 359 |
} else {
|
| 360 |
- st = av_new_stream(s, rt->nb_rtsp_streams - 1); |
|
| 360 |
+ st = avformat_new_stream(s, NULL); |
|
| 361 | 361 |
if (!st) |
| 362 | 362 |
return; |
| 363 |
+ st->id = rt->nb_rtsp_streams - 1; |
|
| 363 | 364 |
rtsp_st->stream_index = st->index; |
| 364 | 365 |
st->codec->codec_type = codec_type; |
| 365 | 366 |
if (rtsp_st->sdp_payload_type < RTP_PT_PRIVATE) {
|
| ... | ... |
@@ -163,11 +163,12 @@ static int sap_read_header(AVFormatContext *s, |
| 163 | 163 |
if (sap->sdp_ctx->ctx_flags & AVFMTCTX_NOHEADER) |
| 164 | 164 |
s->ctx_flags |= AVFMTCTX_NOHEADER; |
| 165 | 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 | 167 |
if (!st) {
|
| 168 | 168 |
ret = AVERROR(ENOMEM); |
| 169 | 169 |
goto fail; |
| 170 | 170 |
} |
| 171 |
+ st->id = i; |
|
| 171 | 172 |
avcodec_copy_context(st->codec, sap->sdp_ctx->streams[i]->codec); |
| 172 | 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) |
| 211 | 211 |
if (s->ctx_flags & AVFMTCTX_NOHEADER) {
|
| 212 | 212 |
while (sap->sdp_ctx->nb_streams > s->nb_streams) {
|
| 213 | 213 |
int i = s->nb_streams; |
| 214 |
- AVStream *st = av_new_stream(s, i); |
|
| 214 |
+ AVStream *st = avformat_new_stream(s, NULL); |
|
| 215 | 215 |
if (!st) {
|
| 216 | 216 |
av_free_packet(pkt); |
| 217 | 217 |
return AVERROR(ENOMEM); |
| 218 | 218 |
} |
| 219 |
+ st->id = i; |
|
| 219 | 220 |
avcodec_copy_context(st->codec, sap->sdp_ctx->streams[i]->codec); |
| 220 | 221 |
st->time_base = sap->sdp_ctx->streams[i]->time_base; |
| 221 | 222 |
} |
| ... | ... |
@@ -134,7 +134,7 @@ static int film_read_header(AVFormatContext *s, |
| 134 | 134 |
|
| 135 | 135 |
/* initialize the decoder streams */ |
| 136 | 136 |
if (film->video_type) {
|
| 137 |
- st = av_new_stream(s, 0); |
|
| 137 |
+ st = avformat_new_stream(s, NULL); |
|
| 138 | 138 |
if (!st) |
| 139 | 139 |
return AVERROR(ENOMEM); |
| 140 | 140 |
film->video_stream_index = st->index; |
| ... | ... |
@@ -146,7 +146,7 @@ static int film_read_header(AVFormatContext *s, |
| 146 | 146 |
} |
| 147 | 147 |
|
| 148 | 148 |
if (film->audio_type) {
|
| 149 |
- st = av_new_stream(s, 0); |
|
| 149 |
+ st = avformat_new_stream(s, NULL); |
|
| 150 | 150 |
if (!st) |
| 151 | 151 |
return AVERROR(ENOMEM); |
| 152 | 152 |
film->audio_stream_index = st->index; |
| ... | ... |
@@ -104,7 +104,7 @@ static int vmd_read_header(AVFormatContext *s, |
| 104 | 104 |
else |
| 105 | 105 |
vmd->is_indeo3 = 0; |
| 106 | 106 |
/* start up the decoders */ |
| 107 |
- vst = av_new_stream(s, 0); |
|
| 107 |
+ vst = avformat_new_stream(s, NULL); |
|
| 108 | 108 |
if (!vst) |
| 109 | 109 |
return AVERROR(ENOMEM); |
| 110 | 110 |
av_set_pts_info(vst, 33, 1, 10); |
| ... | ... |
@@ -125,7 +125,7 @@ static int vmd_read_header(AVFormatContext *s, |
| 125 | 125 |
/* if sample rate is 0, assume no audio */ |
| 126 | 126 |
vmd->sample_rate = AV_RL16(&vmd->vmd_header[804]); |
| 127 | 127 |
if (vmd->sample_rate) {
|
| 128 |
- st = av_new_stream(s, 0); |
|
| 128 |
+ st = avformat_new_stream(s, NULL); |
|
| 129 | 129 |
if (!st) |
| 130 | 130 |
return AVERROR(ENOMEM); |
| 131 | 131 |
vmd->audio_stream_index = st->index; |
| ... | ... |
@@ -71,7 +71,7 @@ static int siff_probe(AVProbeData *p) |
| 71 | 71 |
static int create_audio_stream(AVFormatContext *s, SIFFContext *c) |
| 72 | 72 |
{
|
| 73 | 73 |
AVStream *ast; |
| 74 |
- ast = av_new_stream(s, 0); |
|
| 74 |
+ ast = avformat_new_stream(s, NULL); |
|
| 75 | 75 |
if (!ast) |
| 76 | 76 |
return -1; |
| 77 | 77 |
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| ... | ... |
@@ -115,7 +115,7 @@ static int siff_parse_vbv1(AVFormatContext *s, SIFFContext *c, AVIOContext *pb) |
| 115 | 115 |
|
| 116 | 116 |
avio_skip(pb, 16); //zeroes |
| 117 | 117 |
|
| 118 |
- st = av_new_stream(s, 0); |
|
| 118 |
+ st = avformat_new_stream(s, NULL); |
|
| 119 | 119 |
if (!st) |
| 120 | 120 |
return -1; |
| 121 | 121 |
st->codec->codec_type = AVMEDIA_TYPE_VIDEO; |
| ... | ... |
@@ -154,7 +154,7 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 154 | 154 |
} |
| 155 | 155 |
|
| 156 | 156 |
/* init video codec */ |
| 157 |
- st = av_new_stream(s, 0); |
|
| 157 |
+ st = avformat_new_stream(s, NULL); |
|
| 158 | 158 |
if (!st) |
| 159 | 159 |
return -1; |
| 160 | 160 |
smk->videoindex = st->index; |
| ... | ... |
@@ -177,7 +177,7 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 177 | 177 |
for(i = 0; i < 7; i++) {
|
| 178 | 178 |
smk->indexes[i] = -1; |
| 179 | 179 |
if (smk->rates[i]) {
|
| 180 |
- ast[i] = av_new_stream(s, 0); |
|
| 180 |
+ ast[i] = avformat_new_stream(s, NULL); |
|
| 181 | 181 |
smk->indexes[i] = ast[i]->index; |
| 182 | 182 |
ast[i]->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| 183 | 183 |
if (smk->aflags[i] & SMK_AUD_BINKAUD) {
|
| ... | ... |
@@ -110,7 +110,7 @@ static int sol_read_header(AVFormatContext *s, |
| 110 | 110 |
else id = 0; |
| 111 | 111 |
|
| 112 | 112 |
/* now we are ready: build format streams */ |
| 113 |
- st = av_new_stream(s, 0); |
|
| 113 |
+ st = avformat_new_stream(s, NULL); |
|
| 114 | 114 |
if (!st) |
| 115 | 115 |
return -1; |
| 116 | 116 |
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| ... | ... |
@@ -205,7 +205,7 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt) |
| 205 | 205 |
|
| 206 | 206 |
if (!s->nb_streams) {
|
| 207 | 207 |
/* first packet, create a stream */ |
| 208 |
- AVStream *st = av_new_stream(s, 0); |
|
| 208 |
+ AVStream *st = avformat_new_stream(s, NULL); |
|
| 209 | 209 |
if (!st) {
|
| 210 | 210 |
av_free_packet(pkt); |
| 211 | 211 |
return AVERROR(ENOMEM); |
| ... | ... |
@@ -42,7 +42,7 @@ static int srt_probe(AVProbeData *p) |
| 42 | 42 |
|
| 43 | 43 |
static 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 | 46 |
if (!st) |
| 47 | 47 |
return -1; |
| 48 | 48 |
av_set_pts_info(st, 64, 1, 1000); |
| ... | ... |
@@ -106,9 +106,10 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) |
| 106 | 106 |
avio_rl16(pb); |
| 107 | 107 |
avio_r8(pb); |
| 108 | 108 |
/* Check for FLV1 */ |
| 109 |
- vst = av_new_stream(s, ch_id); |
|
| 109 |
+ vst = avformat_new_stream(s, NULL); |
|
| 110 | 110 |
if (!vst) |
| 111 | 111 |
return -1; |
| 112 |
+ vst->id = ch_id; |
|
| 112 | 113 |
vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; |
| 113 | 114 |
vst->codec->codec_id = ff_codec_get_id(swf_codec_tags, avio_r8(pb)); |
| 114 | 115 |
av_set_pts_info(vst, 16, 256, swf->frame_rate); |
| ... | ... |
@@ -127,9 +128,10 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) |
| 127 | 127 |
avio_r8(pb); |
| 128 | 128 |
v = avio_r8(pb); |
| 129 | 129 |
swf->samples_per_frame = avio_rl16(pb); |
| 130 |
- ast = av_new_stream(s, -1); /* -1 to avoid clash with video stream ch_id */ |
|
| 130 |
+ ast = avformat_new_stream(s, NULL); |
|
| 131 | 131 |
if (!ast) |
| 132 | 132 |
return -1; |
| 133 |
+ ast->id = -1; /* -1 to avoid clash with video stream ch_id */ |
|
| 133 | 134 |
ast->codec->channels = 1 + (v&1); |
| 134 | 135 |
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| 135 | 136 |
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) |
| 177 | 177 |
break; |
| 178 | 178 |
} |
| 179 | 179 |
if (i == s->nb_streams) {
|
| 180 |
- vst = av_new_stream(s, -2); /* -2 to avoid clash with video stream and audio stream */ |
|
| 180 |
+ vst = avformat_new_stream(s, NULL); |
|
| 181 | 181 |
if (!vst) |
| 182 | 182 |
return -1; |
| 183 |
+ vst->id = -2; /* -2 to avoid clash with video stream and audio stream */ |
|
| 183 | 184 |
vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; |
| 184 | 185 |
vst->codec->codec_id = CODEC_ID_MJPEG; |
| 185 | 186 |
av_set_pts_info(vst, 64, 256, swf->frame_rate); |
| ... | ... |
@@ -94,7 +94,7 @@ static int thp_read_header(AVFormatContext *s, |
| 94 | 94 |
break; |
| 95 | 95 |
|
| 96 | 96 |
/* Video component. */ |
| 97 |
- st = av_new_stream(s, 0); |
|
| 97 |
+ st = avformat_new_stream(s, NULL); |
|
| 98 | 98 |
if (!st) |
| 99 | 99 |
return AVERROR(ENOMEM); |
| 100 | 100 |
|
| ... | ... |
@@ -117,7 +117,7 @@ static int thp_read_header(AVFormatContext *s, |
| 117 | 117 |
break; |
| 118 | 118 |
|
| 119 | 119 |
/* Audio component. */ |
| 120 |
- st = av_new_stream(s, 0); |
|
| 120 |
+ st = avformat_new_stream(s, NULL); |
|
| 121 | 121 |
if (!st) |
| 122 | 122 |
return AVERROR(ENOMEM); |
| 123 | 123 |
|
| ... | ... |
@@ -206,7 +206,7 @@ static int seq_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 206 | 206 |
seq->audio_buffer_full = 0; |
| 207 | 207 |
|
| 208 | 208 |
/* initialize the video decoder stream */ |
| 209 |
- st = av_new_stream(s, 0); |
|
| 209 |
+ st = avformat_new_stream(s, NULL); |
|
| 210 | 210 |
if (!st) |
| 211 | 211 |
return AVERROR(ENOMEM); |
| 212 | 212 |
|
| ... | ... |
@@ -219,7 +219,7 @@ static int seq_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 219 | 219 |
st->codec->height = SEQ_FRAME_H; |
| 220 | 220 |
|
| 221 | 221 |
/* initialize the audio decoder stream */ |
| 222 |
- st = av_new_stream(s, 0); |
|
| 222 |
+ st = avformat_new_stream(s, NULL); |
|
| 223 | 223 |
if (!st) |
| 224 | 224 |
return AVERROR(ENOMEM); |
| 225 | 225 |
|
| ... | ... |
@@ -73,10 +73,10 @@ static int tmv_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 73 | 73 |
if (avio_rl32(pb) != TMV_TAG) |
| 74 | 74 |
return -1; |
| 75 | 75 |
|
| 76 |
- if (!(vst = av_new_stream(s, 0))) |
|
| 76 |
+ if (!(vst = avformat_new_stream(s, NULL))) |
|
| 77 | 77 |
return AVERROR(ENOMEM); |
| 78 | 78 |
|
| 79 |
- if (!(ast = av_new_stream(s, 0))) |
|
| 79 |
+ if (!(ast = avformat_new_stream(s, NULL))) |
|
| 80 | 80 |
return AVERROR(ENOMEM); |
| 81 | 81 |
|
| 82 | 82 |
ast->codec->sample_rate = avio_rl16(pb); |
| ... | ... |
@@ -76,7 +76,7 @@ static int read_header(AVFormatContext *avctx, |
| 76 | 76 |
{
|
| 77 | 77 |
TtyDemuxContext *s = avctx->priv_data; |
| 78 | 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 | 80 |
AVRational framerate; |
| 81 | 81 |
|
| 82 | 82 |
if (!st) {
|
| ... | ... |
@@ -40,7 +40,7 @@ static int txd_probe(AVProbeData * pd) {
|
| 40 | 40 |
static int txd_read_header(AVFormatContext *s, AVFormatParameters *ap) {
|
| 41 | 41 |
AVStream *st; |
| 42 | 42 |
|
| 43 |
- st = av_new_stream(s, 0); |
|
| 43 |
+ st = avformat_new_stream(s, NULL); |
|
| 44 | 44 |
if (!st) |
| 45 | 45 |
return AVERROR(ENOMEM); |
| 46 | 46 |
st->codec->codec_type = AVMEDIA_TYPE_VIDEO; |
| ... | ... |
@@ -2762,8 +2762,18 @@ void av_close_input_file(AVFormatContext *s) |
| 2762 | 2762 |
avio_close(pb); |
| 2763 | 2763 |
} |
| 2764 | 2764 |
|
| 2765 |
+#if FF_API_NEW_STREAM |
|
| 2765 | 2766 |
AVStream *av_new_stream(AVFormatContext *s, int id) |
| 2766 | 2767 |
{
|
| 2768 |
+ AVStream *st = avformat_new_stream(s, NULL); |
|
| 2769 |
+ if (st) |
|
| 2770 |
+ st->id = id; |
|
| 2771 |
+ return st; |
|
| 2772 |
+} |
|
| 2773 |
+#endif |
|
| 2774 |
+ |
|
| 2775 |
+AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c) |
|
| 2776 |
+{
|
|
| 2767 | 2777 |
AVStream *st; |
| 2768 | 2778 |
int i; |
| 2769 | 2779 |
AVStream **streams; |
| ... | ... |
@@ -2783,13 +2793,12 @@ AVStream *av_new_stream(AVFormatContext *s, int id) |
| 2783 | 2783 |
return NULL; |
| 2784 | 2784 |
} |
| 2785 | 2785 |
|
| 2786 |
- st->codec = avcodec_alloc_context3(NULL); |
|
| 2786 |
+ st->codec = avcodec_alloc_context3(c); |
|
| 2787 | 2787 |
if (s->iformat) {
|
| 2788 | 2788 |
/* no default bitrate if decoding */ |
| 2789 | 2789 |
st->codec->bit_rate = 0; |
| 2790 | 2790 |
} |
| 2791 | 2791 |
st->index = s->nb_streams; |
| 2792 |
- st->id = id; |
|
| 2793 | 2792 |
st->start_time = AV_NOPTS_VALUE; |
| 2794 | 2793 |
st->duration = AV_NOPTS_VALUE; |
| 2795 | 2794 |
/* we set the current DTS to 0 so that formats without any timestamps |
| ... | ... |
@@ -24,8 +24,8 @@ |
| 24 | 24 |
#include "libavutil/avutil.h" |
| 25 | 25 |
|
| 26 | 26 |
#define LIBAVFORMAT_VERSION_MAJOR 53 |
| 27 |
-#define LIBAVFORMAT_VERSION_MINOR 16 |
|
| 28 |
-#define LIBAVFORMAT_VERSION_MICRO 1 |
|
| 27 |
+#define LIBAVFORMAT_VERSION_MINOR 17 |
|
| 28 |
+#define LIBAVFORMAT_VERSION_MICRO 0 |
|
| 29 | 29 |
|
| 30 | 30 |
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ |
| 31 | 31 |
LIBAVFORMAT_VERSION_MINOR, \ |
| ... | ... |
@@ -98,5 +98,8 @@ |
| 98 | 98 |
#ifndef FF_API_RTSP_URL_OPTIONS |
| 99 | 99 |
#define FF_API_RTSP_URL_OPTIONS (LIBAVFORMAT_VERSION_MAJOR < 54) |
| 100 | 100 |
#endif |
| 101 |
+#ifndef FF_API_NEW_STREAM |
|
| 102 |
+#define FF_API_NEW_STREAM (LIBAVFORMAT_VERSION_MAJOR < 54) |
|
| 103 |
+#endif |
|
| 101 | 104 |
|
| 102 | 105 |
#endif /* AVFORMAT_VERSION_H */ |
| ... | ... |
@@ -52,7 +52,7 @@ static int voc_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 52 | 52 |
return AVERROR(ENOSYS); |
| 53 | 53 |
} |
| 54 | 54 |
avio_skip(pb, header_size); |
| 55 |
- st = av_new_stream(s, 0); |
|
| 55 |
+ st = avformat_new_stream(s, NULL); |
|
| 56 | 56 |
if (!st) |
| 57 | 57 |
return AVERROR(ENOMEM); |
| 58 | 58 |
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| ... | ... |
@@ -64,7 +64,7 @@ static void add_metadata(AVFormatContext *s, const char *tag, |
| 64 | 64 |
static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 65 | 65 |
{
|
| 66 | 66 |
VqfContext *c = s->priv_data; |
| 67 |
- AVStream *st = av_new_stream(s, 0); |
|
| 67 |
+ AVStream *st = avformat_new_stream(s, NULL); |
|
| 68 | 68 |
int chunk_tag; |
| 69 | 69 |
int rate_flag = -1; |
| 70 | 70 |
int header_size; |
| ... | ... |
@@ -280,7 +280,7 @@ static int wav_parse_fmt_tag(AVFormatContext *s, int64_t size, AVStream **st) |
| 280 | 280 |
int ret; |
| 281 | 281 |
|
| 282 | 282 |
/* parse fmt header */ |
| 283 |
- *st = av_new_stream(s, 0); |
|
| 283 |
+ *st = avformat_new_stream(s, NULL); |
|
| 284 | 284 |
if (!*st) |
| 285 | 285 |
return AVERROR(ENOMEM); |
| 286 | 286 |
|
| ... | ... |
@@ -726,7 +726,7 @@ static int w64_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 726 | 726 |
return -1; |
| 727 | 727 |
} |
| 728 | 728 |
|
| 729 |
- st = av_new_stream(s, 0); |
|
| 729 |
+ st = avformat_new_stream(s, NULL); |
|
| 730 | 730 |
if (!st) |
| 731 | 731 |
return AVERROR(ENOMEM); |
| 732 | 732 |
|
| ... | ... |
@@ -163,7 +163,7 @@ static int wc3_read_header(AVFormatContext *s, |
| 163 | 163 |
} while (fourcc_tag != BRCH_TAG); |
| 164 | 164 |
|
| 165 | 165 |
/* initialize the decoder streams */ |
| 166 |
- st = av_new_stream(s, 0); |
|
| 166 |
+ st = avformat_new_stream(s, NULL); |
|
| 167 | 167 |
if (!st) |
| 168 | 168 |
return AVERROR(ENOMEM); |
| 169 | 169 |
av_set_pts_info(st, 33, 1, WC3_FRAME_FPS); |
| ... | ... |
@@ -174,7 +174,7 @@ static int wc3_read_header(AVFormatContext *s, |
| 174 | 174 |
st->codec->width = wc3->width; |
| 175 | 175 |
st->codec->height = wc3->height; |
| 176 | 176 |
|
| 177 |
- st = av_new_stream(s, 0); |
|
| 177 |
+ st = avformat_new_stream(s, NULL); |
|
| 178 | 178 |
if (!st) |
| 179 | 179 |
return AVERROR(ENOMEM); |
| 180 | 180 |
av_set_pts_info(st, 33, 1, WC3_FRAME_FPS); |
| ... | ... |
@@ -144,7 +144,7 @@ static int wsaud_read_header(AVFormatContext *s, |
| 144 | 144 |
wsaud->audio_bits = (((header[10] & 0x2) >> 1) + 1) * 8; |
| 145 | 145 |
|
| 146 | 146 |
/* initialize the audio decoder stream */ |
| 147 |
- st = av_new_stream(s, 0); |
|
| 147 |
+ st = avformat_new_stream(s, NULL); |
|
| 148 | 148 |
if (!st) |
| 149 | 149 |
return AVERROR(ENOMEM); |
| 150 | 150 |
av_set_pts_info(st, 33, 1, wsaud->audio_samplerate); |
| ... | ... |
@@ -221,7 +221,7 @@ static int wsvqa_read_header(AVFormatContext *s, |
| 221 | 221 |
unsigned int chunk_size; |
| 222 | 222 |
|
| 223 | 223 |
/* initialize the video decoder stream */ |
| 224 |
- st = av_new_stream(s, 0); |
|
| 224 |
+ st = avformat_new_stream(s, NULL); |
|
| 225 | 225 |
if (!st) |
| 226 | 226 |
return AVERROR(ENOMEM); |
| 227 | 227 |
av_set_pts_info(st, 33, 1, VQA_FRAMERATE); |
| ... | ... |
@@ -247,7 +247,7 @@ static int wsvqa_read_header(AVFormatContext *s, |
| 247 | 247 |
|
| 248 | 248 |
/* initialize the audio decoder stream for VQA v1 or nonzero samplerate */ |
| 249 | 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 | 251 |
if (!st) |
| 252 | 252 |
return AVERROR(ENOMEM); |
| 253 | 253 |
av_set_pts_info(st, 33, 1, VQA_FRAMERATE); |
| ... | ... |
@@ -414,7 +414,7 @@ static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length) |
| 414 | 414 |
if (!filesize) |
| 415 | 415 |
goto done; |
| 416 | 416 |
|
| 417 |
- st = av_new_stream(s, 0); |
|
| 417 |
+ st = avformat_new_stream(s, NULL); |
|
| 418 | 418 |
if (!st) |
| 419 | 419 |
goto done; |
| 420 | 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 |
| 562 | 562 |
WtvStream *wst = av_mallocz(sizeof(WtvStream)); |
| 563 | 563 |
if (!wst) |
| 564 | 564 |
return NULL; |
| 565 |
- st = av_new_stream(s, sid); |
|
| 565 |
+ st = avformat_new_stream(s, NULL); |
|
| 566 | 566 |
if (!st) |
| 567 | 567 |
return NULL; |
| 568 |
+ st->id = sid; |
|
| 568 | 569 |
st->priv_data = wst; |
| 569 | 570 |
} |
| 570 | 571 |
st->codec->codec_type = codec_type; |
| ... | ... |
@@ -220,7 +220,7 @@ static int wv_read_header(AVFormatContext *s, |
| 220 | 220 |
} |
| 221 | 221 |
|
| 222 | 222 |
/* now we are ready: build format streams */ |
| 223 |
- st = av_new_stream(s, 0); |
|
| 223 |
+ st = avformat_new_stream(s, NULL); |
|
| 224 | 224 |
if (!st) |
| 225 | 225 |
return -1; |
| 226 | 226 |
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| ... | ... |
@@ -147,7 +147,7 @@ static int xmv_read_header(AVFormatContext *s, |
| 147 | 147 |
|
| 148 | 148 |
/* Video track */ |
| 149 | 149 |
|
| 150 |
- vst = av_new_stream(s, 0); |
|
| 150 |
+ vst = avformat_new_stream(s, NULL); |
|
| 151 | 151 |
if (!vst) |
| 152 | 152 |
return AVERROR(ENOMEM); |
| 153 | 153 |
|
| ... | ... |
@@ -202,7 +202,7 @@ static int xmv_read_header(AVFormatContext *s, |
| 202 | 202 |
av_log(s, AV_LOG_WARNING, "Unsupported 5.1 ADPCM audio stream " |
| 203 | 203 |
"(0x%04X)\n", packet->flags); |
| 204 | 204 |
|
| 205 |
- ast = av_new_stream(s, audio_track); |
|
| 205 |
+ ast = avformat_new_stream(s, NULL); |
|
| 206 | 206 |
if (!ast) |
| 207 | 207 |
return AVERROR(ENOMEM); |
| 208 | 208 |
|
| ... | ... |
@@ -69,7 +69,7 @@ static int xwma_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 69 | 69 |
if (tag != MKTAG('f', 'm', 't', ' '))
|
| 70 | 70 |
return -1; |
| 71 | 71 |
size = avio_rl32(pb); |
| 72 |
- st = av_new_stream(s, 0); |
|
| 72 |
+ st = avformat_new_stream(s, NULL); |
|
| 73 | 73 |
if (!st) |
| 74 | 74 |
return AVERROR(ENOMEM); |
| 75 | 75 |
|
| ... | ... |
@@ -56,8 +56,8 @@ static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 56 | 56 |
|
| 57 | 57 |
int frame_rate, ret; |
| 58 | 58 |
|
| 59 |
- audio_stream = av_new_stream(s, 0); |
|
| 60 |
- video_stream = av_new_stream(s, 1); |
|
| 59 |
+ audio_stream = avformat_new_stream(s, NULL); |
|
| 60 |
+ video_stream = avformat_new_stream(s, NULL); |
|
| 61 | 61 |
|
| 62 | 62 |
// Extra data that will be passed to the decoder |
| 63 | 63 |
video_stream->codec->extradata_size = 8; |
| ... | ... |
@@ -32,6 +32,189 @@ |
| 32 | 32 |
#include "dict.h" |
| 33 | 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 |
+ |
|
| 35 | 218 |
enum AVOptionType{
|
| 36 | 219 |
AV_OPT_TYPE_FLAGS, |
| 37 | 220 |
AV_OPT_TYPE_INT, |
| 38 | 221 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,17 @@ |
| 0 |
+g=120 |
|
| 1 |
+lag-in-frames=16 |
|
| 2 |
+deadline=good |
|
| 3 |
+cpu-used=0 |
|
| 4 |
+profile=1 |
|
| 5 |
+qmax=51 |
|
| 6 |
+qmin=11 |
|
| 7 |
+slices=4 |
|
| 8 |
+b=2M |
|
| 9 |
+ |
|
| 10 |
+#ignored unless using -pass 2 |
|
| 11 |
+maxrate=24M |
|
| 12 |
+minrate=100k |
|
| 13 |
+auto-alt-ref=1 |
|
| 14 |
+arnr-maxframes=7 |
|
| 15 |
+arnr-strength=5 |
|
| 16 |
+arnr-type=centered |
| 0 | 17 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,17 @@ |
| 0 |
+g=120 |
|
| 1 |
+lag-in-frames=25 |
|
| 2 |
+deafline=good |
|
| 3 |
+cpu-used=0 |
|
| 4 |
+profile=1 |
|
| 5 |
+qmax=51 |
|
| 6 |
+qmin=11 |
|
| 7 |
+slices=4 |
|
| 8 |
+b=2M |
|
| 9 |
+ |
|
| 10 |
+#ignored unless using -pass 2 |
|
| 11 |
+maxrate=24M |
|
| 12 |
+minrate=100k |
|
| 13 |
+auto-alt-ref=1 |
|
| 14 |
+arnr-maxframes=7 |
|
| 15 |
+arnr-strength=5 |
|
| 16 |
+arnr-type=centered |
| 0 | 17 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,16 @@ |
| 0 |
+g=120 |
|
| 1 |
+lag-in-frames=16 |
|
| 2 |
+deadline=good |
|
| 3 |
+cpu-used=0 |
|
| 4 |
+profile=0 |
|
| 5 |
+qmax=63 |
|
| 6 |
+qmin=0 |
|
| 7 |
+b=768k |
|
| 8 |
+ |
|
| 9 |
+#ignored unless using -pass 2 |
|
| 10 |
+maxrate=1.5M |
|
| 11 |
+minrate=40k |
|
| 12 |
+auto-alt-ref=1 |
|
| 13 |
+arnr-maxframes=7 |
|
| 14 |
+arnr-strength=5 |
|
| 15 |
+arnr-type=centered |
| 0 | 16 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,17 @@ |
| 0 |
+g=120 |
|
| 1 |
+lag-in-frames=16 |
|
| 2 |
+deadline=good |
|
| 3 |
+cpu-used=0 |
|
| 4 |
+profile=0 |
|
| 5 |
+qmax=51 |
|
| 6 |
+qmin=11 |
|
| 7 |
+slices=4 |
|
| 8 |
+b=2M |
|
| 9 |
+ |
|
| 10 |
+#ignored unless using -pass 2 |
|
| 11 |
+maxrate=24M |
|
| 12 |
+minrate=100k |
|
| 13 |
+auto-alt-ref=1 |
|
| 14 |
+arnr-maxframes=7 |
|
| 15 |
+arnr-strength=5 |
|
| 16 |
+arnr-type=centered |
| 0 | 17 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,17 @@ |
| 0 |
+g=120 |
|
| 1 |
+lag-in-frames=25 |
|
| 2 |
+deadline=good |
|
| 3 |
+cpu-used=0 |
|
| 4 |
+profile=0 |
|
| 5 |
+qmax=51 |
|
| 6 |
+qmin=11 |
|
| 7 |
+slices=4 |
|
| 8 |
+b=2M |
|
| 9 |
+ |
|
| 10 |
+#ignored unless using -pass 2 |
|
| 11 |
+maxrate=24M |
|
| 12 |
+minrate=100k |
|
| 13 |
+auto-alt-ref=1 |
|
| 14 |
+arnr-maxframes=7 |
|
| 15 |
+arnr-strength=5 |
|
| 16 |
+arnr-type=centered |