ff*: do not use AVFrame accessor
Reviewed-by: wm4 <nfxjfg@googlemail.com> Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
This commit is contained in:
parent
6af050d7d0
commit
8893c943a9
10
ffmpeg.c
10
ffmpeg.c
@ -1062,8 +1062,8 @@ static void do_video_out(OutputFile *of,
|
|||||||
!ost->filters &&
|
!ost->filters &&
|
||||||
next_picture &&
|
next_picture &&
|
||||||
ist &&
|
ist &&
|
||||||
lrintf(av_frame_get_pkt_duration(next_picture) * av_q2d(ist->st->time_base) / av_q2d(enc->time_base)) > 0) {
|
lrintf(next_picture->pkt_duration * av_q2d(ist->st->time_base) / av_q2d(enc->time_base)) > 0) {
|
||||||
duration = lrintf(av_frame_get_pkt_duration(next_picture) * av_q2d(ist->st->time_base) / av_q2d(enc->time_base));
|
duration = lrintf(next_picture->pkt_duration * av_q2d(ist->st->time_base) / av_q2d(enc->time_base));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!next_picture) {
|
if (!next_picture) {
|
||||||
@ -1506,7 +1506,7 @@ static int reap_filters(int flush)
|
|||||||
break;
|
break;
|
||||||
case AVMEDIA_TYPE_AUDIO:
|
case AVMEDIA_TYPE_AUDIO:
|
||||||
if (!(enc->codec->capabilities & AV_CODEC_CAP_PARAM_CHANGE) &&
|
if (!(enc->codec->capabilities & AV_CODEC_CAP_PARAM_CHANGE) &&
|
||||||
enc->channels != av_frame_get_channels(filtered_frame)) {
|
enc->channels != filtered_frame->channels) {
|
||||||
av_log(NULL, AV_LOG_ERROR,
|
av_log(NULL, AV_LOG_ERROR,
|
||||||
"Audio filter graph output is not normalized and encoder does not support parameter changes\n");
|
"Audio filter graph output is not normalized and encoder does not support parameter changes\n");
|
||||||
break;
|
break;
|
||||||
@ -2126,7 +2126,7 @@ static void check_decode_result(InputStream *ist, int *got_output, int ret)
|
|||||||
exit_program(1);
|
exit_program(1);
|
||||||
|
|
||||||
if (exit_on_error && *got_output && ist) {
|
if (exit_on_error && *got_output && ist) {
|
||||||
if (av_frame_get_decode_error_flags(ist->decoded_frame) || (ist->decoded_frame->flags & AV_FRAME_FLAG_CORRUPT)) {
|
if (ist->decoded_frame->decode_error_flags || (ist->decoded_frame->flags & AV_FRAME_FLAG_CORRUPT)) {
|
||||||
av_log(NULL, AV_LOG_FATAL, "%s: corrupt decoded frame in stream %d\n", input_files[ist->file_index]->ctx->filename, ist->st->index);
|
av_log(NULL, AV_LOG_FATAL, "%s: corrupt decoded frame in stream %d\n", input_files[ist->file_index]->ctx->filename, ist->st->index);
|
||||||
exit_program(1);
|
exit_program(1);
|
||||||
}
|
}
|
||||||
@ -2455,7 +2455,7 @@ static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output, int eo
|
|||||||
}
|
}
|
||||||
ist->hwaccel_retrieved_pix_fmt = decoded_frame->format;
|
ist->hwaccel_retrieved_pix_fmt = decoded_frame->format;
|
||||||
|
|
||||||
best_effort_timestamp= av_frame_get_best_effort_timestamp(decoded_frame);
|
best_effort_timestamp= decoded_frame->best_effort_timestamp;
|
||||||
|
|
||||||
if (ist->framerate.num)
|
if (ist->framerate.num)
|
||||||
best_effort_timestamp = ist->cfr_next_pts++;
|
best_effort_timestamp = ist->cfr_next_pts++;
|
||||||
|
@ -1162,7 +1162,7 @@ int ifilter_parameters_from_frame(InputFilter *ifilter, const AVFrame *frame)
|
|||||||
ifilter->sample_aspect_ratio = frame->sample_aspect_ratio;
|
ifilter->sample_aspect_ratio = frame->sample_aspect_ratio;
|
||||||
|
|
||||||
ifilter->sample_rate = frame->sample_rate;
|
ifilter->sample_rate = frame->sample_rate;
|
||||||
ifilter->channels = av_frame_get_channels(frame);
|
ifilter->channels = frame->channels;
|
||||||
ifilter->channel_layout = frame->channel_layout;
|
ifilter->channel_layout = frame->channel_layout;
|
||||||
|
|
||||||
if (frame->hw_frames_ctx) {
|
if (frame->hw_frames_ctx) {
|
||||||
|
24
ffplay.c
24
ffplay.c
@ -569,7 +569,7 @@ static int decoder_decode_frame(Decoder *d, AVFrame *frame, AVSubtitle *sub) {
|
|||||||
ret = avcodec_receive_frame(d->avctx, frame);
|
ret = avcodec_receive_frame(d->avctx, frame);
|
||||||
if (ret >= 0) {
|
if (ret >= 0) {
|
||||||
if (decoder_reorder_pts == -1) {
|
if (decoder_reorder_pts == -1) {
|
||||||
frame->pts = av_frame_get_best_effort_timestamp(frame);
|
frame->pts = frame->best_effort_timestamp;
|
||||||
} else if (!decoder_reorder_pts) {
|
} else if (!decoder_reorder_pts) {
|
||||||
frame->pts = frame->pkt_dts;
|
frame->pts = frame->pkt_dts;
|
||||||
}
|
}
|
||||||
@ -1981,11 +1981,11 @@ static int audio_thread(void *arg)
|
|||||||
tb = (AVRational){1, frame->sample_rate};
|
tb = (AVRational){1, frame->sample_rate};
|
||||||
|
|
||||||
#if CONFIG_AVFILTER
|
#if CONFIG_AVFILTER
|
||||||
dec_channel_layout = get_valid_channel_layout(frame->channel_layout, av_frame_get_channels(frame));
|
dec_channel_layout = get_valid_channel_layout(frame->channel_layout, frame->channels);
|
||||||
|
|
||||||
reconfigure =
|
reconfigure =
|
||||||
cmp_audio_fmts(is->audio_filter_src.fmt, is->audio_filter_src.channels,
|
cmp_audio_fmts(is->audio_filter_src.fmt, is->audio_filter_src.channels,
|
||||||
frame->format, av_frame_get_channels(frame)) ||
|
frame->format, frame->channels) ||
|
||||||
is->audio_filter_src.channel_layout != dec_channel_layout ||
|
is->audio_filter_src.channel_layout != dec_channel_layout ||
|
||||||
is->audio_filter_src.freq != frame->sample_rate ||
|
is->audio_filter_src.freq != frame->sample_rate ||
|
||||||
is->auddec.pkt_serial != last_serial;
|
is->auddec.pkt_serial != last_serial;
|
||||||
@ -1997,10 +1997,10 @@ static int audio_thread(void *arg)
|
|||||||
av_log(NULL, AV_LOG_DEBUG,
|
av_log(NULL, AV_LOG_DEBUG,
|
||||||
"Audio frame changed from rate:%d ch:%d fmt:%s layout:%s serial:%d to rate:%d ch:%d fmt:%s layout:%s serial:%d\n",
|
"Audio frame changed from rate:%d ch:%d fmt:%s layout:%s serial:%d to rate:%d ch:%d fmt:%s layout:%s serial:%d\n",
|
||||||
is->audio_filter_src.freq, is->audio_filter_src.channels, av_get_sample_fmt_name(is->audio_filter_src.fmt), buf1, last_serial,
|
is->audio_filter_src.freq, is->audio_filter_src.channels, av_get_sample_fmt_name(is->audio_filter_src.fmt), buf1, last_serial,
|
||||||
frame->sample_rate, av_frame_get_channels(frame), av_get_sample_fmt_name(frame->format), buf2, is->auddec.pkt_serial);
|
frame->sample_rate, frame->channels, av_get_sample_fmt_name(frame->format), buf2, is->auddec.pkt_serial);
|
||||||
|
|
||||||
is->audio_filter_src.fmt = frame->format;
|
is->audio_filter_src.fmt = frame->format;
|
||||||
is->audio_filter_src.channels = av_frame_get_channels(frame);
|
is->audio_filter_src.channels = frame->channels;
|
||||||
is->audio_filter_src.channel_layout = dec_channel_layout;
|
is->audio_filter_src.channel_layout = dec_channel_layout;
|
||||||
is->audio_filter_src.freq = frame->sample_rate;
|
is->audio_filter_src.freq = frame->sample_rate;
|
||||||
last_serial = is->auddec.pkt_serial;
|
last_serial = is->auddec.pkt_serial;
|
||||||
@ -2019,7 +2019,7 @@ static int audio_thread(void *arg)
|
|||||||
goto the_end;
|
goto the_end;
|
||||||
|
|
||||||
af->pts = (frame->pts == AV_NOPTS_VALUE) ? NAN : frame->pts * av_q2d(tb);
|
af->pts = (frame->pts == AV_NOPTS_VALUE) ? NAN : frame->pts * av_q2d(tb);
|
||||||
af->pos = av_frame_get_pkt_pos(frame);
|
af->pos = frame->pkt_pos;
|
||||||
af->serial = is->auddec.pkt_serial;
|
af->serial = is->auddec.pkt_serial;
|
||||||
af->duration = av_q2d((AVRational){frame->nb_samples, frame->sample_rate});
|
af->duration = av_q2d((AVRational){frame->nb_samples, frame->sample_rate});
|
||||||
|
|
||||||
@ -2146,7 +2146,7 @@ static int video_thread(void *arg)
|
|||||||
#endif
|
#endif
|
||||||
duration = (frame_rate.num && frame_rate.den ? av_q2d((AVRational){frame_rate.den, frame_rate.num}) : 0);
|
duration = (frame_rate.num && frame_rate.den ? av_q2d((AVRational){frame_rate.den, frame_rate.num}) : 0);
|
||||||
pts = (frame->pts == AV_NOPTS_VALUE) ? NAN : frame->pts * av_q2d(tb);
|
pts = (frame->pts == AV_NOPTS_VALUE) ? NAN : frame->pts * av_q2d(tb);
|
||||||
ret = queue_picture(is, frame, pts, duration, av_frame_get_pkt_pos(frame), is->viddec.pkt_serial);
|
ret = queue_picture(is, frame, pts, duration, frame->pkt_pos, is->viddec.pkt_serial);
|
||||||
av_frame_unref(frame);
|
av_frame_unref(frame);
|
||||||
#if CONFIG_AVFILTER
|
#if CONFIG_AVFILTER
|
||||||
}
|
}
|
||||||
@ -2290,13 +2290,13 @@ static int audio_decode_frame(VideoState *is)
|
|||||||
frame_queue_next(&is->sampq);
|
frame_queue_next(&is->sampq);
|
||||||
} while (af->serial != is->audioq.serial);
|
} while (af->serial != is->audioq.serial);
|
||||||
|
|
||||||
data_size = av_samples_get_buffer_size(NULL, av_frame_get_channels(af->frame),
|
data_size = av_samples_get_buffer_size(NULL, af->frame->channels,
|
||||||
af->frame->nb_samples,
|
af->frame->nb_samples,
|
||||||
af->frame->format, 1);
|
af->frame->format, 1);
|
||||||
|
|
||||||
dec_channel_layout =
|
dec_channel_layout =
|
||||||
(af->frame->channel_layout && av_frame_get_channels(af->frame) == av_get_channel_layout_nb_channels(af->frame->channel_layout)) ?
|
(af->frame->channel_layout && af->frame->channels == av_get_channel_layout_nb_channels(af->frame->channel_layout)) ?
|
||||||
af->frame->channel_layout : av_get_default_channel_layout(av_frame_get_channels(af->frame));
|
af->frame->channel_layout : av_get_default_channel_layout(af->frame->channels);
|
||||||
wanted_nb_samples = synchronize_audio(is, af->frame->nb_samples);
|
wanted_nb_samples = synchronize_audio(is, af->frame->nb_samples);
|
||||||
|
|
||||||
if (af->frame->format != is->audio_src.fmt ||
|
if (af->frame->format != is->audio_src.fmt ||
|
||||||
@ -2311,13 +2311,13 @@ static int audio_decode_frame(VideoState *is)
|
|||||||
if (!is->swr_ctx || swr_init(is->swr_ctx) < 0) {
|
if (!is->swr_ctx || swr_init(is->swr_ctx) < 0) {
|
||||||
av_log(NULL, AV_LOG_ERROR,
|
av_log(NULL, AV_LOG_ERROR,
|
||||||
"Cannot create sample rate converter for conversion of %d Hz %s %d channels to %d Hz %s %d channels!\n",
|
"Cannot create sample rate converter for conversion of %d Hz %s %d channels to %d Hz %s %d channels!\n",
|
||||||
af->frame->sample_rate, av_get_sample_fmt_name(af->frame->format), av_frame_get_channels(af->frame),
|
af->frame->sample_rate, av_get_sample_fmt_name(af->frame->format), af->frame->channels,
|
||||||
is->audio_tgt.freq, av_get_sample_fmt_name(is->audio_tgt.fmt), is->audio_tgt.channels);
|
is->audio_tgt.freq, av_get_sample_fmt_name(is->audio_tgt.fmt), is->audio_tgt.channels);
|
||||||
swr_free(&is->swr_ctx);
|
swr_free(&is->swr_ctx);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
is->audio_src.channel_layout = dec_channel_layout;
|
is->audio_src.channel_layout = dec_channel_layout;
|
||||||
is->audio_src.channels = av_frame_get_channels(af->frame);
|
is->audio_src.channels = af->frame->channels;
|
||||||
is->audio_src.freq = af->frame->sample_rate;
|
is->audio_src.freq = af->frame->sample_rate;
|
||||||
is->audio_src.fmt = af->frame->format;
|
is->audio_src.fmt = af->frame->format;
|
||||||
}
|
}
|
||||||
|
22
ffprobe.c
22
ffprobe.c
@ -2049,13 +2049,13 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
|
|||||||
print_time("pkt_pts_time", frame->pts, &stream->time_base);
|
print_time("pkt_pts_time", frame->pts, &stream->time_base);
|
||||||
print_ts ("pkt_dts", frame->pkt_dts);
|
print_ts ("pkt_dts", frame->pkt_dts);
|
||||||
print_time("pkt_dts_time", frame->pkt_dts, &stream->time_base);
|
print_time("pkt_dts_time", frame->pkt_dts, &stream->time_base);
|
||||||
print_ts ("best_effort_timestamp", av_frame_get_best_effort_timestamp(frame));
|
print_ts ("best_effort_timestamp", frame->best_effort_timestamp);
|
||||||
print_time("best_effort_timestamp_time", av_frame_get_best_effort_timestamp(frame), &stream->time_base);
|
print_time("best_effort_timestamp_time", frame->best_effort_timestamp, &stream->time_base);
|
||||||
print_duration_ts ("pkt_duration", av_frame_get_pkt_duration(frame));
|
print_duration_ts ("pkt_duration", frame->pkt_duration);
|
||||||
print_duration_time("pkt_duration_time", av_frame_get_pkt_duration(frame), &stream->time_base);
|
print_duration_time("pkt_duration_time", frame->pkt_duration, &stream->time_base);
|
||||||
if (av_frame_get_pkt_pos (frame) != -1) print_fmt ("pkt_pos", "%"PRId64, av_frame_get_pkt_pos(frame));
|
if (frame->pkt_pos != -1) print_fmt ("pkt_pos", "%"PRId64, frame->pkt_pos);
|
||||||
else print_str_opt("pkt_pos", "N/A");
|
else print_str_opt("pkt_pos", "N/A");
|
||||||
if (av_frame_get_pkt_size(frame) != -1) print_val ("pkt_size", av_frame_get_pkt_size(frame), unit_byte_str);
|
if (frame->pkt_size != -1) print_val ("pkt_size", frame->pkt_size, unit_byte_str);
|
||||||
else print_str_opt("pkt_size", "N/A");
|
else print_str_opt("pkt_size", "N/A");
|
||||||
|
|
||||||
switch (stream->codecpar->codec_type) {
|
switch (stream->codecpar->codec_type) {
|
||||||
@ -2086,18 +2086,18 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
|
|||||||
if (s) print_str ("sample_fmt", s);
|
if (s) print_str ("sample_fmt", s);
|
||||||
else print_str_opt("sample_fmt", "unknown");
|
else print_str_opt("sample_fmt", "unknown");
|
||||||
print_int("nb_samples", frame->nb_samples);
|
print_int("nb_samples", frame->nb_samples);
|
||||||
print_int("channels", av_frame_get_channels(frame));
|
print_int("channels", frame->channels);
|
||||||
if (av_frame_get_channel_layout(frame)) {
|
if (frame->channel_layout) {
|
||||||
av_bprint_clear(&pbuf);
|
av_bprint_clear(&pbuf);
|
||||||
av_bprint_channel_layout(&pbuf, av_frame_get_channels(frame),
|
av_bprint_channel_layout(&pbuf, frame->channels,
|
||||||
av_frame_get_channel_layout(frame));
|
frame->channel_layout);
|
||||||
print_str ("channel_layout", pbuf.str);
|
print_str ("channel_layout", pbuf.str);
|
||||||
} else
|
} else
|
||||||
print_str_opt("channel_layout", "unknown");
|
print_str_opt("channel_layout", "unknown");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (do_show_frame_tags)
|
if (do_show_frame_tags)
|
||||||
show_tags(w, av_frame_get_metadata(frame), SECTION_ID_FRAME_TAGS);
|
show_tags(w, frame->metadata, SECTION_ID_FRAME_TAGS);
|
||||||
if (do_show_log)
|
if (do_show_log)
|
||||||
show_log(w, SECTION_ID_FRAME_LOGS, SECTION_ID_FRAME_LOG, do_show_log);
|
show_log(w, SECTION_ID_FRAME_LOGS, SECTION_ID_FRAME_LOG, do_show_log);
|
||||||
if (frame->nb_side_data) {
|
if (frame->nb_side_data) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user