You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
Merge commit '15ec0450b4ae891f3e6ababa03c777a4443b94ca'
* commit '15ec0450b4ae891f3e6ababa03c777a4443b94ca': lavc: allow decoders to override frame parameters. Conflicts: libavcodec/utils.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
@@ -597,33 +597,40 @@ int avcodec_default_get_buffer2(AVCodecContext *avctx, AVFrame *frame, int flags
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ff_init_buffer_info(AVCodecContext *s, AVFrame *frame)
|
void ff_init_buffer_info(AVCodecContext *avctx, AVFrame *frame)
|
||||||
{
|
{
|
||||||
if (s->pkt) {
|
if (avctx->pkt) {
|
||||||
frame->pkt_pts = s->pkt->pts;
|
frame->pkt_pts = avctx->pkt->pts;
|
||||||
av_frame_set_pkt_pos (frame, s->pkt->pos);
|
av_frame_set_pkt_pos (frame, avctx->pkt->pos);
|
||||||
av_frame_set_pkt_duration(frame, s->pkt->duration);
|
av_frame_set_pkt_duration(frame, avctx->pkt->duration);
|
||||||
av_frame_set_pkt_size (frame, s->pkt->size);
|
av_frame_set_pkt_size (frame, avctx->pkt->size);
|
||||||
} else {
|
} else {
|
||||||
frame->pkt_pts = AV_NOPTS_VALUE;
|
frame->pkt_pts = AV_NOPTS_VALUE;
|
||||||
av_frame_set_pkt_pos (frame, -1);
|
av_frame_set_pkt_pos (frame, -1);
|
||||||
av_frame_set_pkt_duration(frame, 0);
|
av_frame_set_pkt_duration(frame, 0);
|
||||||
av_frame_set_pkt_size (frame, -1);
|
av_frame_set_pkt_size (frame, -1);
|
||||||
}
|
}
|
||||||
frame->reordered_opaque = s->reordered_opaque;
|
frame->reordered_opaque = avctx->reordered_opaque;
|
||||||
|
|
||||||
switch (s->codec->type) {
|
switch (avctx->codec->type) {
|
||||||
case AVMEDIA_TYPE_VIDEO:
|
case AVMEDIA_TYPE_VIDEO:
|
||||||
frame->width = s->width;
|
if (!frame->width)
|
||||||
frame->height = s->height;
|
frame->width = avctx->width;
|
||||||
frame->format = s->pix_fmt;
|
if (!frame->height)
|
||||||
frame->sample_aspect_ratio = s->sample_aspect_ratio;
|
frame->height = avctx->height;
|
||||||
|
if (frame->format < 0)
|
||||||
|
frame->format = avctx->pix_fmt;
|
||||||
|
if (!frame->sample_aspect_ratio.num)
|
||||||
|
frame->sample_aspect_ratio = avctx->sample_aspect_ratio;
|
||||||
break;
|
break;
|
||||||
case AVMEDIA_TYPE_AUDIO:
|
case AVMEDIA_TYPE_AUDIO:
|
||||||
frame->sample_rate = s->sample_rate;
|
if (!frame->sample_rate)
|
||||||
frame->format = s->sample_fmt;
|
frame->sample_rate = avctx->sample_rate;
|
||||||
frame->channel_layout = s->channel_layout;
|
if (frame->format < 0)
|
||||||
av_frame_set_channels(frame, s->channels);
|
frame->format = avctx->sample_fmt;
|
||||||
|
if (!frame->channel_layout)
|
||||||
|
frame->channel_layout = avctx->channel_layout;
|
||||||
|
av_frame_set_channels(frame, avctx->channels);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user