[FFmpeg-cvslog] avcodec/decode: replace avctx->internal with avci for better readability
Limin Wang
git at videolan.org
Tue Jan 7 03:56:11 EET 2020
ffmpeg | branch: master | Limin Wang <lance.lmwang at gmail.com> | Mon Jan 6 18:31:03 2020 +0800| [10f0332fd5f517eba8deab21d115da3f5c800f3a] | committer: Michael Niedermayer
avcodec/decode: replace avctx->internal with avci for better readability
Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=10f0332fd5f517eba8deab21d115da3f5c800f3a
---
libavcodec/decode.c | 52 +++++++++++++++++++++++++++-------------------------
1 file changed, 27 insertions(+), 25 deletions(-)
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index cd275bacc4..03b9da25f9 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -479,32 +479,32 @@ static int decode_simple_internal(AVCodecContext *avctx, AVFrame *frame)
side= av_packet_get_side_data(avci->last_pkt_props, AV_PKT_DATA_SKIP_SAMPLES, &side_size);
if(side && side_size>=10) {
- avctx->internal->skip_samples = AV_RL32(side) * avctx->internal->skip_samples_multiplier;
+ avci->skip_samples = AV_RL32(side) * avci->skip_samples_multiplier;
discard_padding = AV_RL32(side + 4);
av_log(avctx, AV_LOG_DEBUG, "skip %d / discard %d samples due to side data\n",
- avctx->internal->skip_samples, (int)discard_padding);
+ avci->skip_samples, (int)discard_padding);
skip_reason = AV_RL8(side + 8);
discard_reason = AV_RL8(side + 9);
}
if ((frame->flags & AV_FRAME_FLAG_DISCARD) && got_frame &&
!(avctx->flags2 & AV_CODEC_FLAG2_SKIP_MANUAL)) {
- avctx->internal->skip_samples = FFMAX(0, avctx->internal->skip_samples - frame->nb_samples);
+ avci->skip_samples = FFMAX(0, avci->skip_samples - frame->nb_samples);
got_frame = 0;
}
- if (avctx->internal->skip_samples > 0 && got_frame &&
+ if (avci->skip_samples > 0 && got_frame &&
!(avctx->flags2 & AV_CODEC_FLAG2_SKIP_MANUAL)) {
- if(frame->nb_samples <= avctx->internal->skip_samples){
+ if(frame->nb_samples <= avci->skip_samples){
got_frame = 0;
- avctx->internal->skip_samples -= frame->nb_samples;
+ avci->skip_samples -= frame->nb_samples;
av_log(avctx, AV_LOG_DEBUG, "skip whole frame, skip left: %d\n",
- avctx->internal->skip_samples);
+ avci->skip_samples);
} else {
- av_samples_copy(frame->extended_data, frame->extended_data, 0, avctx->internal->skip_samples,
- frame->nb_samples - avctx->internal->skip_samples, avctx->channels, frame->format);
+ av_samples_copy(frame->extended_data, frame->extended_data, 0, avci->skip_samples,
+ frame->nb_samples - avci->skip_samples, avctx->channels, frame->format);
if(avctx->pkt_timebase.num && avctx->sample_rate) {
- int64_t diff_ts = av_rescale_q(avctx->internal->skip_samples,
+ int64_t diff_ts = av_rescale_q(avci->skip_samples,
(AVRational){1, avctx->sample_rate},
avctx->pkt_timebase);
if(frame->pts!=AV_NOPTS_VALUE)
@@ -523,9 +523,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
av_log(avctx, AV_LOG_WARNING, "Could not update timestamps for skipped samples.\n");
}
av_log(avctx, AV_LOG_DEBUG, "skip %d/%d samples\n",
- avctx->internal->skip_samples, frame->nb_samples);
- frame->nb_samples -= avctx->internal->skip_samples;
- avctx->internal->skip_samples = 0;
+ avci->skip_samples, frame->nb_samples);
+ frame->nb_samples -= avci->skip_samples;
+ avci->skip_samples = 0;
}
}
@@ -551,11 +551,11 @@ FF_ENABLE_DEPRECATION_WARNINGS
if ((avctx->flags2 & AV_CODEC_FLAG2_SKIP_MANUAL) && got_frame) {
AVFrameSideData *fside = av_frame_new_side_data(frame, AV_FRAME_DATA_SKIP_SAMPLES, 10);
if (fside) {
- AV_WL32(fside->data, avctx->internal->skip_samples);
+ AV_WL32(fside->data, avci->skip_samples);
AV_WL32(fside->data + 4, discard_padding);
AV_WL8(fside->data + 8, skip_reason);
AV_WL8(fside->data + 9, discard_reason);
- avctx->internal->skip_samples = 0;
+ avci->skip_samples = 0;
}
}
}
@@ -580,7 +580,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
/* do not stop draining when actual_got_frame != 0 or ret < 0 */
/* got_frame == 0 but actual_got_frame != 0 when frame is discarded */
- if (avctx->internal->draining && !actual_got_frame) {
+ if (avci->draining && !actual_got_frame) {
if (ret < 0) {
/* prevent infinite loop if a decoder wrongly always return error on draining */
/* reasonable nb_errors_max = maximum b frames + thread count */
@@ -2030,15 +2030,17 @@ static void bsfs_flush(AVCodecContext *avctx)
void avcodec_flush_buffers(AVCodecContext *avctx)
{
- avctx->internal->draining = 0;
- avctx->internal->draining_done = 0;
- avctx->internal->nb_draining_errors = 0;
- av_frame_unref(avctx->internal->buffer_frame);
- av_frame_unref(avctx->internal->compat_decode_frame);
- av_packet_unref(avctx->internal->buffer_pkt);
- avctx->internal->buffer_pkt_valid = 0;
+ AVCodecInternal *avci = avctx->internal;
+
+ avci->draining = 0;
+ avci->draining_done = 0;
+ avci->nb_draining_errors = 0;
+ av_frame_unref(avci->buffer_frame);
+ av_frame_unref(avci->compat_decode_frame);
+ av_packet_unref(avci->buffer_pkt);
+ avci->buffer_pkt_valid = 0;
- av_packet_unref(avctx->internal->ds.in_pkt);
+ av_packet_unref(avci->ds.in_pkt);
if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME)
ff_thread_flush(avctx);
@@ -2051,7 +2053,7 @@ void avcodec_flush_buffers(AVCodecContext *avctx)
bsfs_flush(avctx);
if (!avctx->refcounted_frames)
- av_frame_unref(avctx->internal->to_free);
+ av_frame_unref(avci->to_free);
}
void ff_decode_bsfs_uninit(AVCodecContext *avctx)
More information about the ffmpeg-cvslog
mailing list