Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
avformat/imfdec: preserve stream information
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
  • Loading branch information
palemieux authored and mkver committed Aug 12, 2022
1 parent f2403d1 commit d5b46fa
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions libavformat/imfdec.c
Expand Up @@ -573,18 +573,14 @@ static int set_context_streams_from_tracks(AVFormatContext *s)
first_resource_stream = c->tracks[i]->resources[0].ctx->streams[0];
av_log(s, AV_LOG_DEBUG, "Open the first resource of track %d\n", c->tracks[i]->index);

/* Copy stream information */
asset_stream = avformat_new_stream(s, NULL);
asset_stream = ff_stream_clone(s, first_resource_stream);
if (!asset_stream) {
av_log(s, AV_LOG_ERROR, "Could not create stream\n");
av_log(s, AV_LOG_ERROR, "Could not clone stream\n");
return AVERROR(ENOMEM);
}

asset_stream->id = i;
ret = avcodec_parameters_copy(asset_stream->codecpar, first_resource_stream->codecpar);
if (ret < 0) {
av_log(s, AV_LOG_ERROR, "Could not copy stream parameters\n");
return ret;
}
asset_stream->nb_frames = 0;
avpriv_set_pts_info(asset_stream,
first_resource_stream->pts_wrap_bits,
first_resource_stream->time_base.num,
Expand Down

0 comments on commit d5b46fa

Please sign in to comment.