1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

Merge remote-tracking branch 'qatar/master'

* qatar/master:
  presets: rename presets directory
  lavc: make avcodec_get_context_defaults3 "officially" public
  lavf: replace av_new_stream->avformat_new_stream part II.
  lavf,lavd: replace av_new_stream->avformat_new_stream part I.
  lavf: add avformat_new_stream as a replacement for av_new_stream.
  Use correct scaling table for bwd-pred MVs in second B-field
  Ut Video decoder
  Makefile: change presets extension to .avpreset
  lavfi: add rgbtestsrc source, ported from MPlayer libmpcodecs
  lavfi: add testsrc source
  AVOptions: add documentation.
  presets: update libx264 ffpresets

Conflicts:
	Changelog
	doc/APIchanges
	doc/ffmpeg.texi
	ffpresets/libx264-ipod320.ffpreset
	ffpresets/libx264-ipod640.ffpreset
	ffserver.c
	libavcodec/avcodec.h
	libavcodec/options.c
	libavcodec/version.h
	libavdevice/libdc1394.c
	libavfilter/avfilter.h
	libavfilter/vsrc_testsrc.c
	libavformat/flvdec.c
	libavformat/riff.c
	libavformat/version.h
	libavformat/wtv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2011-10-20 02:23:36 +02:00
commit d0492578c8
181 changed files with 1020 additions and 255 deletions

View File

@ -65,6 +65,7 @@ easier to use. The changes are:
- VC-1 interlaced decoding - VC-1 interlaced decoding
- libutvideo wrapper (--enable-libutvideo) - libutvideo wrapper (--enable-libutvideo)
- aevalsrc audio source added - aevalsrc audio source added
- Ut Video decoder
version 0.8: version 0.8:

View File

@ -38,7 +38,7 @@ FFLIBS-$(CONFIG_SWSCALE) += swscale
FFLIBS := avutil FFLIBS := avutil
DATA_FILES := $(wildcard $(SRC_PATH)/ffpresets/*.ffpreset) DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.ffpreset)
SKIPHEADERS = cmdutils_common_opts.h SKIPHEADERS = cmdutils_common_opts.h

View File

@ -3137,7 +3137,7 @@ static int get_preset_file_2(const char *preset_name, const char *codec_name, AV
static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type) static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type)
{ {
OutputStream *ost; OutputStream *ost;
AVStream *st = av_new_stream(oc, oc->nb_streams < o->nb_streamid_map ? o->streamid_map[oc->nb_streams] : 0); AVStream *st = avformat_new_stream(oc, NULL);
int idx = oc->nb_streams - 1, ret = 0; int idx = oc->nb_streams - 1, ret = 0;
int64_t max_frames = INT64_MAX; int64_t max_frames = INT64_MAX;
char *bsf = NULL, *next, *codec_tag = NULL; char *bsf = NULL, *next, *codec_tag = NULL;
@ -3151,6 +3151,9 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
exit_program(1); exit_program(1);
} }
if (oc->nb_streams - 1 < o->nb_streamid_map)
st->id = o->streamid_map[oc->nb_streams - 1];
output_streams = grow_array(output_streams, sizeof(*output_streams), &nb_output_streams, output_streams = grow_array(output_streams, sizeof(*output_streams), &nb_output_streams,
nb_output_streams + 1); nb_output_streams + 1);
ost = &output_streams[nb_output_streams - 1]; ost = &output_streams[nb_output_streams - 1];

View File

@ -16,6 +16,9 @@ API changes, most recent first:
2011-10-20 - b35e9e1 - lavu 51.22.0 2011-10-20 - b35e9e1 - lavu 51.22.0
Add av_strtok() to avstring.h. Add av_strtok() to avstring.h.
2011-10-xx - xxxxxxx - lavf 53.10.0
Add avformat_new_stream(). Deprecate av_new_stream().
2011-xx-xx - xxxxxxx - lavf 53.9.0 2011-xx-xx - xxxxxxx - lavf 53.9.0
Add AVFMT_NO_BYTE_SEEK AVInputFormat flag. Add AVFMT_NO_BYTE_SEEK AVInputFormat flag.

View File

@ -778,7 +778,7 @@ A preset file contains a sequence of @var{option=value} pairs, one for
each line, specifying a sequence of options which can be specified also on each line, specifying a sequence of options which can be specified also on
the command line. Lines starting with the hash ('#') character are ignored and the command line. Lines starting with the hash ('#') character are ignored and
are used to provide comments. Empty lines are also ignored. Check the are used to provide comments. Empty lines are also ignored. Check the
@file{ffpresets} directory in the Libav source tree for examples. @file{presets} directory in the Libav source tree for examples.
Preset files are specified with the @code{pre} option, this option takes a Preset files are specified with the @code{pre} option, this option takes a
preset name as input. Avconv searches for a file named @var{preset_name}.avpreset in preset name as input. Avconv searches for a file named @var{preset_name}.avpreset in

View File

@ -199,7 +199,7 @@ static AVStream *add_video_stream(AVFormatContext *oc, enum CodecID codec_id)
AVCodecContext *c; AVCodecContext *c;
AVStream *st; AVStream *st;
st = av_new_stream(oc, 0); st = avformat_new_stream(oc, NULL);
if (!st) { if (!st) {
fprintf(stderr, "Could not alloc stream\n"); fprintf(stderr, "Could not alloc stream\n");
exit(1); exit(1);

View File

@ -873,7 +873,7 @@ A preset file contains a sequence of @var{option}=@var{value} pairs,
one for each line, specifying a sequence of options which would be one for each line, specifying a sequence of options which would be
awkward to specify on the command line. Lines starting with the hash awkward to specify on the command line. Lines starting with the hash
('#') character are ignored and are used to provide comments. Check ('#') character are ignored and are used to provide comments. Check
the @file{ffpresets} directory in the FFmpeg source tree for examples. the @file{presets} directory in the FFmpeg source tree for examples.
Preset files are specified with the @code{vpre}, @code{apre}, Preset files are specified with the @code{vpre}, @code{apre},
@code{spre}, and @code{fpre} options. The @code{fpre} option takes the @code{spre}, and @code{fpre} options. The @code{fpre} option takes the

View File

@ -527,6 +527,7 @@ following image formats are supported:
@tab encoding supported through external library libtheora @tab encoding supported through external library libtheora
@item Tiertex Limited SEQ video @tab @tab X @item Tiertex Limited SEQ video @tab @tab X
@tab Codec used in DOS CD-ROM FlashBack game. @tab Codec used in DOS CD-ROM FlashBack game.
@item Ut Video @tab @tab X
@item V210 Quicktime Uncompressed 4:2:2 10-bit @tab X @tab X @item V210 Quicktime Uncompressed 4:2:2 10-bit @tab X @tab X
@item VMware Screen Codec / VMware Video @tab @tab X @item VMware Screen Codec / VMware Video @tab @tab X
@tab Codec used in videos captured by VMware. @tab Codec used in videos captured by VMware.

View File

@ -3252,7 +3252,7 @@ static int get_preset_file_2(const char *preset_name, const char *codec_name, AV
static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type) static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type)
{ {
OutputStream *ost; OutputStream *ost;
AVStream *st = av_new_stream(oc, oc->nb_streams < o->nb_streamid_map ? o->streamid_map[oc->nb_streams] : 0); AVStream *st = avformat_new_stream(oc, NULL);
int idx = oc->nb_streams - 1, ret = 0; int idx = oc->nb_streams - 1, ret = 0;
int64_t max_frames = INT64_MAX; int64_t max_frames = INT64_MAX;
char *bsf = NULL, *next, *codec_tag = NULL; char *bsf = NULL, *next, *codec_tag = NULL;
@ -3266,6 +3266,9 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
exit_program(1); exit_program(1);
} }
if (oc->nb_streams - 1 < o->nb_streamid_map)
st->id = o->streamid_map[oc->nb_streams - 1];
output_streams = grow_array(output_streams, sizeof(*output_streams), &nb_output_streams, output_streams = grow_array(output_streams, sizeof(*output_streams), &nb_output_streams,
nb_output_streams + 1); nb_output_streams + 1);
ost = &output_streams[nb_output_streams - 1]; ost = &output_streams[nb_output_streams - 1];

View File

@ -1,8 +0,0 @@
coder=0
bf=0
weightb=0
8x8dct=0
level=13
maxrate=768000
bufsize=3000000
weightp=0

View File

@ -1,9 +0,0 @@
coder=0
bf=0
refs=1
weightb=0
8x8dct=0
level=30
maxrate=10000000
bufsize=10000000
weightp=0

View File

@ -4236,6 +4236,7 @@ static int parse_ffconfig(const char *filename)
stream->fmt = ffserver_guess_format(NULL, stream->filename, NULL); stream->fmt = ffserver_guess_format(NULL, stream->filename, NULL);
avcodec_get_context_defaults2(&video_enc, AVMEDIA_TYPE_VIDEO); avcodec_get_context_defaults2(&video_enc, AVMEDIA_TYPE_VIDEO);
avcodec_get_context_defaults2(&audio_enc, AVMEDIA_TYPE_AUDIO); avcodec_get_context_defaults2(&audio_enc, AVMEDIA_TYPE_AUDIO);
audio_id = CODEC_ID_NONE; audio_id = CODEC_ID_NONE;
video_id = CODEC_ID_NONE; video_id = CODEC_ID_NONE;
if (stream->fmt) { if (stream->fmt) {

View File

@ -401,6 +401,7 @@ OBJS-$(CONFIG_TTA_DECODER) += tta.o
OBJS-$(CONFIG_TWINVQ_DECODER) += twinvq.o celp_math.o OBJS-$(CONFIG_TWINVQ_DECODER) += twinvq.o celp_math.o
OBJS-$(CONFIG_TXD_DECODER) += txd.o s3tc.o OBJS-$(CONFIG_TXD_DECODER) += txd.o s3tc.o
OBJS-$(CONFIG_ULTI_DECODER) += ulti.o OBJS-$(CONFIG_ULTI_DECODER) += ulti.o
OBJS-$(CONFIG_UTVIDEO_DECODER) += utvideo.o
OBJS-$(CONFIG_V210_DECODER) += v210dec.o OBJS-$(CONFIG_V210_DECODER) += v210dec.o
OBJS-$(CONFIG_V210_ENCODER) += v210enc.o OBJS-$(CONFIG_V210_ENCODER) += v210enc.o
OBJS-$(CONFIG_V210X_DECODER) += v210x.o OBJS-$(CONFIG_V210X_DECODER) += v210x.o

View File

@ -208,6 +208,7 @@ void avcodec_register_all(void)
REGISTER_DECODER (TSCC, tscc); REGISTER_DECODER (TSCC, tscc);
REGISTER_DECODER (TXD, txd); REGISTER_DECODER (TXD, txd);
REGISTER_DECODER (ULTI, ulti); REGISTER_DECODER (ULTI, ulti);
REGISTER_DECODER (UTVIDEO, utvideo);
REGISTER_ENCDEC (V210, v210); REGISTER_ENCDEC (V210, v210);
REGISTER_DECODER (V210X, v210x); REGISTER_DECODER (V210X, v210x);
REGISTER_DECODER (VB, vb); REGISTER_DECODER (VB, vb);

View File

@ -212,6 +212,7 @@ enum CodecID {
CODEC_ID_VC1IMAGE, CODEC_ID_VC1IMAGE,
CODEC_ID_8SVX_RAW, CODEC_ID_8SVX_RAW,
CODEC_ID_G2M, CODEC_ID_G2M,
CODEC_ID_UTVIDEO_DEPRECATED,
CODEC_ID_UTVIDEO = 0x800, CODEC_ID_UTVIDEO = 0x800,
/* various PCM "codecs" */ /* various PCM "codecs" */
@ -3707,19 +3708,31 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
*/ */
const char *av_get_profile_name(const AVCodec *codec, int profile); const char *av_get_profile_name(const AVCodec *codec, int profile);
#if FF_API_ALLOC_CONTEXT
/** /**
* Set the fields of the given AVCodecContext to default values. * Set the fields of the given AVCodecContext to default values.
* *
* @param s The AVCodecContext of which the fields should be set to default values. * @param s The AVCodecContext of which the fields should be set to default values.
* @deprecated use avcodec_get_context_defaults3
*/ */
attribute_deprecated
void avcodec_get_context_defaults(AVCodecContext *s); void avcodec_get_context_defaults(AVCodecContext *s);
/** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API! /** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API!
* we WILL change its arguments and name a few times! */ * we WILL change its arguments and name a few times! */
attribute_deprecated
void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType); void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType);
#endif
/** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API! /**
* we WILL change its arguments and name a few times! */ * Set the fields of the given AVCodecContext to default values corresponding
* to the given codec (defaults may be codec-dependent).
*
* Do not call this function if a non-NULL codec has been passed
* to avcodec_alloc_context3() that allocated this AVCodecContext.
* If codec is non-NULL, it is illegal to call avcodec_open2() with a
* different codec on this AVCodecContext.
*/
int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec); int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec);
#if FF_API_ALLOC_CONTEXT #if FF_API_ALLOC_CONTEXT

View File

@ -532,18 +532,26 @@ static const AVClass av_codec_context_class = {
.child_class_next = codec_child_class_next, .child_class_next = codec_child_class_next,
}; };
#if FF_API_ALLOC_CONTEXT
void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType codec_type){ void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType codec_type){
AVCodec c= {0};
c.type= codec_type;
avcodec_get_context_defaults3(s, &c);
}
#endif
int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec){
int flags=0; int flags=0;
memset(s, 0, sizeof(AVCodecContext)); memset(s, 0, sizeof(AVCodecContext));
s->av_class = &av_codec_context_class; s->av_class = &av_codec_context_class;
s->codec_type = codec_type; s->codec_type = codec ? codec->type : AVMEDIA_TYPE_UNKNOWN;
if(codec_type == AVMEDIA_TYPE_AUDIO) if(s->codec_type == AVMEDIA_TYPE_AUDIO)
flags= AV_OPT_FLAG_AUDIO_PARAM; flags= AV_OPT_FLAG_AUDIO_PARAM;
else if(codec_type == AVMEDIA_TYPE_VIDEO) else if(s->codec_type == AVMEDIA_TYPE_VIDEO)
flags= AV_OPT_FLAG_VIDEO_PARAM; flags= AV_OPT_FLAG_VIDEO_PARAM;
else if(codec_type == AVMEDIA_TYPE_SUBTITLE) else if(s->codec_type == AVMEDIA_TYPE_SUBTITLE)
flags= AV_OPT_FLAG_SUBTITLE_PARAM; flags= AV_OPT_FLAG_SUBTITLE_PARAM;
av_opt_set_defaults2(s, flags, flags); av_opt_set_defaults2(s, flags, flags);
@ -559,10 +567,6 @@ void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType codec_typ
s->reget_buffer = avcodec_default_reget_buffer; s->reget_buffer = avcodec_default_reget_buffer;
s->reordered_opaque = AV_NOPTS_VALUE; s->reordered_opaque = AV_NOPTS_VALUE;
}
int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec){
avcodec_get_context_defaults2(s, codec ? codec->type : AVMEDIA_TYPE_UNKNOWN);
if(codec && codec->priv_data_size){ if(codec && codec->priv_data_size){
if(!s->priv_data){ if(!s->priv_data){
s->priv_data= av_mallocz(codec->priv_data_size); s->priv_data= av_mallocz(codec->priv_data_size);
@ -610,13 +614,11 @@ AVCodecContext *avcodec_alloc_context2(enum AVMediaType codec_type){
return avctx; return avctx;
} }
#endif
void avcodec_get_context_defaults(AVCodecContext *s){ void avcodec_get_context_defaults(AVCodecContext *s){
avcodec_get_context_defaults2(s, AVMEDIA_TYPE_UNKNOWN); avcodec_get_context_defaults2(s, AVMEDIA_TYPE_UNKNOWN);
} }
#if FF_API_ALLOC_CONTEXT
AVCodecContext *avcodec_alloc_context(void){ AVCodecContext *avcodec_alloc_context(void){
return avcodec_alloc_context2(AVMEDIA_TYPE_UNKNOWN); return avcodec_alloc_context2(AVMEDIA_TYPE_UNKNOWN);
} }

460
libavcodec/utvideo.c Normal file
View File

@ -0,0 +1,460 @@
/*
* Ut Video decoder
* Copyright (c) 2011 Konstantin Shishkov
*
* This file is part of Libav.
*
* Libav is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* Libav is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file
* Ut Video decoder
*/
#include <stdlib.h>
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "bytestream.h"
#include "get_bits.h"
#include "dsputil.h"
enum {
PRED_NONE = 0,
PRED_LEFT,
PRED_GRADIENT,
PRED_MEDIAN,
};
typedef struct UtvideoContext {
AVCodecContext *avctx;
AVFrame pic;
DSPContext dsp;
uint32_t frame_info_size, flags, frame_info;
int planes;
int slices;
int compression;
int interlaced;
int frame_pred;
uint8_t *slice_bits;
int slice_bits_size;
} UtvideoContext;
typedef struct HuffEntry {
uint8_t sym;
uint8_t len;
} HuffEntry;
static int huff_cmp(const void *a, const void *b)
{
const HuffEntry *aa = a, *bb = b;
return (aa->len - bb->len)*256 + aa->sym - bb->sym;
}
static int build_huff(const uint8_t *src, VLC *vlc)
{
int i;
HuffEntry he[256];
int last;
uint32_t codes[256];
uint8_t bits[256];
uint8_t syms[256];
uint32_t code;
for (i = 0; i < 256; i++) {
he[i].sym = i;
he[i].len = *src++;
}
qsort(he, 256, sizeof(*he), huff_cmp);
if (!he[0].len || he[0].len > 32)
return -1;
last = 255;
while (he[last].len == 255 && last)
last--;
code = 1;
for (i = last; i >= 0; i--) {
codes[i] = code >> (32 - he[i].len);
bits[i] = he[i].len;
syms[i] = he[i].sym;
code += 0x80000000u >> (he[i].len - 1);
}
return init_vlc_sparse(vlc, FFMIN(he[last].len, 9), last + 1,
bits, sizeof(*bits), sizeof(*bits),
codes, sizeof(*codes), sizeof(*codes),
syms, sizeof(*syms), sizeof(*syms), 0);
}
static int decode_plane(UtvideoContext *c, int plane_no,
uint8_t *dst, int step, int stride,
int width, int height,
const uint8_t *src, int src_size, int use_pred)
{
int i, j, slice, pix;
int sstart, send;
VLC vlc;
GetBitContext gb;
int prev;
if (build_huff(src, &vlc)) {
av_log(c->avctx, AV_LOG_ERROR, "Cannot build Huffman codes\n");
return AVERROR_INVALIDDATA;
}
src += 256;
src_size -= 256;
send = 0;
for (slice = 0; slice < c->slices; slice++) {
uint8_t *dest;
int slice_data_start, slice_data_end, slice_size;
sstart = send;
send = height * (slice + 1) / c->slices;
dest = dst + sstart * stride;
// slice offset and size validation was done earlier
slice_data_start = slice ? AV_RL32(src + slice * 4 - 4) : 0;
slice_data_end = AV_RL32(src + slice * 4);
slice_size = slice_data_end - slice_data_start;
if (!slice_size) {
for (j = sstart; j < send; j++) {
for (i = 0; i < width * step; i += step)
dest[i] = 0x80;
dest += stride;
}
continue;
}
memcpy(c->slice_bits, src + slice_data_start + c->slices * 4, slice_size);
memset(c->slice_bits + slice_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
c->dsp.bswap_buf((uint32_t*)c->slice_bits, (uint32_t*)c->slice_bits,
(slice_data_end - slice_data_start + 3) >> 2);
init_get_bits(&gb, c->slice_bits, slice_size * 8);
prev = 0x80;
for (j = sstart; j < send; j++) {
for (i = 0; i < width * step; i += step) {
if (get_bits_left(&gb) <= 0) {
av_log(c->avctx, AV_LOG_ERROR, "Slice decoding ran out of bits\n");
goto fail;
}
pix = get_vlc2(&gb, vlc.table, vlc.bits, 4);
if (pix < 0) {
av_log(c->avctx, AV_LOG_ERROR, "Decoding error\n");
goto fail;
}
if (use_pred) {
prev += pix;
pix = prev;
}
dest[i] = pix;
}
dest += stride;
}
if (get_bits_left(&gb) > 32)
av_log(c->avctx, AV_LOG_WARNING, "%d bits left after decoding slice\n",
get_bits_left(&gb));
}
free_vlc(&vlc);
return 0;
fail:
free_vlc(&vlc);
return AVERROR_INVALIDDATA;
}
static const int rgb_order[4] = { 1, 2, 0, 3 };
static void restore_rgb_planes(uint8_t *src, int step, int stride, int width, int height)
{
int i, j;
uint8_t r, g, b;
for (j = 0; j < height; j++) {
for (i = 0; i < width * step; i += step) {
r = src[i];
g = src[i + 1];
b = src[i + 2];
src[i] = r + g - 0x80;
src[i + 2] = b + g - 0x80;
}
src += stride;
}
}
static void restore_median(uint8_t *src, int step, int stride,
int width, int height, int slices)
{
int i, j, slice;
int A, B, C;
uint8_t *bsrc;
int slice_start, slice_height;
for (slice = 0; slice < slices; slice++) {
slice_start = (slice * height) / slices;
slice_height = ((slice + 1) * height) / slices - slice_start;
bsrc = src + slice_start * stride;
// first line - left neighbour prediction
bsrc[0] += 0x80;
A = bsrc[0];
for (i = step; i < width * step; i += step) {
bsrc[i] += A;
A = bsrc[i];
}
bsrc += stride;
if (slice_height == 1)
continue;
// second line - first element has top predition, the rest uses median
C = bsrc[-stride];
bsrc[0] += C;
A = bsrc[0];
for (i = step; i < width * step; i += step) {
B = bsrc[i - stride];
bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C));
C = B;
A = bsrc[i];
}
bsrc += stride;
// the rest of lines use continuous median prediction
for (j = 2; j < slice_height; j++) {
for (i = 0; i < width * step; i += step) {
B = bsrc[i - stride];
bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C));
C = B;
A = bsrc[i];
}
bsrc += stride;
}
}
}
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
const uint8_t *buf_end = buf + buf_size;
UtvideoContext *c = avctx->priv_data;
const uint8_t *ptr;
int i, j;
const uint8_t *plane_start[5];
int plane_size, max_slice_size = 0, slice_start, slice_end, slice_size;
int ret;
if (c->pic.data[0])
avctx->release_buffer(avctx, &c->pic);
c->pic.reference = 1;
c->pic.buffer_hints = FF_BUFFER_HINTS_VALID;
if ((ret = avctx->get_buffer(avctx, &c->pic)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
/* parse plane structure to retrieve frame flags and validate slice offsets */
ptr = buf;
for (i = 0; i < c->planes; i++) {
plane_start[i] = ptr;
if (buf_end - ptr < 256 + 4 * c->slices) {
av_log(avctx, AV_LOG_ERROR, "Insufficient data for a plane\n");
return AVERROR_INVALIDDATA;
}
ptr += 256;
slice_start = 0;
slice_end = 0;
for (j = 0; j < c->slices; j++) {
slice_end = bytestream_get_le32(&ptr);
slice_size = slice_end - slice_start;
if (slice_size < 0) {
av_log(avctx, AV_LOG_ERROR, "Incorrect slice size\n");
return AVERROR_INVALIDDATA;
}
slice_start = slice_end;
max_slice_size = FFMAX(max_slice_size, slice_size);
}
plane_size = slice_end;
if (buf_end - ptr < plane_size) {
av_log(avctx, AV_LOG_ERROR, "Plane size is bigger than available data\n");
return AVERROR_INVALIDDATA;
}
ptr += plane_size;
}
plane_start[c->planes] = ptr;
if (buf_end - ptr < c->frame_info_size) {
av_log(avctx, AV_LOG_ERROR, "Not enough data for frame information\n");
return AVERROR_INVALIDDATA;
}
c->frame_info = AV_RL32(ptr);
av_log(avctx, AV_LOG_DEBUG, "frame information flags %X\n", c->frame_info);
c->frame_pred = (c->frame_info >> 8) & 3;
if (c->frame_pred == PRED_GRADIENT) {
av_log_ask_for_sample(avctx, "Frame uses gradient prediction\n");
return AVERROR_PATCHWELCOME;
}
av_fast_malloc(&c->slice_bits, &c->slice_bits_size,
max_slice_size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!c->slice_bits) {
av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer\n");
return AVERROR(ENOMEM);
}
switch (c->avctx->pix_fmt) {
case PIX_FMT_RGB24:
case PIX_FMT_RGBA:
for (i = 0; i < c->planes; i++) {
ret = decode_plane(c, i, c->pic.data[0] + rgb_order[i], c->planes,
c->pic.linesize[0], avctx->width, avctx->height,
plane_start[i], plane_start[i + 1] - plane_start[i],
c->frame_pred == PRED_LEFT);
if (ret)
return ret;
if (c->frame_pred == PRED_MEDIAN)
restore_median(c->pic.data[0] + rgb_order[i], c->planes,
c->pic.linesize[0], avctx->width, avctx->height,
c->slices);
}
restore_rgb_planes(c->pic.data[0], c->planes, c->pic.linesize[0],
avctx->width, avctx->height);
break;
case PIX_FMT_YUV420P:
for (i = 0; i < 3; i++) {
ret = decode_plane(c, i, c->pic.data[i], 1,
c->pic.linesize[i], avctx->width >> !!i, avctx->height >> !!i,
plane_start[i], plane_start[i + 1] - plane_start[i],
c->frame_pred == PRED_LEFT);
if (ret)
return ret;
if (c->frame_pred == PRED_MEDIAN)
restore_median(c->pic.data[i], 1, c->pic.linesize[i],
avctx->width >> !!i, avctx->height >> !!i,
c->slices);
}
break;
case PIX_FMT_YUV422P:
for (i = 0; i < 3; i++) {
ret = decode_plane(c, i, c->pic.data[i], 1,
c->pic.linesize[i], avctx->width >> !!i, avctx->height,
plane_start[i], plane_start[i + 1] - plane_start[i],
c->frame_pred == PRED_LEFT);
if (ret)
return ret;
if (c->frame_pred == PRED_MEDIAN)
restore_median(c->pic.data[i], 1, c->pic.linesize[i],
avctx->width >> !!i, avctx->height, c->slices);
}
break;
}
*data_size = sizeof(AVFrame);
*(AVFrame*)data = c->pic;
/* always report that the buffer was completely consumed */
return buf_size;
}
static av_cold int decode_init(AVCodecContext *avctx)
{
UtvideoContext * const c = avctx->priv_data;
c->avctx = avctx;
dsputil_init(&c->dsp, avctx);
if (avctx->extradata_size < 16) {
av_log(avctx, AV_LOG_ERROR, "Insufficient extradata size %d, should be at least 16\n",
avctx->extradata_size);
return AVERROR_INVALIDDATA;
}
av_log(avctx, AV_LOG_DEBUG, "Encoder version %d.%d.%d.%d\n",
avctx->extradata[3], avctx->extradata[2],
avctx->extradata[1], avctx->extradata[0]);
av_log(avctx, AV_LOG_DEBUG, "Original format %X\n", AV_RB32(avctx->extradata + 4));
c->frame_info_size = AV_RL32(avctx->extradata + 8);
c->flags = AV_RL32(avctx->extradata + 12);
if (c->frame_info_size != 4)
av_log_ask_for_sample(avctx, "Frame info is not 4 bytes\n");
av_log(avctx, AV_LOG_DEBUG, "Encoding parameters %08X\n", c->flags);
c->slices = (c->flags >> 24) + 1;
c->compression = c->flags & 1;
c->interlaced = c->flags & 0x800;
c->slice_bits_size = 0;
switch (avctx->codec_tag) {
case MKTAG('U', 'L', 'R', 'G'):
c->planes = 3;
avctx->pix_fmt = PIX_FMT_RGB24;
break;
case MKTAG('U', 'L', 'R', 'A'):
c->planes = 4;
avctx->pix_fmt = PIX_FMT_RGBA;
break;
case MKTAG('U', 'L', 'Y', '0'):
c->planes = 3;
avctx->pix_fmt = PIX_FMT_YUV420P;
break;
case MKTAG('U', 'L', 'Y', '2'):
c->planes = 3;
avctx->pix_fmt = PIX_FMT_YUV422P;
break;
default:
av_log(avctx, AV_LOG_ERROR, "Unknown Ut Video FOURCC provided (%08X)\n",
avctx->codec_tag);
return AVERROR_INVALIDDATA;
}
return 0;
}
static av_cold int decode_end(AVCodecContext *avctx)
{
UtvideoContext * const c = avctx->priv_data;
if (c->pic.data[0])
avctx->release_buffer(avctx, &c->pic);
av_freep(&c->slice_bits);
return 0;
}
AVCodec ff_utvideo_decoder = {
.name = "utvideo",
.type = AVMEDIA_TYPE_VIDEO,
.id = CODEC_ID_UTVIDEO,
.priv_data_size = sizeof(UtvideoContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("Ut Video"),
};

View File

@ -1291,6 +1291,7 @@ static av_always_inline int scaleforsame_x(VC1Context *v, int n /* MV */, int di
int scaledvalue, refdist; int scaledvalue, refdist;
int scalesame1, scalesame2; int scalesame1, scalesame2;
int scalezone1_x, zone1offset_x; int scalezone1_x, zone1offset_x;
int table_index = dir ^ v->second_field;
if (v->s.pict_type != AV_PICTURE_TYPE_B) if (v->s.pict_type != AV_PICTURE_TYPE_B)
refdist = v->refdist; refdist = v->refdist;
@ -1298,10 +1299,10 @@ static av_always_inline int scaleforsame_x(VC1Context *v, int n /* MV */, int di
refdist = dir ? v->brfd : v->frfd; refdist = dir ? v->brfd : v->frfd;
if (refdist > 3) if (refdist > 3)
refdist = 3; refdist = 3;
scalesame1 = vc1_field_mvpred_scales[v->second_field][1][refdist]; scalesame1 = vc1_field_mvpred_scales[table_index][1][refdist];
scalesame2 = vc1_field_mvpred_scales[v->second_field][2][refdist]; scalesame2 = vc1_field_mvpred_scales[table_index][2][refdist];
scalezone1_x = vc1_field_mvpred_scales[v->second_field][3][refdist]; scalezone1_x = vc1_field_mvpred_scales[table_index][3][refdist];
zone1offset_x = vc1_field_mvpred_scales[v->second_field][5][refdist]; zone1offset_x = vc1_field_mvpred_scales[table_index][5][refdist];
if (FFABS(n) > 255) if (FFABS(n) > 255)
scaledvalue = n; scaledvalue = n;
@ -1323,6 +1324,7 @@ static av_always_inline int scaleforsame_y(VC1Context *v, int i, int n /* MV */,
int scaledvalue, refdist; int scaledvalue, refdist;
int scalesame1, scalesame2; int scalesame1, scalesame2;
int scalezone1_y, zone1offset_y; int scalezone1_y, zone1offset_y;
int table_index = dir ^ v->second_field;
if (v->s.pict_type != AV_PICTURE_TYPE_B) if (v->s.pict_type != AV_PICTURE_TYPE_B)
refdist = v->refdist; refdist = v->refdist;
@ -1330,10 +1332,10 @@ static av_always_inline int scaleforsame_y(VC1Context *v, int i, int n /* MV */,
refdist = dir ? v->brfd : v->frfd; refdist = dir ? v->brfd : v->frfd;
if (refdist > 3) if (refdist > 3)
refdist = 3; refdist = 3;
scalesame1 = vc1_field_mvpred_scales[v->second_field][1][refdist]; scalesame1 = vc1_field_mvpred_scales[table_index][1][refdist];
scalesame2 = vc1_field_mvpred_scales[v->second_field][2][refdist]; scalesame2 = vc1_field_mvpred_scales[table_index][2][refdist];
scalezone1_y = vc1_field_mvpred_scales[v->second_field][4][refdist]; scalezone1_y = vc1_field_mvpred_scales[table_index][4][refdist];
zone1offset_y = vc1_field_mvpred_scales[v->second_field][6][refdist]; zone1offset_y = vc1_field_mvpred_scales[table_index][6][refdist];
if (FFABS(n) > 63) if (FFABS(n) > 63)
scaledvalue = n; scaledvalue = n;
@ -1444,7 +1446,7 @@ static av_always_inline int scaleforopp(VC1Context *v, int n /* MV */,
refdist = FFMIN(v->refdist, 3); refdist = FFMIN(v->refdist, 3);
else else
refdist = dir ? v->brfd : v->frfd; refdist = dir ? v->brfd : v->frfd;
scaleopp = vc1_field_mvpred_scales[v->second_field][0][refdist]; scaleopp = vc1_field_mvpred_scales[dir ^ v->second_field][0][refdist];
return n * scaleopp >> 8; return n * scaleopp >> 8;
} }

View File

@ -21,7 +21,7 @@
#define AVCODEC_VERSION_H #define AVCODEC_VERSION_H
#define LIBAVCODEC_VERSION_MAJOR 53 #define LIBAVCODEC_VERSION_MAJOR 53
#define LIBAVCODEC_VERSION_MINOR 21 #define LIBAVCODEC_VERSION_MINOR 22
#define LIBAVCODEC_VERSION_MICRO 0 #define LIBAVCODEC_VERSION_MICRO 0
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \

View File

@ -61,7 +61,7 @@ static av_cold int audio_read_header(AVFormatContext *s1,
enum CodecID codec_id; enum CodecID codec_id;
double o; double o;
st = av_new_stream(s1, 0); st = avformat_new_stream(s1, NULL);
if (!st) { if (!st) {
av_log(s1, AV_LOG_ERROR, "Cannot add stream\n"); av_log(s1, AV_LOG_ERROR, "Cannot add stream\n");

View File

@ -271,7 +271,7 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
goto out; goto out;
} }
st = av_new_stream(s1, 0); st = avformat_new_stream(s1, NULL);
if (!st) { if (!st) {
ret = AVERROR(ENOMEM); ret = AVERROR(ENOMEM);
goto out; goto out;

View File

@ -108,7 +108,7 @@ av_cold static int fbdev_read_header(AVFormatContext *avctx,
return ret; return ret;
} }
if (!(st = av_new_stream(avctx, 0))) if (!(st = avformat_new_stream(avctx, NULL)))
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in microseconds */ av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in microseconds */

View File

@ -229,7 +229,7 @@ static int audio_read_header(AVFormatContext *context, AVFormatParameters *param
if ((test = start_jack(context))) if ((test = start_jack(context)))
return test; return test;
stream = av_new_stream(context, 0); stream = avformat_new_stream(context, NULL);
if (!stream) { if (!stream) {
stop_jack(self); stop_jack(self);
return AVERROR(ENOMEM); return AVERROR(ENOMEM);

View File

@ -54,7 +54,7 @@ static av_cold int read_header(AVFormatContext *ctx, AVFormatParameters *ap)
int ret, i; int ret, i;
char *err = NULL; char *err = NULL;
if (!(st = av_new_stream(ctx, 0))) if (!(st = avformat_new_stream(ctx, NULL)))
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
s->drive = cdio_cddap_identify(ctx->filename, CDDA_MESSAGE_LOGIT, &err); s->drive = cdio_cddap_identify(ctx->filename, CDDA_MESSAGE_LOGIT, &err);
if (!s->drive) { if (!s->drive) {

View File

@ -253,7 +253,7 @@ static int dc1394_read_header(AVFormatContext *c, AVFormatParameters * ap)
} }
/* create a video stream */ /* create a video stream */
vst = av_new_stream(c, 0); vst = avformat_new_stream(c, NULL);
if (!vst) if (!vst)
goto out_camera; goto out_camera;
av_set_pts_info(vst, 64, 1, 1000); av_set_pts_info(vst, 64, 1, 1000);

View File

@ -209,7 +209,7 @@ static int audio_read_header(AVFormatContext *s1, AVFormatParameters *ap)
AVStream *st; AVStream *st;
int ret; int ret;
st = av_new_stream(s1, 0); st = avformat_new_stream(s1, NULL);
if (!st) { if (!st) {
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }

View File

@ -34,7 +34,7 @@ static av_cold int audio_read_header(AVFormatContext *s1,
AVStream *st; AVStream *st;
int ret; int ret;
st = av_new_stream(s1, 0); st = avformat_new_stream(s1, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);

View File

@ -98,7 +98,7 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
s->video_win.width = ap->width; s->video_win.width = ap->width;
s->video_win.height = ap->height; s->video_win.height = ap->height;
st = av_new_stream(s1, 0); st = avformat_new_stream(s1, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */ av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */

View File

@ -560,7 +560,7 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap)
enum CodecID codec_id; enum CodecID codec_id;
enum PixelFormat pix_fmt = PIX_FMT_NONE; enum PixelFormat pix_fmt = PIX_FMT_NONE;
st = av_new_stream(s1, 0); st = avformat_new_stream(s1, NULL);
if (!st) { if (!st) {
res = AVERROR(ENOMEM); res = AVERROR(ENOMEM);
goto out; goto out;

View File

@ -293,7 +293,7 @@ static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap)
SetWindowLongPtr(ctx->hwnd, GWLP_USERDATA, (LONG_PTR) s); SetWindowLongPtr(ctx->hwnd, GWLP_USERDATA, (LONG_PTR) s);
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if(!st) { if(!st) {
vfw_read_close(s); vfw_read_close(s);
return AVERROR(ENOMEM); return AVERROR(ENOMEM);

View File

@ -194,7 +194,7 @@ x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
goto out; goto out;
} }
st = av_new_stream(s1, 0); st = avformat_new_stream(s1, NULL);
if (!st) { if (!st) {
ret = AVERROR(ENOMEM); ret = AVERROR(ENOMEM);
goto out; goto out;

View File

@ -30,7 +30,7 @@
#define LIBAVFILTER_VERSION_MAJOR 2 #define LIBAVFILTER_VERSION_MAJOR 2
#define LIBAVFILTER_VERSION_MINOR 44 #define LIBAVFILTER_VERSION_MINOR 44
#define LIBAVFILTER_VERSION_MICRO 0 #define LIBAVFILTER_VERSION_MICRO 1
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \ LIBAVFILTER_VERSION_MINOR, \

View File

@ -103,7 +103,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
test->nb_frame = 0; test->nb_frame = 0;
test->pts = 0; test->pts = 0;
av_log(ctx, AV_LOG_INFO, "size:%dx%d rate:%d/%d duration:%f sar:%d/%d\n", av_log(ctx, AV_LOG_DEBUG, "size:%dx%d rate:%d/%d duration:%f sar:%d/%d\n",
test->w, test->h, frame_rate_q.num, frame_rate_q.den, test->w, test->h, frame_rate_q.num, frame_rate_q.den,
duration < 0 ? -1 : test->max_pts * av_q2d(test->time_base), duration < 0 ? -1 : test->max_pts * av_q2d(test->time_base),
test->sar.num, test->sar.den); test->sar.num, test->sar.den);
@ -156,9 +156,9 @@ static const char *testsrc_get_name(void *ctx)
} }
static const AVClass testsrc_class = { static const AVClass testsrc_class = {
"TestSourceContext", .class_name = "TestSourceContext",
testsrc_get_name, .item_name = testsrc_get_name,
testsrc_options .option = testsrc_options,
}; };
/** /**
@ -378,9 +378,9 @@ static const char *rgbtestsrc_get_name(void *ctx)
} }
static const AVClass rgbtestsrc_class = { static const AVClass rgbtestsrc_class = {
"RGBTestSourceContext", .class_name = "RGBTestSourceContext",
rgbtestsrc_get_name, .item_name = rgbtestsrc_get_name,
testsrc_options .option = testsrc_options,
}; };
#define R 0 #define R 0

View File

@ -141,7 +141,7 @@ static int fourxm_read_header(AVFormatContext *s,
fourxm->height = AV_RL32(&header[i + 40]); fourxm->height = AV_RL32(&header[i + 40]);
/* allocate a new AVStream */ /* allocate a new AVStream */
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if (!st){ if (!st){
ret= AVERROR(ENOMEM); ret= AVERROR(ENOMEM);
goto fail; goto fail;
@ -199,12 +199,13 @@ static int fourxm_read_header(AVFormatContext *s,
i += 8 + size; i += 8 + size;
/* allocate a new AVStream */ /* allocate a new AVStream */
st = av_new_stream(s, current_track); st = avformat_new_stream(s, NULL);
if (!st){ if (!st){
ret= AVERROR(ENOMEM); ret= AVERROR(ENOMEM);
goto fail; goto fail;
} }
st->id = current_track;
av_set_pts_info(st, 60, 1, fourxm->tracks[current_track].sample_rate); av_set_pts_info(st, 60, 1, fourxm->tracks[current_track].sample_rate);
fourxm->tracks[current_track].stream_index = st->index; fourxm->tracks[current_track].stream_index = st->index;

View File

@ -66,7 +66,7 @@ static int adts_aac_read_header(AVFormatContext *s,
{ {
AVStream *st; AVStream *st;
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);

View File

@ -57,7 +57,7 @@ static int aea_read_probe(AVProbeData *p)
static int aea_read_header(AVFormatContext *s, static int aea_read_header(AVFormatContext *s,
AVFormatParameters *ap) AVFormatParameters *ap)
{ {
AVStream *st = av_new_stream(s, 0); AVStream *st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);

View File

@ -198,7 +198,7 @@ static int aiff_read_header(AVFormatContext *s,
filesize -= 4; filesize -= 4;
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);

View File

@ -84,7 +84,7 @@ static int amr_read_header(AVFormatContext *s,
avio_read(pb, header, 6); avio_read(pb, header, 6);
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
{ {
return AVERROR(ENOMEM); return AVERROR(ENOMEM);

View File

@ -97,7 +97,7 @@ static int read_header(AVFormatContext *s,
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
/* video stream */ /* video stream */
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_type = AVMEDIA_TYPE_VIDEO;

View File

@ -39,7 +39,7 @@ static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap)
avio_rl32(pb); /* _APC */ avio_rl32(pb); /* _APC */
avio_rl32(pb); /* 1.20 */ avio_rl32(pb); /* 1.20 */
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);

View File

@ -313,7 +313,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
ape->compressiontype); ape->compressiontype);
/* now we are ready: build format streams */ /* now we are ready: build format streams */
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return -1; return -1;

View File

@ -505,11 +505,12 @@ static int applehttp_read_header(AVFormatContext *s, AVFormatParameters *ap)
snprintf(bitrate_str, sizeof(bitrate_str), "%d", v->bandwidth); snprintf(bitrate_str, sizeof(bitrate_str), "%d", v->bandwidth);
/* Create new AVStreams for each stream in this variant */ /* Create new AVStreams for each stream in this variant */
for (j = 0; j < v->ctx->nb_streams; j++) { for (j = 0; j < v->ctx->nb_streams; j++) {
AVStream *st = av_new_stream(s, i); AVStream *st = avformat_new_stream(s, NULL);
if (!st) { if (!st) {
ret = AVERROR(ENOMEM); ret = AVERROR(ENOMEM);
goto fail; goto fail;
} }
st->id = i;
avcodec_copy_context(st->codec, v->ctx->streams[j]->codec); avcodec_copy_context(st->codec, v->ctx->streams[j]->codec);
if (v->bandwidth) if (v->bandwidth)
av_dict_set(&st->metadata, "variant_bitrate", bitrate_str, av_dict_set(&st->metadata, "variant_bitrate", bitrate_str,

View File

@ -224,7 +224,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
pos1 = avio_tell(pb); pos1 = avio_tell(pb);
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
av_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */ av_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */

View File

@ -83,7 +83,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
uint8_t *p, **dst[2]={0}; uint8_t *p, **dst[2]={0};
int pos[2]={0}; int pos[2]={0};
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return -1; return -1;
av_set_pts_info(st, 64, 1, 100); av_set_pts_info(st, 64, 1, 100);

View File

@ -156,7 +156,7 @@ static int au_read_header(AVFormatContext *s,
} }
/* now we are ready: build format streams */ /* now we are ready: build format streams */
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return -1; return -1;
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_type = AVMEDIA_TYPE_AUDIO;

View File

@ -1402,6 +1402,7 @@ void av_close_input_file(AVFormatContext *s);
*/ */
void avformat_free_context(AVFormatContext *s); void avformat_free_context(AVFormatContext *s);
#if FF_API_NEW_STREAM
/** /**
* Add a new stream to a media file. * Add a new stream to a media file.
* *
@ -1412,7 +1413,27 @@ void avformat_free_context(AVFormatContext *s);
* @param s media file handle * @param s media file handle
* @param id file-format-dependent stream ID * @param id file-format-dependent stream ID
*/ */
attribute_deprecated
AVStream *av_new_stream(AVFormatContext *s, int id); AVStream *av_new_stream(AVFormatContext *s, int id);
#endif
/**
* Add a new stream to a media file.
*
* When demuxing, it is called by the demuxer in read_header(). If the
* flag AVFMTCTX_NOHEADER is set in s.ctx_flags, then it may also
* be called in read_packet().
*
* When muxing, should be called by the user before avformat_write_header().
*
* @param c If non-NULL, the AVCodecContext corresponding to the new stream
* will be initialized to use this codec. This is needed for e.g. codec-specific
* defaults to be set, so codec should be provided if it is known.
*
* @return newly created stream or NULL on error.
*/
AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c);
AVProgram *av_new_program(AVFormatContext *s, int id); AVProgram *av_new_program(AVFormatContext *s, int id);
/** /**

View File

@ -454,10 +454,11 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
break; break;
}else{ }else{
stream_index++; stream_index++;
st = av_new_stream(s, stream_index); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
goto fail; goto fail;
st->id = stream_index;
ast = av_mallocz(sizeof(AVIStream)); ast = av_mallocz(sizeof(AVIStream));
if (!ast) if (!ast)
goto fail; goto fail;

View File

@ -84,7 +84,8 @@ static int avisynth_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (AVIStreamReadFormat(stream->handle, 0, &wvfmt, &struct_size) != S_OK) if (AVIStreamReadFormat(stream->handle, 0, &wvfmt, &struct_size) != S_OK)
continue; continue;
st = av_new_stream(s, id); st = avformat_new_stream(s, NULL);
st->id = id;
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->block_align = wvfmt.nBlockAlign; st->codec->block_align = wvfmt.nBlockAlign;
@ -110,7 +111,8 @@ static int avisynth_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (AVIStreamReadFormat(stream->handle, 0, &imgfmt, &struct_size) != S_OK) if (AVIStreamReadFormat(stream->handle, 0, &imgfmt, &struct_size) != S_OK)
continue; continue;
st = av_new_stream(s, id); st = avformat_new_stream(s, NULL);
st->id = id;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->r_frame_rate.num = stream->info.dwRate; st->r_frame_rate.num = stream->info.dwRate;
st->r_frame_rate.den = stream->info.dwScale; st->r_frame_rate.den = stream->info.dwScale;

View File

@ -179,7 +179,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt)
case AVS_VIDEO: case AVS_VIDEO:
if (!avs->st_video) { if (!avs->st_video) {
avs->st_video = av_new_stream(s, AVS_VIDEO); avs->st_video = avformat_new_stream(s, NULL);
if (avs->st_video == NULL) if (avs->st_video == NULL)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
avs->st_video->codec->codec_type = AVMEDIA_TYPE_VIDEO; avs->st_video->codec->codec_type = AVMEDIA_TYPE_VIDEO;
@ -196,7 +196,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt)
case AVS_AUDIO: case AVS_AUDIO:
if (!avs->st_audio) { if (!avs->st_audio) {
avs->st_audio = av_new_stream(s, AVS_AUDIO); avs->st_audio = avformat_new_stream(s, NULL);
if (avs->st_audio == NULL) if (avs->st_audio == NULL)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
avs->st_audio->codec->codec_type = AVMEDIA_TYPE_AUDIO; avs->st_audio->codec->codec_type = AVMEDIA_TYPE_AUDIO;

View File

@ -70,7 +70,7 @@ static int vid_read_header(AVFormatContext *s,
avio_skip(pb, 5); avio_skip(pb, 5);
vid->nframes = avio_rl16(pb); vid->nframes = avio_rl16(pb);
stream = av_new_stream(s, 0); stream = avformat_new_stream(s, NULL);
if (!stream) if (!stream)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
av_set_pts_info(stream, 32, 1, 60); // 16 ms increments, i.e. 60 fps av_set_pts_info(stream, 32, 1, 60); // 16 ms increments, i.e. 60 fps
@ -83,7 +83,7 @@ static int vid_read_header(AVFormatContext *s,
avio_rl16(pb); avio_rl16(pb);
// done with video codec, set up audio codec // done with video codec, set up audio codec
stream = av_new_stream(s, 0); stream = avformat_new_stream(s, NULL);
if (!stream) if (!stream)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
stream->codec->codec_type = AVMEDIA_TYPE_AUDIO; stream->codec->codec_type = AVMEDIA_TYPE_AUDIO;

View File

@ -55,12 +55,12 @@ static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap)
int fps, chunk_header; int fps, chunk_header;
/* Initialize the video codec... */ /* Initialize the video codec... */
vstream = av_new_stream(s, 0); vstream = avformat_new_stream(s, NULL);
if (!vstream) if (!vstream)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
/* Initialize the audio codec... */ /* Initialize the audio codec... */
astream = av_new_stream(s, 0); astream = avformat_new_stream(s, NULL);
if (!astream) if (!astream)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);

View File

@ -78,7 +78,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
uint16_t flags; uint16_t flags;
int keyframe; int keyframe;
vst = av_new_stream(s, 0); vst = avformat_new_stream(s, NULL);
if (!vst) if (!vst)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
@ -130,7 +130,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
avio_skip(pb, 4 * bink->num_audio_tracks); avio_skip(pb, 4 * bink->num_audio_tracks);
for (i = 0; i < bink->num_audio_tracks; i++) { for (i = 0; i < bink->num_audio_tracks; i++) {
ast = av_new_stream(s, 1); ast = avformat_new_stream(s, NULL);
if (!ast) if (!ast)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;

View File

@ -79,7 +79,7 @@ static int read_header(AVFormatContext *s,
/* Audio streams are added if audio packets are found */ /* Audio streams are added if audio packets are found */
s->ctx_flags |= AVFMTCTX_NOHEADER; s->ctx_flags |= AVFMTCTX_NOHEADER;
video = av_new_stream(s, 0); video = avformat_new_stream(s, NULL);
if (!video) if (!video)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
@ -117,7 +117,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
datasize = avio_rl16(pb); datasize = avio_rl16(pb);
if (datasize > 42) { if (datasize > 42) {
if (!c93->audio) { if (!c93->audio) {
c93->audio = av_new_stream(s, 1); c93->audio = avformat_new_stream(s, NULL);
if (!c93->audio) if (!c93->audio)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
c93->audio->codec->codec_type = AVMEDIA_TYPE_AUDIO; c93->audio->codec->codec_type = AVMEDIA_TYPE_AUDIO;

View File

@ -61,7 +61,7 @@ static int read_desc_chunk(AVFormatContext *s)
int flags; int flags;
/* new audio stream */ /* new audio stream */
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);

View File

@ -28,7 +28,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
AVStream *vst; AVStream *vst;
int ret; int ret;
vst = av_new_stream(s, 0); vst = avformat_new_stream(s, NULL);
if (!vst) if (!vst)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);

View File

@ -21,7 +21,7 @@
#include "avformat.h" #include "avformat.h"
static int daud_header(AVFormatContext *s, AVFormatParameters *ap) { static int daud_header(AVFormatContext *s, AVFormatParameters *ap) {
AVStream *st = av_new_stream(s, 0); AVStream *st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_type = AVMEDIA_TYPE_AUDIO;

View File

@ -45,7 +45,7 @@ static int dfa_read_header(AVFormatContext *s,
avio_skip(pb, 2); // unused avio_skip(pb, 2); // unused
frames = avio_rl16(pb); frames = avio_rl16(pb);
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);

View File

@ -107,7 +107,7 @@ static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap)
cin->audio_buffer_size = 0; cin->audio_buffer_size = 0;
/* initialize the video decoder stream */ /* initialize the video decoder stream */
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
@ -120,7 +120,7 @@ static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->height = hdr->video_frame_height; st->codec->height = hdr->video_frame_height;
/* initialize the audio decoder stream */ /* initialize the audio decoder stream */
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);

View File

@ -211,7 +211,7 @@ static int dv_extract_audio_info(DVDemuxContext* c, uint8_t* frame)
/* Dynamic handling of the audio streams in DV */ /* Dynamic handling of the audio streams in DV */
for (i = 0; i < ach; i++) { for (i = 0; i < ach; i++) {
if (!c->ast[i]) { if (!c->ast[i]) {
c->ast[i] = av_new_stream(c->fctx, 0); c->ast[i] = avformat_new_stream(c->fctx, NULL);
if (!c->ast[i]) if (!c->ast[i])
break; break;
av_set_pts_info(c->ast[i], 64, 1, 30000); av_set_pts_info(c->ast[i], 64, 1, 30000);
@ -278,7 +278,7 @@ DVDemuxContext* dv_init_demux(AVFormatContext *s)
if (!c) if (!c)
return NULL; return NULL;
c->vst = av_new_stream(s, 0); c->vst = avformat_new_stream(s, NULL);
if (!c->vst) { if (!c->vst) {
av_free(c); av_free(c);
return NULL; return NULL;

View File

@ -87,7 +87,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap)
h = avio_rb16(pb); h = avio_rb16(pb);
c->has_sound = 0; c->has_sound = 0;
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return -1; return -1;
@ -100,7 +100,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap)
avio_skip(pb, 16); avio_skip(pb, 16);
fsize = avio_rl32(pb); fsize = avio_rl32(pb);
ast = av_new_stream(s, 0); ast = avformat_new_stream(s, NULL);
if (!ast) if (!ast)
return -1; return -1;
ret = ff_get_wav_header(pb, ast->codec, fsize); ret = ff_get_wav_header(pb, ast->codec, fsize);

View File

@ -66,7 +66,7 @@ static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap)
sample_rate = avio_rb16(pb); sample_rate = avio_rb16(pb);
avio_skip(pb, (avio_r8(pb) & 0x20) ? 15 : 11); avio_skip(pb, (avio_r8(pb) & 0x20) ? 15 : 11);
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_type = AVMEDIA_TYPE_AUDIO;

View File

@ -408,7 +408,7 @@ static int ea_read_header(AVFormatContext *s,
if (ea->video_codec) { if (ea->video_codec) {
/* initialize the video decoder stream */ /* initialize the video decoder stream */
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
ea->video_stream_index = st->index; ea->video_stream_index = st->index;
@ -437,7 +437,7 @@ static int ea_read_header(AVFormatContext *s,
} }
/* initialize the audio decoder stream */ /* initialize the audio decoder stream */
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
av_set_pts_info(st, 33, 1, ea->sample_rate); av_set_pts_info(st, 33, 1, ea->sample_rate);

View File

@ -295,7 +295,7 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
for(i=0;i<nb_streams;i++) { for(i=0;i<nb_streams;i++) {
char rc_eq_buf[128]; char rc_eq_buf[128];
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
goto fail; goto fail;

View File

@ -132,7 +132,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
get_line(s->pb, line, sizeof(line)); get_line(s->pb, line, sizeof(line));
if (!memcmp(line, ID_STREAM, strlen(ID_STREAM))) { if (!memcmp(line, ID_STREAM, strlen(ID_STREAM))) {
AVStream *st = av_new_stream(s, 0); AVStream *st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return -1; return -1;

View File

@ -49,7 +49,7 @@ static int read_header(AVFormatContext *s,
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);

View File

@ -31,7 +31,7 @@ static int flac_read_header(AVFormatContext *s,
int ret, metadata_last=0, metadata_type, metadata_size, found_streaminfo=0; int ret, metadata_last=0, metadata_type, metadata_size, found_streaminfo=0;
uint8_t header[4]; uint8_t header[4];
uint8_t *buffer=NULL; uint8_t *buffer=NULL;
AVStream *st = av_new_stream(s, 0); AVStream *st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_type = AVMEDIA_TYPE_AUDIO;

View File

@ -105,7 +105,7 @@ static int flic_read_header(AVFormatContext *s,
speed = FLIC_DEFAULT_SPEED; speed = FLIC_DEFAULT_SPEED;
/* initialize the decoder streams */ /* initialize the decoder streams */
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
flic->video_stream_index = st->index; flic->video_stream_index = st->index;
@ -145,7 +145,7 @@ static int flic_read_header(AVFormatContext *s,
*/ */
if (AV_RL16(&preamble[4]) == FLIC_TFTD_CHUNK_AUDIO) { if (AV_RL16(&preamble[4]) == FLIC_TFTD_CHUNK_AUDIO) {
/* TFTD videos have an extra 22050 Hz 8-bit mono audio stream */ /* TFTD videos have an extra 22050 Hz 8-bit mono audio stream */
ast = av_new_stream(s, 1); ast = avformat_new_stream(s, NULL);
if (!ast) if (!ast)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);

View File

@ -347,9 +347,10 @@ static int flv_read_metabody(AVFormatContext *s, int64_t next_pos) {
} }
static AVStream *create_stream(AVFormatContext *s, int stream_type){ static AVStream *create_stream(AVFormatContext *s, int stream_type){
AVStream *st = av_new_stream(s, stream_type); AVStream *st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return NULL; return NULL;
st->id = stream_type;
switch(stream_type) { switch(stream_type) {
case FLV_STREAM_TYPE_VIDEO: st->codec->codec_type = AVMEDIA_TYPE_VIDEO; break; case FLV_STREAM_TYPE_VIDEO: st->codec->codec_type = AVMEDIA_TYPE_VIDEO; break;
case FLV_STREAM_TYPE_AUDIO: st->codec->codec_type = AVMEDIA_TYPE_AUDIO; break; case FLV_STREAM_TYPE_AUDIO: st->codec->codec_type = AVMEDIA_TYPE_AUDIO; break;

View File

@ -81,9 +81,10 @@ static int get_sindex(AVFormatContext *s, int id, int format) {
i = ff_find_stream_index(s, id); i = ff_find_stream_index(s, id);
if (i >= 0) if (i >= 0)
return i; return i;
st = av_new_stream(s, id); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
st->id = id;
switch (format) { switch (format) {
case 3: case 3:
case 4: case 4:

View File

@ -153,7 +153,7 @@ static int idcin_read_header(AVFormatContext *s,
bytes_per_sample = avio_rl32(pb); bytes_per_sample = avio_rl32(pb);
channels = avio_rl32(pb); channels = avio_rl32(pb);
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
av_set_pts_info(st, 33, 1, IDCIN_FPS); av_set_pts_info(st, 33, 1, IDCIN_FPS);
@ -174,7 +174,7 @@ static int idcin_read_header(AVFormatContext *s,
/* if sample rate is 0, assume no audio */ /* if sample rate is 0, assume no audio */
if (sample_rate) { if (sample_rate) {
idcin->audio_present = 1; idcin->audio_present = 1;
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
av_set_pts_info(st, 33, 1, IDCIN_FPS); av_set_pts_info(st, 33, 1, IDCIN_FPS);

View File

@ -84,7 +84,7 @@ static int roq_read_header(AVFormatContext *s,
roq->audio_frame_count = 0; roq->audio_frame_count = 0;
roq->audio_stream_index = -1; roq->audio_stream_index = -1;
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
av_set_pts_info(st, 63, 1, framerate); av_set_pts_info(st, 63, 1, framerate);
@ -166,7 +166,7 @@ static int roq_read_packet(AVFormatContext *s,
case RoQ_SOUND_MONO: case RoQ_SOUND_MONO:
case RoQ_SOUND_STEREO: case RoQ_SOUND_STEREO:
if (roq->audio_stream_index == -1) { if (roq->audio_stream_index == -1) {
AVStream *st = av_new_stream(s, 1); AVStream *st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
av_set_pts_info(st, 32, 1, RoQ_AUDIO_SAMPLE_RATE); av_set_pts_info(st, 32, 1, RoQ_AUDIO_SAMPLE_RATE);

View File

@ -135,7 +135,7 @@ static int iff_read_header(AVFormatContext *s,
unsigned transparency = 0; unsigned transparency = 0;
unsigned masking = 0; // no mask unsigned masking = 0; // no mask
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);

View File

@ -220,7 +220,7 @@ static int read_header(AVFormatContext *s1, AVFormatParameters *ap)
s1->ctx_flags |= AVFMTCTX_NOHEADER; s1->ctx_flags |= AVFMTCTX_NOHEADER;
st = av_new_stream(s1, 0); st = avformat_new_stream(s1, NULL);
if (!st) { if (!st) {
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }

View File

@ -559,7 +559,7 @@ static int ipmovie_read_header(AVFormatContext *s,
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
/* initialize the stream decoders */ /* initialize the stream decoders */
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
av_set_pts_info(st, 63, 1, 1000000); av_set_pts_info(st, 63, 1, 1000000);
@ -572,7 +572,7 @@ static int ipmovie_read_header(AVFormatContext *s,
st->codec->bits_per_coded_sample = ipmovie->video_bpp; st->codec->bits_per_coded_sample = ipmovie->video_bpp;
if (ipmovie->audio_type) { if (ipmovie->audio_type) {
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
av_set_pts_info(st, 32, 1, ipmovie->audio_sample_rate); av_set_pts_info(st, 32, 1, ipmovie->audio_sample_rate);

View File

@ -88,7 +88,7 @@ static av_cold int iss_read_header(AVFormatContext *s, AVFormatParameters *ap)
iss->sample_start_pos = avio_tell(pb); iss->sample_start_pos = avio_tell(pb);
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_type = AVMEDIA_TYPE_AUDIO;

View File

@ -40,7 +40,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
{ {
AVStream *st; AVStream *st;
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);

View File

@ -40,7 +40,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
avio_rl16(s->pb); // version avio_rl16(s->pb); // version
avio_rl16(s->pb); // header size avio_rl16(s->pb); // header size
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);

View File

@ -69,8 +69,8 @@ static int read_header(AVFormatContext *s,
avio_skip(pb, 80); avio_skip(pb, 80);
ast = av_new_stream(s, 0); ast = avformat_new_stream(s, NULL);
vst = av_new_stream(s, 1); vst = avformat_new_stream(s, NULL);
if (!ast || !vst) if (!ast || !vst)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);

View File

@ -213,7 +213,7 @@ static int nut_read_header(AVFormatContext * avf, AVFormatParameters * ap) {
priv->s = s; priv->s = s;
for (i = 0; s[i].type != -1 && i < 2; i++) { for (i = 0; s[i].type != -1 && i < 2; i++) {
AVStream * st = av_new_stream(avf, i); AVStream * st = avformat_new_stream(avf, NULL);
int j; int j;
for (j = 0; j < s[i].fourcc_len && j < 8; j++) st->codec->codec_tag |= s[i].fourcc[j]<<(j*8); for (j = 0; j < s[i].fourcc_len && j < 8; j++) st->codec->codec_tag |= s[i].fourcc[j]<<(j*8);

View File

@ -60,14 +60,14 @@ static int lmlm4_probe(AVProbeData * pd) {
static int lmlm4_read_header(AVFormatContext *s, AVFormatParameters *ap) { static int lmlm4_read_header(AVFormatContext *s, AVFormatParameters *ap) {
AVStream *st; AVStream *st;
if (!(st = av_new_stream(s, 0))) if (!(st = avformat_new_stream(s, NULL)))
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_MPEG4; st->codec->codec_id = CODEC_ID_MPEG4;
st->need_parsing = AVSTREAM_PARSE_HEADERS; st->need_parsing = AVSTREAM_PARSE_HEADERS;
av_set_pts_info(st, 64, 1001, 30000); av_set_pts_info(st, 64, 1001, 30000);
if (!(st = av_new_stream(s, 1))) if (!(st = avformat_new_stream(s, NULL)))
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_MP2; st->codec->codec_id = CODEC_ID_MP2;

View File

@ -217,7 +217,7 @@ static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
if ((ret = avio_read(pb, header_data, LXF_HEADER_DATA_SIZE)) != LXF_HEADER_DATA_SIZE) if ((ret = avio_read(pb, header_data, LXF_HEADER_DATA_SIZE)) != LXF_HEADER_DATA_SIZE)
return ret < 0 ? ret : AVERROR_EOF; return ret < 0 ? ret : AVERROR_EOF;
if (!(st = av_new_stream(s, 0))) if (!(st = avformat_new_stream(s, NULL)))
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
st->duration = AV_RL32(&header_data[32]); st->duration = AV_RL32(&header_data[32]);
@ -243,7 +243,7 @@ static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
av_log(s, AV_LOG_WARNING, "VBI data not yet supported\n"); av_log(s, AV_LOG_WARNING, "VBI data not yet supported\n");
if ((lxf->channels = (disk_params >> 2) & 0xF)) { if ((lxf->channels = (disk_params >> 2) & 0xF)) {
if (!(st = av_new_stream(s, 1))) if (!(st = avformat_new_stream(s, NULL)))
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_type = AVMEDIA_TYPE_AUDIO;

View File

@ -1444,7 +1444,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
} }
} }
st = track->stream = av_new_stream(s, 0); st = track->stream = avformat_new_stream(s, NULL);
if (st == NULL) if (st == NULL)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
@ -1639,7 +1639,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
attachements[j].bin.data && attachements[j].bin.size > 0)) { attachements[j].bin.data && attachements[j].bin.size > 0)) {
av_log(matroska->ctx, AV_LOG_ERROR, "incomplete attachment\n"); av_log(matroska->ctx, AV_LOG_ERROR, "incomplete attachment\n");
} else { } else {
AVStream *st = av_new_stream(s, 0); AVStream *st = avformat_new_stream(s, NULL);
if (st == NULL) if (st == NULL)
break; break;
av_dict_set(&st->metadata, "filename",attachements[j].filename, 0); av_dict_set(&st->metadata, "filename",attachements[j].filename, 0);

View File

@ -105,7 +105,7 @@ static int read_header(AVFormatContext *s,
avio_skip(pb, length - 10); /* unknown data */ avio_skip(pb, length - 10); /* unknown data */
/* video stream */ /* video stream */
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
@ -117,7 +117,7 @@ static int read_header(AVFormatContext *s,
/* audio stream */ /* audio stream */
if (length == MM_HEADER_LEN_AV) { if (length == MM_HEADER_LEN_AV) {
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_type = AVMEDIA_TYPE_AUDIO;

View File

@ -241,7 +241,7 @@ static int mmf_read_header(AVFormatContext *s,
} }
mmf->data_size = size; mmf->data_size = size;
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);

View File

@ -1843,8 +1843,9 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom)
MOVStreamContext *sc; MOVStreamContext *sc;
int ret; int ret;
st = av_new_stream(c->fc, c->fc->nb_streams); st = avformat_new_stream(c->fc, NULL);
if (!st) return AVERROR(ENOMEM); if (!st) return AVERROR(ENOMEM);
st->id = c->fc->nb_streams;
sc = av_mallocz(sizeof(MOVStreamContext)); sc = av_mallocz(sizeof(MOVStreamContext));
if (!sc) return AVERROR(ENOMEM); if (!sc) return AVERROR(ENOMEM);

View File

@ -137,7 +137,7 @@ static int mp3_read_header(AVFormatContext *s,
AVStream *st; AVStream *st;
int64_t off; int64_t off;
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);

View File

@ -84,7 +84,7 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap)
c->curbits = 8; c->curbits = 8;
c->frames_noted = 0; c->frames_noted = 0;
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_type = AVMEDIA_TYPE_AUDIO;

View File

@ -222,7 +222,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap)
c->samples = ffio_read_varlen(pb); c->samples = ffio_read_varlen(pb);
ffio_read_varlen(pb); //silence samples at the beginning ffio_read_varlen(pb); //silence samples at the beginning
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_type = AVMEDIA_TYPE_AUDIO;

View File

@ -537,9 +537,10 @@ static int mpegps_read_packet(AVFormatContext *s,
goto redo; goto redo;
} }
/* no stream found: add a new stream */ /* no stream found: add a new stream */
st = av_new_stream(s, startcode); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
goto skip; goto skip;
st->id = startcode;
st->codec->codec_type = type; st->codec->codec_type = type;
st->codec->codec_id = codec_id; st->codec->codec_id = codec_id;
st->request_probe = request_probe; st->request_probe = request_probe;

View File

@ -620,12 +620,13 @@ static int mpegts_set_stream_info(AVStream *st, PESContext *pes,
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
memcpy(sub_pes, pes, sizeof(*sub_pes)); memcpy(sub_pes, pes, sizeof(*sub_pes));
sub_st = av_new_stream(pes->stream, pes->pid); sub_st = avformat_new_stream(pes->stream, NULL);
if (!sub_st) { if (!sub_st) {
av_free(sub_pes); av_free(sub_pes);
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }
sub_st->id = pes->pid;
av_set_pts_info(sub_st, 33, 1, 90000); av_set_pts_info(sub_st, 33, 1, 90000);
sub_st->priv_data = sub_pes; sub_st->priv_data = sub_pes;
sub_st->codec->codec_type = AVMEDIA_TYPE_AUDIO; sub_st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
@ -726,9 +727,10 @@ static int mpegts_push_data(MpegTSFilter *filter,
/* stream not present in PMT */ /* stream not present in PMT */
if (!pes->st) { if (!pes->st) {
pes->st = av_new_stream(ts->stream, pes->pid); pes->st = avformat_new_stream(ts->stream, NULL);
if (!pes->st) if (!pes->st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
pes->st->id = pes->pid;
mpegts_set_stream_info(pes->st, pes, 0, 0); mpegts_set_stream_info(pes->st, pes, 0, 0);
} }
@ -1120,14 +1122,18 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
/* now create ffmpeg stream */ /* now create ffmpeg stream */
if (ts->pids[pid] && ts->pids[pid]->type == MPEGTS_PES) { if (ts->pids[pid] && ts->pids[pid]->type == MPEGTS_PES) {
pes = ts->pids[pid]->u.pes_filter.opaque; pes = ts->pids[pid]->u.pes_filter.opaque;
if (!pes->st) if (!pes->st) {
pes->st = av_new_stream(pes->stream, pes->pid); pes->st = avformat_new_stream(pes->stream, NULL);
st->id = pes->pid;
}
st = pes->st; st = pes->st;
} else { } else {
if (ts->pids[pid]) mpegts_close_filter(ts, ts->pids[pid]); //wrongly added sdt filter probably if (ts->pids[pid]) mpegts_close_filter(ts, ts->pids[pid]); //wrongly added sdt filter probably
pes = add_pes_stream(ts, pid, pcr_pid); pes = add_pes_stream(ts, pid, pcr_pid);
if (pes) if (pes) {
st = av_new_stream(pes->stream, pes->pid); st = avformat_new_stream(pes->stream, NULL);
st->id = pes->pid;
}
} }
if (!st) if (!st)
@ -1594,7 +1600,7 @@ static int mpegts_read_header(AVFormatContext *s,
/* only read packets */ /* only read packets */
st = av_new_stream(s, 0); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
goto fail; goto fail;
av_set_pts_info(st, 60, 1, 27000000); av_set_pts_info(st, 60, 1, 27000000);

View File

@ -75,7 +75,7 @@ static int msnwc_tcp_read_header(AVFormatContext *ctx, AVFormatParameters *ap)
AVCodecContext *codec; AVCodecContext *codec;
AVStream *st; AVStream *st;
st = av_new_stream(ctx, 0); st = avformat_new_stream(ctx, NULL);
if(!st) if(!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);

View File

@ -32,8 +32,6 @@
#define MTV_HEADER_SIZE 512 #define MTV_HEADER_SIZE 512
#define MTV_AUDIO_PADDING_SIZE 12 #define MTV_AUDIO_PADDING_SIZE 12
#define AUDIO_SAMPLING_RATE 44100 #define AUDIO_SAMPLING_RATE 44100
#define VIDEO_SID 0
#define AUDIO_SID 1
typedef struct MTVDemuxContext { typedef struct MTVDemuxContext {
@ -118,7 +116,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap)
// video - raw rgb565 // video - raw rgb565
st = av_new_stream(s, VIDEO_SID); st = avformat_new_stream(s, NULL);
if(!st) if(!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
@ -134,7 +132,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap)
// audio - mp3 // audio - mp3
st = av_new_stream(s, AUDIO_SID); st = avformat_new_stream(s, NULL);
if(!st) if(!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
@ -171,7 +169,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt)
return ret; return ret;
pkt->pos -= MTV_AUDIO_PADDING_SIZE; pkt->pos -= MTV_AUDIO_PADDING_SIZE;
pkt->stream_index = AUDIO_SID; pkt->stream_index = 1;
}else }else
{ {
@ -190,7 +188,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt)
for(i=0;i<mtv->img_segment_size/2;i++) for(i=0;i<mtv->img_segment_size/2;i++)
*((uint16_t *)pkt->data+i) = av_bswap16(*((uint16_t *)pkt->data+i)); *((uint16_t *)pkt->data+i) = av_bswap16(*((uint16_t *)pkt->data+i));
#endif #endif
pkt->stream_index = VIDEO_SID; pkt->stream_index = 0;
} }
return ret; return ret;

View File

@ -42,11 +42,11 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
AVStream *ast, *vst; AVStream *ast, *vst;
unsigned int version, frames_count, msecs_per_frame, player_version; unsigned int version, frames_count, msecs_per_frame, player_version;
ast = av_new_stream(s, 0); ast = avformat_new_stream(s, NULL);
if (!ast) if (!ast)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
vst = av_new_stream(s, 0); vst = avformat_new_stream(s, NULL);
if (!vst) if (!vst)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);

View File

@ -852,11 +852,12 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
if (!source_track) if (!source_track)
continue; continue;
st = av_new_stream(mxf->fc, source_track->track_id); st = avformat_new_stream(mxf->fc, NULL);
if (!st) { if (!st) {
av_log(mxf->fc, AV_LOG_ERROR, "could not allocate stream\n"); av_log(mxf->fc, AV_LOG_ERROR, "could not allocate stream\n");
return -1; return -1;
} }
st->id = source_track->track_id;
st->priv_data = source_track; st->priv_data = source_track;
st->duration = component->duration; st->duration = component->duration;
if (st->duration == -1) if (st->duration == -1)

View File

@ -24,8 +24,6 @@
#include "avformat.h" #include "avformat.h"
#include "avio.h" #include "avio.h"
#define VIDEO_STREAM_INDEX 0
#define AUDIO_STREAM_INDEX 1
#define DEFAULT_PACKET_SIZE 1024 #define DEFAULT_PACKET_SIZE 1024
#define OVERREAD_SIZE 3 #define OVERREAD_SIZE 3
@ -44,14 +42,14 @@ static int mxg_read_header(AVFormatContext *s, AVFormatParameters *ap)
MXGContext *mxg = s->priv_data; MXGContext *mxg = s->priv_data;
/* video parameters will be extracted from the compressed bitstream */ /* video parameters will be extracted from the compressed bitstream */
video_st = av_new_stream(s, VIDEO_STREAM_INDEX); video_st = avformat_new_stream(s, NULL);
if (!video_st) if (!video_st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
video_st->codec->codec_type = AVMEDIA_TYPE_VIDEO; video_st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
video_st->codec->codec_id = CODEC_ID_MXPEG; video_st->codec->codec_id = CODEC_ID_MXPEG;
av_set_pts_info(video_st, 64, 1, 1000000); av_set_pts_info(video_st, 64, 1, 1000000);
audio_st = av_new_stream(s, AUDIO_STREAM_INDEX); audio_st = avformat_new_stream(s, NULL);
if (!audio_st) if (!audio_st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
audio_st->codec->codec_type = AVMEDIA_TYPE_AUDIO; audio_st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
@ -166,7 +164,7 @@ static int mxg_read_packet(AVFormatContext *s, AVPacket *pkt)
} }
pkt->pts = pkt->dts = mxg->dts; pkt->pts = pkt->dts = mxg->dts;
pkt->stream_index = VIDEO_STREAM_INDEX; pkt->stream_index = 0;
pkt->destruct = NULL; pkt->destruct = NULL;
pkt->size = mxg->buffer_ptr - mxg->soi_ptr; pkt->size = mxg->buffer_ptr - mxg->soi_ptr;
pkt->data = mxg->soi_ptr; pkt->data = mxg->soi_ptr;
@ -204,7 +202,7 @@ static int mxg_read_packet(AVFormatContext *s, AVPacket *pkt)
if (marker == APP13 && size >= 16) { /* audio data */ if (marker == APP13 && size >= 16) { /* audio data */
/* time (GMT) of first sample in usec since 1970, little-endian */ /* time (GMT) of first sample in usec since 1970, little-endian */
pkt->pts = pkt->dts = AV_RL64(startmarker_ptr + 8); pkt->pts = pkt->dts = AV_RL64(startmarker_ptr + 8);
pkt->stream_index = AUDIO_STREAM_INDEX; pkt->stream_index = 1;
pkt->destruct = NULL; pkt->destruct = NULL;
pkt->size = size - 14; pkt->size = size - 14;
pkt->data = startmarker_ptr + 16; pkt->data = startmarker_ptr + 16;

View File

@ -45,7 +45,7 @@ static int nc_probe(AVProbeData *probe_packet)
static int nc_read_header(AVFormatContext *s, AVFormatParameters *ap) static int nc_read_header(AVFormatContext *s, AVFormatParameters *ap)
{ {
AVStream *st = av_new_stream(s, 0); AVStream *st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);

View File

@ -438,10 +438,11 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap)
nsv->vheight = vwidth; nsv->vheight = vwidth;
if (vtag != T_NONE) { if (vtag != T_NONE) {
int i; int i;
st = av_new_stream(s, NSV_ST_VIDEO); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
goto fail; goto fail;
st->id = NSV_ST_VIDEO;
nst = av_mallocz(sizeof(NSVStream)); nst = av_mallocz(sizeof(NSVStream));
if (!nst) if (!nst)
goto fail; goto fail;
@ -469,10 +470,11 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap)
} }
if (atag != T_NONE) { if (atag != T_NONE) {
#ifndef DISABLE_AUDIO #ifndef DISABLE_AUDIO
st = av_new_stream(s, NSV_ST_AUDIO); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
goto fail; goto fail;
st->id = NSV_ST_AUDIO;
nst = av_mallocz(sizeof(NSVStream)); nst = av_mallocz(sizeof(NSVStream));
if (!nst) if (!nst)
goto fail; goto fail;

View File

@ -288,7 +288,7 @@ static int decode_main_header(NUTContext *nut){
nut->stream = av_mallocz(sizeof(StreamContext)*stream_count); nut->stream = av_mallocz(sizeof(StreamContext)*stream_count);
for(i=0; i<stream_count; i++){ for(i=0; i<stream_count; i++){
av_new_stream(s, i); avformat_new_stream(s, NULL);
} }
return 0; return 0;

View File

@ -153,7 +153,7 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) {
if (v_packs) { if (v_packs) {
ctx->v_id = stream_nr++; ctx->v_id = stream_nr++;
vst = av_new_stream(s, ctx->v_id); vst = avformat_new_stream(s, NULL);
if (!vst) if (!vst)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
@ -169,7 +169,7 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) {
if (a_packs) { if (a_packs) {
ctx->a_id = stream_nr++; ctx->a_id = stream_nr++;
ast = av_new_stream(s, ctx->a_id); ast = avformat_new_stream(s, NULL);
if (!ast) if (!ast)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;

View File

@ -171,10 +171,11 @@ static int ogg_new_stream(AVFormatContext *s, uint32_t serial, int new_avstream)
os->header = -1; os->header = -1;
if (new_avstream) { if (new_avstream) {
st = av_new_stream(s, idx); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
st->id = idx;
av_set_pts_info(st, 64, 1, 1000000); av_set_pts_info(st, 64, 1, 1000000);
} }

Some files were not shown because too many files have changed in this diff Show More