diff options
Diffstat (limited to 'demux/demux_lavf.c')
-rw-r--r-- | demux/demux_lavf.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c index 7af41e6f09..5e7d8d8a9e 100644 --- a/demux/demux_lavf.c +++ b/demux/demux_lavf.c @@ -541,9 +541,7 @@ static void handle_new_stream(demuxer_t *demuxer, int i) switch (codec->codec_type) { case AVMEDIA_TYPE_AUDIO: { - sh = new_sh_stream(demuxer, STREAM_AUDIO); - if (!sh) - break; + sh = demux_alloc_sh_stream(STREAM_AUDIO); sh_audio_t *sh_audio = sh->audio; // probably unneeded @@ -558,9 +556,7 @@ static void handle_new_stream(demuxer_t *demuxer, int i) break; } case AVMEDIA_TYPE_VIDEO: { - sh = new_sh_stream(demuxer, STREAM_VIDEO); - if (!sh) - break; + sh = demux_alloc_sh_stream(STREAM_VIDEO); sh_video_t *sh_video = sh->video; if (st->disposition & AV_DISPOSITION_ATTACHED_PIC) { @@ -609,9 +605,7 @@ static void handle_new_stream(demuxer_t *demuxer, int i) } case AVMEDIA_TYPE_SUBTITLE: { sh_sub_t *sh_sub; - sh = new_sh_stream(demuxer, STREAM_SUB); - if (!sh) - break; + sh = demux_alloc_sh_stream(STREAM_SUB); sh_sub = sh->sub; if (codec->extradata_size) { @@ -660,9 +654,8 @@ static void handle_new_stream(demuxer_t *demuxer, int i) sh->codec = mp_codec_from_av_codec_id(codec->codec_id); sh->codec_tag = codec->codec_tag; sh->lav_headers = avcodec_alloc_context3(NULL); - if (!sh->lav_headers) - return; - mp_copy_lav_codec_headers(sh->lav_headers, codec); + if (sh->lav_headers) + mp_copy_lav_codec_headers(sh->lav_headers, codec); if (st->disposition & AV_DISPOSITION_DEFAULT) sh->default_track = true; @@ -680,10 +673,10 @@ static void handle_new_stream(demuxer_t *demuxer, int i) if (!sh->title && sh->hls_bitrate > 0) sh->title = talloc_asprintf(sh, "bitrate %d", sh->hls_bitrate); sh->missing_timestamps = !!(priv->avif_flags & AVFMT_NOTIMESTAMPS); + demux_add_sh_stream(demuxer, sh); } select_tracks(demuxer, i); - demux_changed(demuxer, DEMUX_EVENT_STREAMS); } // Add any new streams that might have been added @@ -844,7 +837,7 @@ static int demux_open_lavf(demuxer_t *demuxer, enum demux_check check) // Often useful with OGG audio-only files, which have metadata in the audio // track metadata instead of the main metadata. - if (demuxer->num_streams == 1) { + if (demux_get_num_stream(demuxer) == 1) { priv->merge_track_metadata = true; for (int n = 0; n < priv->num_streams; n++) { if (priv->streams[n]) |