diff options
author | Limin Wang <lance.lmwang@gmail.com> | 2019-12-16 13:01:49 +0800 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2020-01-04 20:59:31 +0100 |
commit | ebbc976ae66774a9de70ea4dcc466bca4aa4f688 (patch) | |
tree | 87839c1bc290176e0baedca4fd2fd1d81109b493 /libavcodec | |
parent | f7c945abc071770fad2e1d730eb3295432b6aeb0 (diff) | |
download | ffmpeg-ebbc976ae66774a9de70ea4dcc466bca4aa4f688.tar.gz |
avcodec/bsf: replace ctx->internal-> with bsfi-> for better readability
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/bsf.c | 49 |
1 files changed, 27 insertions, 22 deletions
diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c index 8e1af6082b..9dbf6a636d 100644 --- a/libavcodec/bsf.c +++ b/libavcodec/bsf.c @@ -82,6 +82,7 @@ const AVClass *av_bsf_get_class(void) int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **pctx) { AVBSFContext *ctx; + AVBSFInternal *bsfi; int ret; ctx = av_mallocz(sizeof(*ctx)); @@ -98,14 +99,15 @@ int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **pctx) goto fail; } - ctx->internal = av_mallocz(sizeof(*ctx->internal)); - if (!ctx->internal) { + bsfi = av_mallocz(sizeof(*bsfi)); + if (!bsfi) { ret = AVERROR(ENOMEM); goto fail; } + ctx->internal = bsfi; - ctx->internal->buffer_pkt = av_packet_alloc(); - if (!ctx->internal->buffer_pkt) { + bsfi->buffer_pkt = av_packet_alloc(); + if (!bsfi->buffer_pkt) { ret = AVERROR(ENOMEM); goto fail; } @@ -175,9 +177,11 @@ int av_bsf_init(AVBSFContext *ctx) void av_bsf_flush(AVBSFContext *ctx) { - ctx->internal->eof = 0; + AVBSFInternal *bsfi = ctx->internal; - av_packet_unref(ctx->internal->buffer_pkt); + bsfi->eof = 0; + + av_packet_unref(bsfi->buffer_pkt); if (ctx->filter->flush) ctx->filter->flush(ctx); @@ -185,26 +189,27 @@ void av_bsf_flush(AVBSFContext *ctx) int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt) { + AVBSFInternal *bsfi = ctx->internal; int ret; if (!pkt || (!pkt->data && !pkt->side_data_elems)) { - ctx->internal->eof = 1; + bsfi->eof = 1; return 0; } - if (ctx->internal->eof) { + if (bsfi->eof) { av_log(ctx, AV_LOG_ERROR, "A non-NULL packet sent after an EOF.\n"); return AVERROR(EINVAL); } - if (ctx->internal->buffer_pkt->data || - ctx->internal->buffer_pkt->side_data_elems) + if (bsfi->buffer_pkt->data || + bsfi->buffer_pkt->side_data_elems) return AVERROR(EAGAIN); ret = av_packet_make_refcounted(pkt); if (ret < 0) return ret; - av_packet_move_ref(ctx->internal->buffer_pkt, pkt); + av_packet_move_ref(bsfi->buffer_pkt, pkt); return 0; } @@ -216,38 +221,38 @@ int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt) int ff_bsf_get_packet(AVBSFContext *ctx, AVPacket **pkt) { - AVBSFInternal *in = ctx->internal; + AVBSFInternal *bsfi = ctx->internal; AVPacket *tmp_pkt; - if (in->eof) + if (bsfi->eof) return AVERROR_EOF; - if (!ctx->internal->buffer_pkt->data && - !ctx->internal->buffer_pkt->side_data_elems) + if (!bsfi->buffer_pkt->data && + !bsfi->buffer_pkt->side_data_elems) return AVERROR(EAGAIN); tmp_pkt = av_packet_alloc(); if (!tmp_pkt) return AVERROR(ENOMEM); - *pkt = ctx->internal->buffer_pkt; - ctx->internal->buffer_pkt = tmp_pkt; + *pkt = bsfi->buffer_pkt; + bsfi->buffer_pkt = tmp_pkt; return 0; } int ff_bsf_get_packet_ref(AVBSFContext *ctx, AVPacket *pkt) { - AVBSFInternal *in = ctx->internal; + AVBSFInternal *bsfi = ctx->internal; - if (in->eof) + if (bsfi->eof) return AVERROR_EOF; - if (!ctx->internal->buffer_pkt->data && - !ctx->internal->buffer_pkt->side_data_elems) + if (!bsfi->buffer_pkt->data && + !bsfi->buffer_pkt->side_data_elems) return AVERROR(EAGAIN); - av_packet_move_ref(pkt, ctx->internal->buffer_pkt); + av_packet_move_ref(pkt, bsfi->buffer_pkt); return 0; } |