Commit 3b3bbdd3 authored by Anton Khirnov's avatar Anton Khirnov

lavf,lavd: replace av_new_stream->avformat_new_stream part I.

Trivial replacements with sed are done in this commit:
sed 's/av_new_stream(\([^)]*\), 0)/avformat_new_stream(\1, NULL)/'
parent 569129a6
......@@ -60,7 +60,7 @@ static av_cold int audio_read_header(AVFormatContext *s1,
enum CodecID codec_id;
snd_pcm_sw_params_t *sw_params;
st = av_new_stream(s1, 0);
st = avformat_new_stream(s1, NULL);
if (!st) {
av_log(s1, AV_LOG_ERROR, "Cannot add stream\n");
......
......@@ -271,7 +271,7 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
goto out;
}
st = av_new_stream(s1, 0);
st = avformat_new_stream(s1, NULL);
if (!st) {
ret = AVERROR(ENOMEM);
goto out;
......
......@@ -108,7 +108,7 @@ av_cold static int fbdev_read_header(AVFormatContext *avctx,
return ret;
}
if (!(st = av_new_stream(avctx, 0)))
if (!(st = avformat_new_stream(avctx, NULL)))
return AVERROR(ENOMEM);
av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in microseconds */
......
......@@ -229,7 +229,7 @@ static int audio_read_header(AVFormatContext *context, AVFormatParameters *param
if ((test = start_jack(context)))
return test;
stream = av_new_stream(context, 0);
stream = avformat_new_stream(context, NULL);
if (!stream) {
stop_jack(self);
return AVERROR(ENOMEM);
......
......@@ -53,7 +53,7 @@ static av_cold int read_header(AVFormatContext *ctx, AVFormatParameters *ap)
int ret, i;
char *err = NULL;
if (!(st = av_new_stream(ctx, 0)))
if (!(st = avformat_new_stream(ctx, NULL)))
return AVERROR(ENOMEM);
s->drive = cdio_cddap_identify(ctx->filename, CDDA_MESSAGE_LOGIT, &err);
if (!s->drive) {
......
......@@ -160,7 +160,7 @@ static inline int dc1394_read_common(AVFormatContext *c, AVFormatParameters *ap,
}
/* create a video stream */
vst = av_new_stream(c, 0);
vst = avformat_new_stream(c, NULL);
if (!vst) {
ret = AVERROR(ENOMEM);
goto out;
......
......@@ -209,7 +209,7 @@ static int audio_read_header(AVFormatContext *s1, AVFormatParameters *ap)
AVStream *st;
int ret;
st = av_new_stream(s1, 0);
st = avformat_new_stream(s1, NULL);
if (!st) {
return AVERROR(ENOMEM);
}
......
......@@ -34,7 +34,7 @@ static av_cold int audio_read_header(AVFormatContext *s1,
AVStream *st;
int ret;
st = av_new_stream(s1, 0);
st = avformat_new_stream(s1, NULL);
if (!st)
return AVERROR(ENOMEM);
......
......@@ -98,7 +98,7 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
s->video_win.width = ap->width;
s->video_win.height = ap->height;
st = av_new_stream(s1, 0);
st = avformat_new_stream(s1, NULL);
if (!st)
return AVERROR(ENOMEM);
av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
......
......@@ -580,7 +580,7 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap)
enum CodecID codec_id;
enum PixelFormat pix_fmt = PIX_FMT_NONE;
st = av_new_stream(s1, 0);
st = avformat_new_stream(s1, NULL);
if (!st) {
res = AVERROR(ENOMEM);
goto out;
......
......@@ -295,7 +295,7 @@ static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap)
SetWindowLongPtr(ctx->hwnd, GWLP_USERDATA, (LONG_PTR) s);
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if(!st) {
vfw_read_close(s);
return AVERROR(ENOMEM);
......
......@@ -193,7 +193,7 @@ x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
goto out;
}
st = av_new_stream(s1, 0);
st = avformat_new_stream(s1, NULL);
if (!st) {
ret = AVERROR(ENOMEM);
goto out;
......
......@@ -141,7 +141,7 @@ static int fourxm_read_header(AVFormatContext *s,
fourxm->height = AV_RL32(&header[i + 40]);
/* allocate a new AVStream */
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if (!st){
ret= AVERROR(ENOMEM);
goto fail;
......
......@@ -65,7 +65,7 @@ static int adts_aac_read_header(AVFormatContext *s,
{
AVStream *st;
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
......
......@@ -57,7 +57,7 @@ static int aea_read_probe(AVProbeData *p)
static int aea_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
AVStream *st = av_new_stream(s, 0);
AVStream *st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
......
......@@ -196,7 +196,7 @@ static int aiff_read_header(AVFormatContext *s,
filesize -= 4;
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
......
......@@ -84,7 +84,7 @@ static int amr_read_header(AVFormatContext *s,
avio_read(pb, header, 6);
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if (!st)
{
return AVERROR(ENOMEM);
......
......@@ -97,7 +97,7 @@ static int read_header(AVFormatContext *s,
return AVERROR_INVALIDDATA;
/* video stream */
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
......
......@@ -39,7 +39,7 @@ static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap)
avio_rl32(pb); /* _APC */
avio_rl32(pb); /* 1.20 */
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
......
......@@ -313,7 +313,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
ape->compressiontype);
/* now we are ready: build format streams */
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if (!st)
return -1;
......
......@@ -227,7 +227,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
pos1 = avio_tell(pb);
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
av_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */
......
......@@ -83,7 +83,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
uint8_t *p, **dst[2]={0};
int pos[2]={0};
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if (!st)
return -1;
av_set_pts_info(st, 64, 1, 100);
......
......@@ -151,7 +151,7 @@ static int au_read_header(AVFormatContext *s,
}
/* now we are ready: build format streams */
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if (!st)
return -1;
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
......
......@@ -70,7 +70,7 @@ static int vid_read_header(AVFormatContext *s,
avio_skip(pb, 5);
vid->nframes = avio_rl16(pb);
stream = av_new_stream(s, 0);
stream = avformat_new_stream(s, NULL);
if (!stream)
return AVERROR(ENOMEM);
av_set_pts_info(stream, 32, 1, 60); // 16 ms increments, i.e. 60 fps
......@@ -83,7 +83,7 @@ static int vid_read_header(AVFormatContext *s,
avio_rl16(pb);
// done with video codec, set up audio codec
stream = av_new_stream(s, 0);
stream = avformat_new_stream(s, NULL);
if (!stream)
return AVERROR(ENOMEM);
stream->codec->codec_type = AVMEDIA_TYPE_AUDIO;
......
......@@ -55,12 +55,12 @@ static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap)
int fps, chunk_header;
/* Initialize the video codec... */
vstream = av_new_stream(s, 0);
vstream = avformat_new_stream(s, NULL);
if (!vstream)
return AVERROR(ENOMEM);
/* Initialize the audio codec... */
astream = av_new_stream(s, 0);
astream = avformat_new_stream(s, NULL);
if (!astream)
return AVERROR(ENOMEM);
......
......@@ -78,7 +78,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
uint16_t flags;
int keyframe;
vst = av_new_stream(s, 0);
vst = avformat_new_stream(s, NULL);
if (!vst)
return AVERROR(ENOMEM);
......
......@@ -79,7 +79,7 @@ static int read_header(AVFormatContext *s,
/* Audio streams are added if audio packets are found */
s->ctx_flags |= AVFMTCTX_NOHEADER;
video = av_new_stream(s, 0);
video = avformat_new_stream(s, NULL);
if (!video)
return AVERROR(ENOMEM);
......
......@@ -61,7 +61,7 @@ static int read_desc_chunk(AVFormatContext *s)
int flags;
/* new audio stream */
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
......
......@@ -28,7 +28,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
AVStream *vst;
int ret;
vst = av_new_stream(s, 0);
vst = avformat_new_stream(s, NULL);
if (!vst)
return AVERROR(ENOMEM);
......
......@@ -21,7 +21,7 @@
#include "avformat.h"
static int daud_header(AVFormatContext *s, AVFormatParameters *ap) {
AVStream *st = av_new_stream(s, 0);
AVStream *st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
......
......@@ -45,7 +45,7 @@ static int dfa_read_header(AVFormatContext *s,
avio_skip(pb, 2); // unused
frames = avio_rl16(pb);
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
......
......@@ -107,7 +107,7 @@ static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap)
cin->audio_buffer_size = 0;
/* initialize the video decoder stream */
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
......@@ -120,7 +120,7 @@ static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->height = hdr->video_frame_height;
/* initialize the audio decoder stream */
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
......
......@@ -211,7 +211,7 @@ static int dv_extract_audio_info(DVDemuxContext* c, uint8_t* frame)
/* Dynamic handling of the audio streams in DV */
for (i = 0; i < ach; i++) {
if (!c->ast[i]) {
c->ast[i] = av_new_stream(c->fctx, 0);
c->ast[i] = avformat_new_stream(c->fctx, NULL);
if (!c->ast[i])
break;
av_set_pts_info(c->ast[i], 64, 1, 30000);
......@@ -278,7 +278,7 @@ DVDemuxContext* dv_init_demux(AVFormatContext *s)
if (!c)
return NULL;
c->vst = av_new_stream(s, 0);
c->vst = avformat_new_stream(s, NULL);
if (!c->vst) {
av_free(c);
return NULL;
......
......@@ -87,7 +87,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap)
h = avio_rb16(pb);
c->has_sound = 0;
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if (!st)
return -1;
......@@ -100,7 +100,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap)
avio_skip(pb, 16);
fsize = avio_rl32(pb);
ast = av_new_stream(s, 0);
ast = avformat_new_stream(s, NULL);
if (!ast)
return -1;
ret = ff_get_wav_header(pb, ast->codec, fsize);
......
......@@ -64,7 +64,7 @@ static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap)
sample_rate = avio_rb16(pb);
avio_skip(pb, 12);
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
......
......@@ -410,7 +410,7 @@ static int ea_read_header(AVFormatContext *s,
if (ea->video_codec) {
/* initialize the video decoder stream */
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
ea->video_stream_index = st->index;
......@@ -435,7 +435,7 @@ static int ea_read_header(AVFormatContext *s,
}
/* initialize the audio decoder stream */
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
av_set_pts_info(st, 33, 1, ea->sample_rate);
......
......@@ -290,7 +290,7 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
for(i=0;i<nb_streams;i++) {
char rc_eq_buf[128];
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if (!st)
goto fail;
......
......@@ -132,7 +132,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
get_line(s->pb, line, sizeof(line));
if (!memcmp(line, ID_STREAM, strlen(ID_STREAM))) {
AVStream *st = av_new_stream(s, 0);
AVStream *st = avformat_new_stream(s, NULL);
if (!st)
return -1;
......
......@@ -49,7 +49,7 @@ static int read_header(AVFormatContext *s,
return AVERROR_INVALIDDATA;
}
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
......
......@@ -31,7 +31,7 @@ static int flac_read_header(AVFormatContext *s,
int ret, metadata_last=0, metadata_type, metadata_size, found_streaminfo=0;
uint8_t header[4];
uint8_t *buffer=NULL;
AVStream *st = av_new_stream(s, 0);
AVStream *st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
......
......@@ -105,7 +105,7 @@ static int flic_read_header(AVFormatContext *s,
speed = FLIC_DEFAULT_SPEED;
/* initialize the decoder streams */
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
flic->video_stream_index = st->index;
......
......@@ -153,7 +153,7 @@ static int idcin_read_header(AVFormatContext *s,
bytes_per_sample = avio_rl32(pb);
channels = avio_rl32(pb);
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
av_set_pts_info(st, 33, 1, IDCIN_FPS);
......@@ -174,7 +174,7 @@ static int idcin_read_header(AVFormatContext *s,
/* if sample rate is 0, assume no audio */
if (sample_rate) {
idcin->audio_present = 1;
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
av_set_pts_info(st, 33, 1, IDCIN_FPS);
......
......@@ -84,7 +84,7 @@ static int roq_read_header(AVFormatContext *s,
roq->audio_frame_count = 0;
roq->audio_stream_index = -1;
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
av_set_pts_info(st, 63, 1, framerate);
......
......@@ -115,7 +115,7 @@ static int iff_read_header(AVFormatContext *s,
uint32_t chunk_id, data_size;
int compression = -1;
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
......
......@@ -216,7 +216,7 @@ static int read_header(AVFormatContext *s1, AVFormatParameters *ap)
s1->ctx_flags |= AVFMTCTX_NOHEADER;
st = av_new_stream(s1, 0);
st = avformat_new_stream(s1, NULL);
if (!st) {
return AVERROR(ENOMEM);
}
......
......@@ -559,7 +559,7 @@ static int ipmovie_read_header(AVFormatContext *s,
return AVERROR_INVALIDDATA;
/* initialize the stream decoders */
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
av_set_pts_info(st, 63, 1, 1000000);
......@@ -572,7 +572,7 @@ static int ipmovie_read_header(AVFormatContext *s,
st->codec->bits_per_coded_sample = ipmovie->video_bpp;
if (ipmovie->audio_type) {
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
av_set_pts_info(st, 32, 1, ipmovie->audio_sample_rate);
......
......@@ -88,7 +88,7 @@ static av_cold int iss_read_header(AVFormatContext *s, AVFormatParameters *ap)
iss->sample_start_pos = avio_tell(pb);
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
......
......@@ -40,7 +40,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
{
AVStream *st;
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
......
......@@ -40,7 +40,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
avio_rl16(s->pb); // version
avio_rl16(s->pb); // header size
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
......
......@@ -69,7 +69,7 @@ static int read_header(AVFormatContext *s,
avio_skip(pb, 80);
ast = av_new_stream(s, 0);
ast = avformat_new_stream(s, NULL);
vst = av_new_stream(s, 1);
if (!ast || !vst)
return AVERROR(ENOMEM);
......
......@@ -60,7 +60,7 @@ static int lmlm4_probe(AVProbeData * pd) {
static int lmlm4_read_header(AVFormatContext *s, AVFormatParameters *ap) {
AVStream *st;
if (!(st = av_new_stream(s, 0)))
if (!(st = avformat_new_stream(s, NULL)))
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_MPEG4;
......
......@@ -217,7 +217,7 @@ static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
if ((ret = avio_read(pb, header_data, LXF_HEADER_DATA_SIZE)) != LXF_HEADER_DATA_SIZE)
return ret < 0 ? ret : AVERROR_EOF;
if (!(st = av_new_stream(s, 0)))
if (!(st = avformat_new_stream(s, NULL)))
return AVERROR(ENOMEM);
st->duration = AV_RL32(&header_data[32]);
......
......@@ -1396,7 +1396,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
}
}
st = track->stream = av_new_stream(s, 0);
st = track->stream = avformat_new_stream(s, NULL);
if (st == NULL)
return AVERROR(ENOMEM);
......@@ -1570,7 +1570,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
attachements[j].bin.data && attachements[j].bin.size > 0)) {
av_log(matroska->ctx, AV_LOG_ERROR, "incomplete attachment\n");
} else {
AVStream *st = av_new_stream(s, 0);
AVStream *st = avformat_new_stream(s, NULL);
if (st == NULL)
break;
av_dict_set(&st->metadata, "filename",attachements[j].filename, 0);
......
......@@ -105,7 +105,7 @@ static int read_header(AVFormatContext *s,
avio_skip(pb, length - 10); /* unknown data */
/* video stream */
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
......@@ -117,7 +117,7 @@ static int read_header(AVFormatContext *s,
/* audio stream */
if (length == MM_HEADER_LEN_AV) {
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
......
......@@ -241,7 +241,7 @@ static int mmf_read_header(AVFormatContext *s,
}
mmf->data_size = size;
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
......
......@@ -137,7 +137,7 @@ static int mp3_read_header(AVFormatContext *s,
AVStream *st;
int64_t off;
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
......
......@@ -84,7 +84,7 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap)
c->curbits = 8;
c->frames_noted = 0;
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
......
......@@ -222,7 +222,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap)
c->samples = ffio_read_varlen(pb);
ffio_read_varlen(pb); //silence samples at the beginning
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
......
......@@ -1550,7 +1550,7 @@ static int mpegts_read_header(AVFormatContext *s,
/* only read packets */
st = av_new_stream(s, 0);
st = avformat_new_stream(s, NULL);
if (!st)
goto fail;
av_set_pts_info(st, 60, 1, 27000000);
......
......@@ -75,7 +75,7 @@ static int msnwc_tcp_read_header(AVFormatContext *ctx, AVFormatParameters *ap)
AVCodecContext *codec;
AVStream *st;
st = av_new_stream(ctx, 0);
st = avformat_new_stream(ctx, NULL);
if(!st)
return AVERROR(ENOMEM);
......
......@@ -42,11 +42,11 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
AVStream *ast, *vst;
unsigned int version, frames_count, msecs_per_frame, player_version;
ast = av_new_stream(s, 0);
ast = avformat_new_stream(s, NULL);
if (!ast)
return AVERROR(ENOMEM);
vst = av_new_stream(