mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-21 10:55:51 +02:00
lavf: replace av_new_stream->avformat_new_stream part II.
Manual replacements are done in this commit. In many cases, the id is some constant made up number (e.g. 0 for video and 1 for audio), which is then not used in the demuxer for anything. Those ids are removed.
This commit is contained in:
parent
3b3bbdd3e6
commit
84ad31ff18
5
avconv.c
5
avconv.c
@ -3016,7 +3016,7 @@ static int get_preset_file_2(const char *preset_name, const char *codec_name, AV
|
||||
static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type)
|
||||
{
|
||||
OutputStream *ost;
|
||||
AVStream *st = av_new_stream(oc, oc->nb_streams < o->nb_streamid_map ? o->streamid_map[oc->nb_streams] : 0);
|
||||
AVStream *st = avformat_new_stream(oc, NULL);
|
||||
int idx = oc->nb_streams - 1, ret = 0;
|
||||
int64_t max_frames = INT64_MAX;
|
||||
char *bsf = NULL, *next, *codec_tag = NULL;
|
||||
@ -3030,6 +3030,9 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
|
||||
exit_program(1);
|
||||
}
|
||||
|
||||
if (oc->nb_streams - 1 < o->nb_streamid_map)
|
||||
st->id = o->streamid_map[oc->nb_streams - 1];
|
||||
|
||||
output_streams = grow_array(output_streams, sizeof(*output_streams), &nb_output_streams,
|
||||
nb_output_streams + 1);
|
||||
ost = &output_streams[nb_output_streams - 1];
|
||||
|
@ -198,12 +198,13 @@ static int fourxm_read_header(AVFormatContext *s,
|
||||
i += 8 + size;
|
||||
|
||||
/* allocate a new AVStream */
|
||||
st = av_new_stream(s, current_track);
|
||||
st = avformat_new_stream(s, NULL);
|
||||
if (!st){
|
||||
ret= AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
st->id = current_track;
|
||||
av_set_pts_info(st, 60, 1, fourxm->tracks[current_track].sample_rate);
|
||||
|
||||
fourxm->tracks[current_track].stream_index = st->index;
|
||||
|
@ -505,11 +505,12 @@ static int applehttp_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
snprintf(bitrate_str, sizeof(bitrate_str), "%d", v->bandwidth);
|
||||
/* Create new AVStreams for each stream in this variant */
|
||||
for (j = 0; j < v->ctx->nb_streams; j++) {
|
||||
AVStream *st = av_new_stream(s, i);
|
||||
AVStream *st = avformat_new_stream(s, NULL);
|
||||
if (!st) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
st->id = i;
|
||||
avcodec_copy_context(st->codec, v->ctx->streams[j]->codec);
|
||||
if (v->bandwidth)
|
||||
av_dict_set(&st->metadata, "variant_bitrate", bitrate_str,
|
||||
|
@ -426,10 +426,11 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
break;
|
||||
}else{
|
||||
stream_index++;
|
||||
st = av_new_stream(s, stream_index);
|
||||
st = avformat_new_stream(s, NULL);
|
||||
if (!st)
|
||||
goto fail;
|
||||
|
||||
st->id = stream_index;
|
||||
ast = av_mallocz(sizeof(AVIStream));
|
||||
if (!ast)
|
||||
goto fail;
|
||||
|
@ -84,7 +84,8 @@ static int avisynth_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
if (AVIStreamReadFormat(stream->handle, 0, &wvfmt, &struct_size) != S_OK)
|
||||
continue;
|
||||
|
||||
st = av_new_stream(s, id);
|
||||
st = avformat_new_stream(s, NULL);
|
||||
st->id = id;
|
||||
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
|
||||
|
||||
st->codec->block_align = wvfmt.nBlockAlign;
|
||||
@ -110,7 +111,8 @@ static int avisynth_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
if (AVIStreamReadFormat(stream->handle, 0, &imgfmt, &struct_size) != S_OK)
|
||||
continue;
|
||||
|
||||
st = av_new_stream(s, id);
|
||||
st = avformat_new_stream(s, NULL);
|
||||
st->id = id;
|
||||
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
|
||||
st->r_frame_rate.num = stream->info.dwRate;
|
||||
st->r_frame_rate.den = stream->info.dwScale;
|
||||
|
@ -179,7 +179,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt)
|
||||
|
||||
case AVS_VIDEO:
|
||||
if (!avs->st_video) {
|
||||
avs->st_video = av_new_stream(s, AVS_VIDEO);
|
||||
avs->st_video = avformat_new_stream(s, NULL);
|
||||
if (avs->st_video == NULL)
|
||||
return AVERROR(ENOMEM);
|
||||
avs->st_video->codec->codec_type = AVMEDIA_TYPE_VIDEO;
|
||||
@ -196,7 +196,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt)
|
||||
|
||||
case AVS_AUDIO:
|
||||
if (!avs->st_audio) {
|
||||
avs->st_audio = av_new_stream(s, AVS_AUDIO);
|
||||
avs->st_audio = avformat_new_stream(s, NULL);
|
||||
if (avs->st_audio == NULL)
|
||||
return AVERROR(ENOMEM);
|
||||
avs->st_audio->codec->codec_type = AVMEDIA_TYPE_AUDIO;
|
||||
|
@ -130,7 +130,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
avio_skip(pb, 4 * bink->num_audio_tracks);
|
||||
|
||||
for (i = 0; i < bink->num_audio_tracks; i++) {
|
||||
ast = av_new_stream(s, 1);
|
||||
ast = avformat_new_stream(s, NULL);
|
||||
if (!ast)
|
||||
return AVERROR(ENOMEM);
|
||||
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
|
||||
|
@ -117,7 +117,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
datasize = avio_rl16(pb);
|
||||
if (datasize > 42) {
|
||||
if (!c93->audio) {
|
||||
c93->audio = av_new_stream(s, 1);
|
||||
c93->audio = avformat_new_stream(s, NULL);
|
||||
if (!c93->audio)
|
||||
return AVERROR(ENOMEM);
|
||||
c93->audio->codec->codec_type = AVMEDIA_TYPE_AUDIO;
|
||||
|
@ -145,7 +145,7 @@ static int flic_read_header(AVFormatContext *s,
|
||||
*/
|
||||
if (AV_RL16(&preamble[4]) == FLIC_TFTD_CHUNK_AUDIO) {
|
||||
/* TFTD videos have an extra 22050 Hz 8-bit mono audio stream */
|
||||
ast = av_new_stream(s, 1);
|
||||
ast = avformat_new_stream(s, NULL);
|
||||
if (!ast)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
|
@ -354,9 +354,10 @@ static int flv_read_metabody(AVFormatContext *s, int64_t next_pos) {
|
||||
}
|
||||
|
||||
static AVStream *create_stream(AVFormatContext *s, int is_audio){
|
||||
AVStream *st = av_new_stream(s, is_audio);
|
||||
AVStream *st = avformat_new_stream(s, NULL);
|
||||
if (!st)
|
||||
return NULL;
|
||||
st->id = is_audio;
|
||||
st->codec->codec_type = is_audio ? AVMEDIA_TYPE_AUDIO : AVMEDIA_TYPE_VIDEO;
|
||||
av_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */
|
||||
return st;
|
||||
|
@ -81,9 +81,10 @@ static int get_sindex(AVFormatContext *s, int id, int format) {
|
||||
i = ff_find_stream_index(s, id);
|
||||
if (i >= 0)
|
||||
return i;
|
||||
st = av_new_stream(s, id);
|
||||
st = avformat_new_stream(s, NULL);
|
||||
if (!st)
|
||||
return AVERROR(ENOMEM);
|
||||
st->id = id;
|
||||
switch (format) {
|
||||
case 3:
|
||||
case 4:
|
||||
|
@ -166,7 +166,7 @@ static int roq_read_packet(AVFormatContext *s,
|
||||
case RoQ_SOUND_MONO:
|
||||
case RoQ_SOUND_STEREO:
|
||||
if (roq->audio_stream_index == -1) {
|
||||
AVStream *st = av_new_stream(s, 1);
|
||||
AVStream *st = avformat_new_stream(s, NULL);
|
||||
if (!st)
|
||||
return AVERROR(ENOMEM);
|
||||
av_set_pts_info(st, 32, 1, RoQ_AUDIO_SAMPLE_RATE);
|
||||
|
@ -70,7 +70,7 @@ static int read_header(AVFormatContext *s,
|
||||
avio_skip(pb, 80);
|
||||
|
||||
ast = avformat_new_stream(s, NULL);
|
||||
vst = av_new_stream(s, 1);
|
||||
vst = avformat_new_stream(s, NULL);
|
||||
if (!ast || !vst)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
|
@ -213,7 +213,7 @@ static int nut_read_header(AVFormatContext * avf, AVFormatParameters * ap) {
|
||||
priv->s = s;
|
||||
|
||||
for (i = 0; s[i].type != -1 && i < 2; i++) {
|
||||
AVStream * st = av_new_stream(avf, i);
|
||||
AVStream * st = avformat_new_stream(avf, NULL);
|
||||
int j;
|
||||
|
||||
for (j = 0; j < s[i].fourcc_len && j < 8; j++) st->codec->codec_tag |= s[i].fourcc[j]<<(j*8);
|
||||
|
@ -67,7 +67,7 @@ static int lmlm4_read_header(AVFormatContext *s, AVFormatParameters *ap) {
|
||||
st->need_parsing = AVSTREAM_PARSE_HEADERS;
|
||||
av_set_pts_info(st, 64, 1001, 30000);
|
||||
|
||||
if (!(st = av_new_stream(s, 1)))
|
||||
if (!(st = avformat_new_stream(s, NULL)))
|
||||
return AVERROR(ENOMEM);
|
||||
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
|
||||
st->codec->codec_id = CODEC_ID_MP2;
|
||||
|
@ -243,7 +243,7 @@ static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
av_log(s, AV_LOG_WARNING, "VBI data not yet supported\n");
|
||||
|
||||
if ((lxf->channels = (disk_params >> 2) & 0xF)) {
|
||||
if (!(st = av_new_stream(s, 1)))
|
||||
if (!(st = avformat_new_stream(s, NULL)))
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
|
||||
|
@ -1793,8 +1793,9 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
MOVStreamContext *sc;
|
||||
int ret;
|
||||
|
||||
st = av_new_stream(c->fc, c->fc->nb_streams);
|
||||
st = avformat_new_stream(c->fc, NULL);
|
||||
if (!st) return AVERROR(ENOMEM);
|
||||
st->id = c->fc->nb_streams;
|
||||
sc = av_mallocz(sizeof(MOVStreamContext));
|
||||
if (!sc) return AVERROR(ENOMEM);
|
||||
|
||||
|
@ -532,9 +532,10 @@ static int mpegps_read_packet(AVFormatContext *s,
|
||||
goto redo;
|
||||
}
|
||||
/* no stream found: add a new stream */
|
||||
st = av_new_stream(s, startcode);
|
||||
st = avformat_new_stream(s, NULL);
|
||||
if (!st)
|
||||
goto skip;
|
||||
st->id = startcode;
|
||||
st->codec->codec_type = type;
|
||||
st->codec->codec_id = codec_id;
|
||||
if (codec_id != CODEC_ID_PCM_S16BE)
|
||||
|
@ -598,12 +598,13 @@ static int mpegts_set_stream_info(AVStream *st, PESContext *pes,
|
||||
return AVERROR(ENOMEM);
|
||||
memcpy(sub_pes, pes, sizeof(*sub_pes));
|
||||
|
||||
sub_st = av_new_stream(pes->stream, pes->pid);
|
||||
sub_st = avformat_new_stream(pes->stream, NULL);
|
||||
if (!sub_st) {
|
||||
av_free(sub_pes);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
sub_st->id = pes->pid;
|
||||
av_set_pts_info(sub_st, 33, 1, 90000);
|
||||
sub_st->priv_data = sub_pes;
|
||||
sub_st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
|
||||
@ -700,9 +701,10 @@ static int mpegts_push_data(MpegTSFilter *filter,
|
||||
|
||||
/* stream not present in PMT */
|
||||
if (!pes->st) {
|
||||
pes->st = av_new_stream(ts->stream, pes->pid);
|
||||
pes->st = avformat_new_stream(ts->stream, NULL);
|
||||
if (!pes->st)
|
||||
return AVERROR(ENOMEM);
|
||||
pes->st->id = pes->pid;
|
||||
mpegts_set_stream_info(pes->st, pes, 0, 0);
|
||||
}
|
||||
|
||||
@ -1090,14 +1092,18 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
|
||||
/* now create ffmpeg stream */
|
||||
if (ts->pids[pid] && ts->pids[pid]->type == MPEGTS_PES) {
|
||||
pes = ts->pids[pid]->u.pes_filter.opaque;
|
||||
if (!pes->st)
|
||||
pes->st = av_new_stream(pes->stream, pes->pid);
|
||||
if (!pes->st) {
|
||||
pes->st = avformat_new_stream(pes->stream, NULL);
|
||||
st->id = pes->pid;
|
||||
}
|
||||
st = pes->st;
|
||||
} else {
|
||||
if (ts->pids[pid]) mpegts_close_filter(ts, ts->pids[pid]); //wrongly added sdt filter probably
|
||||
pes = add_pes_stream(ts, pid, pcr_pid);
|
||||
if (pes)
|
||||
st = av_new_stream(pes->stream, pes->pid);
|
||||
if (pes) {
|
||||
st = avformat_new_stream(pes->stream, NULL);
|
||||
st->id = pes->pid;
|
||||
}
|
||||
}
|
||||
|
||||
if (!st)
|
||||
|
@ -32,8 +32,6 @@
|
||||
#define MTV_HEADER_SIZE 512
|
||||
#define MTV_AUDIO_PADDING_SIZE 12
|
||||
#define AUDIO_SAMPLING_RATE 44100
|
||||
#define VIDEO_SID 0
|
||||
#define AUDIO_SID 1
|
||||
|
||||
typedef struct MTVDemuxContext {
|
||||
|
||||
@ -118,7 +116,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
|
||||
// video - raw rgb565
|
||||
|
||||
st = av_new_stream(s, VIDEO_SID);
|
||||
st = avformat_new_stream(s, NULL);
|
||||
if(!st)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
@ -134,7 +132,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
|
||||
// audio - mp3
|
||||
|
||||
st = av_new_stream(s, AUDIO_SID);
|
||||
st = avformat_new_stream(s, NULL);
|
||||
if(!st)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
@ -171,7 +169,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
return ret;
|
||||
|
||||
pkt->pos -= MTV_AUDIO_PADDING_SIZE;
|
||||
pkt->stream_index = AUDIO_SID;
|
||||
pkt->stream_index = 1;
|
||||
|
||||
}else
|
||||
{
|
||||
@ -190,7 +188,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
for(i=0;i<mtv->img_segment_size/2;i++)
|
||||
*((uint16_t *)pkt->data+i) = av_bswap16(*((uint16_t *)pkt->data+i));
|
||||
#endif
|
||||
pkt->stream_index = VIDEO_SID;
|
||||
pkt->stream_index = 0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -746,11 +746,12 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
|
||||
if (!source_track)
|
||||
continue;
|
||||
|
||||
st = av_new_stream(mxf->fc, source_track->track_id);
|
||||
st = avformat_new_stream(mxf->fc, NULL);
|
||||
if (!st) {
|
||||
av_log(mxf->fc, AV_LOG_ERROR, "could not allocate stream\n");
|
||||
return -1;
|
||||
}
|
||||
st->id = source_track->track_id;
|
||||
st->priv_data = source_track;
|
||||
st->duration = component->duration;
|
||||
if (st->duration == -1)
|
||||
|
@ -24,8 +24,6 @@
|
||||
#include "avformat.h"
|
||||
#include "avio.h"
|
||||
|
||||
#define VIDEO_STREAM_INDEX 0
|
||||
#define AUDIO_STREAM_INDEX 1
|
||||
#define DEFAULT_PACKET_SIZE 1024
|
||||
#define OVERREAD_SIZE 3
|
||||
|
||||
@ -44,14 +42,14 @@ static int mxg_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
MXGContext *mxg = s->priv_data;
|
||||
|
||||
/* video parameters will be extracted from the compressed bitstream */
|
||||
video_st = av_new_stream(s, VIDEO_STREAM_INDEX);
|
||||
video_st = avformat_new_stream(s, NULL);
|
||||
if (!video_st)
|
||||
return AVERROR(ENOMEM);
|
||||
video_st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
|
||||
video_st->codec->codec_id = CODEC_ID_MXPEG;
|
||||
av_set_pts_info(video_st, 64, 1, 1000000);
|
||||
|
||||
audio_st = av_new_stream(s, AUDIO_STREAM_INDEX);
|
||||
audio_st = avformat_new_stream(s, NULL);
|
||||
if (!audio_st)
|
||||
return AVERROR(ENOMEM);
|
||||
audio_st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
|
||||
@ -166,7 +164,7 @@ static int mxg_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
}
|
||||
|
||||
pkt->pts = pkt->dts = mxg->dts;
|
||||
pkt->stream_index = VIDEO_STREAM_INDEX;
|
||||
pkt->stream_index = 0;
|
||||
pkt->destruct = NULL;
|
||||
pkt->size = mxg->buffer_ptr - mxg->soi_ptr;
|
||||
pkt->data = mxg->soi_ptr;
|
||||
@ -204,7 +202,7 @@ static int mxg_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
if (marker == APP13 && size >= 16) { /* audio data */
|
||||
/* time (GMT) of first sample in usec since 1970, little-endian */
|
||||
pkt->pts = pkt->dts = AV_RL64(startmarker_ptr + 8);
|
||||
pkt->stream_index = AUDIO_STREAM_INDEX;
|
||||
pkt->stream_index = 1;
|
||||
pkt->destruct = NULL;
|
||||
pkt->size = size - 14;
|
||||
pkt->data = startmarker_ptr + 16;
|
||||
|
@ -437,10 +437,11 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
nsv->vheight = vwidth;
|
||||
if (vtag != T_NONE) {
|
||||
int i;
|
||||
st = av_new_stream(s, NSV_ST_VIDEO);
|
||||
st = avformat_new_stream(s, NULL);
|
||||
if (!st)
|
||||
goto fail;
|
||||
|
||||
st->id = NSV_ST_VIDEO;
|
||||
nst = av_mallocz(sizeof(NSVStream));
|
||||
if (!nst)
|
||||
goto fail;
|
||||
@ -468,10 +469,11 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
}
|
||||
if (atag != T_NONE) {
|
||||
#ifndef DISABLE_AUDIO
|
||||
st = av_new_stream(s, NSV_ST_AUDIO);
|
||||
st = avformat_new_stream(s, NULL);
|
||||
if (!st)
|
||||
goto fail;
|
||||
|
||||
st->id = NSV_ST_AUDIO;
|
||||
nst = av_mallocz(sizeof(NSVStream));
|
||||
if (!nst)
|
||||
goto fail;
|
||||
|
@ -288,7 +288,7 @@ static int decode_main_header(NUTContext *nut){
|
||||
|
||||
nut->stream = av_mallocz(sizeof(StreamContext)*stream_count);
|
||||
for(i=0; i<stream_count; i++){
|
||||
av_new_stream(s, i);
|
||||
avformat_new_stream(s, NULL);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -153,7 +153,7 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) {
|
||||
|
||||
if (v_packs) {
|
||||
ctx->v_id = stream_nr++;
|
||||
vst = av_new_stream(s, ctx->v_id);
|
||||
vst = avformat_new_stream(s, NULL);
|
||||
if (!vst)
|
||||
return AVERROR(ENOMEM);
|
||||
vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
|
||||
@ -169,7 +169,7 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) {
|
||||
|
||||
if (a_packs) {
|
||||
ctx->a_id = stream_nr++;
|
||||
ast = av_new_stream(s, ctx->a_id);
|
||||
ast = avformat_new_stream(s, NULL);
|
||||
if (!ast)
|
||||
return AVERROR(ENOMEM);
|
||||
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
|
||||
|
@ -172,10 +172,11 @@ static int ogg_new_stream(AVFormatContext *s, uint32_t serial, int new_avstream)
|
||||
os->header = -1;
|
||||
|
||||
if (new_avstream) {
|
||||
st = av_new_stream(s, idx);
|
||||
st = avformat_new_stream(s, NULL);
|
||||
if (!st)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
st->id = idx;
|
||||
av_set_pts_info(st, 64, 1, 1000000);
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ static int pva_read_header(AVFormatContext *s, AVFormatParameters *ap) {
|
||||
av_set_pts_info(st, 32, 1, 90000);
|
||||
av_add_index_entry(st, 0, 0, 0, 0, AVINDEX_KEYFRAME);
|
||||
|
||||
if (!(st = av_new_stream(s, 1)))
|
||||
if (!(st = avformat_new_stream(s, NULL)))
|
||||
return AVERROR(ENOMEM);
|
||||
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
|
||||
st->codec->codec_id = CODEC_ID_MP2;
|
||||
|
@ -89,7 +89,7 @@ static int r3d_read_red1(AVFormatContext *s)
|
||||
tmp = avio_r8(s->pb); // audio channels
|
||||
av_dlog(s, "audio channels %d\n", tmp);
|
||||
if (tmp > 0) {
|
||||
AVStream *ast = av_new_stream(s, 1);
|
||||
AVStream *ast = avformat_new_stream(s, NULL);
|
||||
if (!ast)
|
||||
return AVERROR(ENOMEM);
|
||||
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
|
||||
|
@ -459,8 +459,9 @@ add_dstream(AVFormatContext *s, AVStream *orig_st)
|
||||
{
|
||||
AVStream *st;
|
||||
|
||||
if (!(st = av_new_stream(s, orig_st->id)))
|
||||
if (!(st = avformat_new_stream(s, NULL)))
|
||||
return NULL;
|
||||
st->id = orig_st->id;
|
||||
st->codec->codec_type = orig_st->codec->codec_type;
|
||||
st->first_dts = orig_st->first_dts;
|
||||
|
||||
|
@ -357,9 +357,10 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
|
||||
if (!strcmp(ff_rtp_enc_name(rtsp_st->sdp_payload_type), "MP2T")) {
|
||||
/* no corresponding stream */
|
||||
} else {
|
||||
st = av_new_stream(s, rt->nb_rtsp_streams - 1);
|
||||
st = avformat_new_stream(s, NULL);
|
||||
if (!st)
|
||||
return;
|
||||
st->id = rt->nb_rtsp_streams - 1;
|
||||
rtsp_st->stream_index = st->index;
|
||||
st->codec->codec_type = codec_type;
|
||||
if (rtsp_st->sdp_payload_type < RTP_PT_PRIVATE) {
|
||||
|
@ -163,11 +163,12 @@ static int sap_read_header(AVFormatContext *s,
|
||||
if (sap->sdp_ctx->ctx_flags & AVFMTCTX_NOHEADER)
|
||||
s->ctx_flags |= AVFMTCTX_NOHEADER;
|
||||
for (i = 0; i < sap->sdp_ctx->nb_streams; i++) {
|
||||
AVStream *st = av_new_stream(s, i);
|
||||
AVStream *st = avformat_new_stream(s, NULL);
|
||||
if (!st) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
st->id = i;
|
||||
avcodec_copy_context(st->codec, sap->sdp_ctx->streams[i]->codec);
|
||||
st->time_base = sap->sdp_ctx->streams[i]->time_base;
|
||||
}
|
||||
@ -211,11 +212,12 @@ static int sap_fetch_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
if (s->ctx_flags & AVFMTCTX_NOHEADER) {
|
||||
while (sap->sdp_ctx->nb_streams > s->nb_streams) {
|
||||
int i = s->nb_streams;
|
||||
AVStream *st = av_new_stream(s, i);
|
||||
AVStream *st = avformat_new_stream(s, NULL);
|
||||
if (!st) {
|
||||
av_free_packet(pkt);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
st->id = i;
|
||||
avcodec_copy_context(st->codec, sap->sdp_ctx->streams[i]->codec);
|
||||
st->time_base = sap->sdp_ctx->streams[i]->time_base;
|
||||
}
|
||||
|
@ -106,9 +106,10 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
avio_rl16(pb);
|
||||
avio_r8(pb);
|
||||
/* Check for FLV1 */
|
||||
vst = av_new_stream(s, ch_id);
|
||||
vst = avformat_new_stream(s, NULL);
|
||||
if (!vst)
|
||||
return -1;
|
||||
vst->id = ch_id;
|
||||
vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
|
||||
vst->codec->codec_id = ff_codec_get_id(swf_codec_tags, avio_r8(pb));
|
||||
av_set_pts_info(vst, 16, 256, swf->frame_rate);
|
||||
@ -127,9 +128,10 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
avio_r8(pb);
|
||||
v = avio_r8(pb);
|
||||
swf->samples_per_frame = avio_rl16(pb);
|
||||
ast = av_new_stream(s, -1); /* -1 to avoid clash with video stream ch_id */
|
||||
ast = avformat_new_stream(s, NULL);
|
||||
if (!ast)
|
||||
return -1;
|
||||
ast->id = -1; /* -1 to avoid clash with video stream ch_id */
|
||||
ast->codec->channels = 1 + (v&1);
|
||||
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
|
||||
ast->codec->codec_id = ff_codec_get_id(swf_audio_codec_tags, (v>>4) & 15);
|
||||
@ -177,9 +179,10 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
break;
|
||||
}
|
||||
if (i == s->nb_streams) {
|
||||
vst = av_new_stream(s, -2); /* -2 to avoid clash with video stream and audio stream */
|
||||
vst = avformat_new_stream(s, NULL);
|
||||
if (!vst)
|
||||
return -1;
|
||||
vst->id = -2; /* -2 to avoid clash with video stream and audio stream */
|
||||
vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
|
||||
vst->codec->codec_id = CODEC_ID_MJPEG;
|
||||
av_set_pts_info(vst, 64, 256, swf->frame_rate);
|
||||
|
@ -626,9 +626,10 @@ static AVStream * new_stream(AVFormatContext *s, AVStream *st, int sid, int code
|
||||
WtvStream *wst = av_mallocz(sizeof(WtvStream));
|
||||
if (!wst)
|
||||
return NULL;
|
||||
st = av_new_stream(s, sid);
|
||||
st = avformat_new_stream(s, NULL);
|
||||
if (!st)
|
||||
return NULL;
|
||||
st->id = sid;
|
||||
st->priv_data = wst;
|
||||
}
|
||||
st->codec->codec_type = codec_type;
|
||||
|
@ -211,7 +211,7 @@ static int xmv_read_header(AVFormatContext *s,
|
||||
av_log(s, AV_LOG_WARNING, "Unsupported 5.1 ADPCM audio stream "
|
||||
"(0x%04X)\n", track->flags);
|
||||
|
||||
ast = av_new_stream(s, audio_track);
|
||||
ast = avformat_new_stream(s, NULL);
|
||||
if (!ast)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
|
@ -57,7 +57,7 @@ static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
int frame_rate, ret;
|
||||
|
||||
audio_stream = avformat_new_stream(s, NULL);
|
||||
video_stream = av_new_stream(s, 1);
|
||||
video_stream = avformat_new_stream(s, NULL);
|
||||
|
||||
// Extra data that will be passed to the decoder
|
||||
video_stream->codec->extradata_size = 8;
|
||||
|
Loading…
Reference in New Issue
Block a user