Commit ee593bff authored by Andreas Rheinhardt's avatar Andreas Rheinhardt

avcodec/bsf: Use macro for "packet is empty"

Reviewed-by: 's avatarAnton Khirnov <anton@khirnov.net>
Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
parent 4e254ec6
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include "avcodec.h" #include "avcodec.h"
#include "bsf.h" #include "bsf.h"
#define IS_EMPTY(pkt) (!(pkt)->data && !(pkt)->side_data_elems)
struct AVBSFInternal { struct AVBSFInternal {
AVPacket *buffer_pkt; AVPacket *buffer_pkt;
int eof; int eof;
...@@ -195,7 +197,7 @@ int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt) ...@@ -195,7 +197,7 @@ int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)
AVBSFInternal *bsfi = ctx->internal; AVBSFInternal *bsfi = ctx->internal;
int ret; int ret;
if (!pkt || (!pkt->data && !pkt->side_data_elems)) { if (!pkt || IS_EMPTY(pkt)) {
bsfi->eof = 1; bsfi->eof = 1;
return 0; return 0;
} }
...@@ -205,8 +207,7 @@ int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt) ...@@ -205,8 +207,7 @@ int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
if (bsfi->buffer_pkt->data || if (!IS_EMPTY(bsfi->buffer_pkt))
bsfi->buffer_pkt->side_data_elems)
return AVERROR(EAGAIN); return AVERROR(EAGAIN);
ret = av_packet_make_refcounted(pkt); ret = av_packet_make_refcounted(pkt);
...@@ -230,8 +231,7 @@ int ff_bsf_get_packet(AVBSFContext *ctx, AVPacket **pkt) ...@@ -230,8 +231,7 @@ int ff_bsf_get_packet(AVBSFContext *ctx, AVPacket **pkt)
if (bsfi->eof) if (bsfi->eof)
return AVERROR_EOF; return AVERROR_EOF;
if (!bsfi->buffer_pkt->data && if (IS_EMPTY(bsfi->buffer_pkt))
!bsfi->buffer_pkt->side_data_elems)
return AVERROR(EAGAIN); return AVERROR(EAGAIN);
tmp_pkt = av_packet_alloc(); tmp_pkt = av_packet_alloc();
...@@ -251,8 +251,7 @@ int ff_bsf_get_packet_ref(AVBSFContext *ctx, AVPacket *pkt) ...@@ -251,8 +251,7 @@ int ff_bsf_get_packet_ref(AVBSFContext *ctx, AVPacket *pkt)
if (bsfi->eof) if (bsfi->eof)
return AVERROR_EOF; return AVERROR_EOF;
if (!bsfi->buffer_pkt->data && if (IS_EMPTY(bsfi->buffer_pkt))
!bsfi->buffer_pkt->side_data_elems)
return AVERROR(EAGAIN); return AVERROR(EAGAIN);
av_packet_move_ref(pkt, bsfi->buffer_pkt); av_packet_move_ref(pkt, bsfi->buffer_pkt);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment