diff mbox series

[FFmpeg-devel,v2,08/10] lavc/bsf: move IS_EMPTY() to packet_internal()

Message ID 20230703193229.8593-9-anton@khirnov.net
State Accepted
Commit 0f957cfba2dc83c9cfa9dc494052836ebbbdfd78
Headers show
Series lavc generic-layer private data | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Anton Khirnov July 3, 2023, 7:32 p.m. UTC
It will be useful in other places.
---
 libavcodec/bsf.c             | 11 +++++------
 libavcodec/packet_internal.h |  2 ++
 2 files changed, 7 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c
index 42cc1b5ab0..1e710f7d4a 100644
--- a/libavcodec/bsf.c
+++ b/libavcodec/bsf.c
@@ -31,8 +31,7 @@ 
 #include "bsf_internal.h"
 #include "codec_desc.h"
 #include "codec_par.h"
-
-#define IS_EMPTY(pkt) (!(pkt)->data && !(pkt)->side_data_elems)
+#include "packet_internal.h"
 
 static av_always_inline const FFBitStreamFilter *ff_bsf(const AVBitStreamFilter *bsf)
 {
@@ -205,7 +204,7 @@  int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)
     FFBSFContext *const bsfi = ffbsfcontext(ctx);
     int ret;
 
-    if (!pkt || IS_EMPTY(pkt)) {
+    if (!pkt || AVPACKET_IS_EMPTY(pkt)) {
         if (pkt)
             av_packet_unref(pkt);
         bsfi->eof = 1;
@@ -217,7 +216,7 @@  int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)
         return AVERROR(EINVAL);
     }
 
-    if (!IS_EMPTY(bsfi->buffer_pkt))
+    if (!AVPACKET_IS_EMPTY(bsfi->buffer_pkt))
         return AVERROR(EAGAIN);
 
     ret = av_packet_make_refcounted(pkt);
@@ -241,7 +240,7 @@  int ff_bsf_get_packet(AVBSFContext *ctx, AVPacket **pkt)
     if (bsfi->eof)
         return AVERROR_EOF;
 
-    if (IS_EMPTY(bsfi->buffer_pkt))
+    if (AVPACKET_IS_EMPTY(bsfi->buffer_pkt))
         return AVERROR(EAGAIN);
 
     tmp_pkt = av_packet_alloc();
@@ -261,7 +260,7 @@  int ff_bsf_get_packet_ref(AVBSFContext *ctx, AVPacket *pkt)
     if (bsfi->eof)
         return AVERROR_EOF;
 
-    if (IS_EMPTY(bsfi->buffer_pkt))
+    if (AVPACKET_IS_EMPTY(bsfi->buffer_pkt))
         return AVERROR(EAGAIN);
 
     av_packet_move_ref(pkt, bsfi->buffer_pkt);
diff --git a/libavcodec/packet_internal.h b/libavcodec/packet_internal.h
index 92a0d4e6d5..52fa6d9be9 100644
--- a/libavcodec/packet_internal.h
+++ b/libavcodec/packet_internal.h
@@ -23,6 +23,8 @@ 
 
 #include "packet.h"
 
+#define AVPACKET_IS_EMPTY(pkt) (!(pkt)->data && !(pkt)->side_data_elems)
+
 typedef struct PacketListEntry {
     struct PacketListEntry *next;
     AVPacket pkt;