History

lavc/bsf: move IS_EMPTY() to packet_internal()

It will be useful in other places.

Anton Khirnov committed 3 years ago

Commit 0f957cf1 parent c4332df2 files · +7 −6Browse files

Unified · Split

2 files
  1. libavcodec/bsf.c +5 −6
  2. libavcodec/packet_internal.h +2 −0
libavcodec/bsf.c+5−6
@@ -31,8 +31,7 @@ · 30 unmodified lines
31#include "bsf_internal.h"31#include "bsf_internal.h"
32#include "codec_desc.h"32#include "codec_desc.h"
33#include "codec_par.h"33#include "codec_par.h"
34 34#include "packet_internal.h"
35#define IS_EMPTY(pkt) (!(pkt)->data && !(pkt)->side_data_elems)
36 35
37static av_always_inline const FFBitStreamFilter *ff_bsf(const AVBitStreamFilter *bsf)36static av_always_inline const FFBitStreamFilter *ff_bsf(const AVBitStreamFilter *bsf)
38{37{
@@ -205,7 +204,7 @@ int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt) · 166 unmodified lines
205 FFBSFContext *const bsfi = ffbsfcontext(ctx);204 FFBSFContext *const bsfi = ffbsfcontext(ctx);
206 int ret;205 int ret;
207 206
208 if (!pkt || IS_EMPTY(pkt)) {207 if (!pkt || AVPACKET_IS_EMPTY(pkt)) {
209 if (pkt)208 if (pkt)
210 av_packet_unref(pkt);209 av_packet_unref(pkt);
211 bsfi->eof = 1;210 bsfi->eof = 1;
@@ -217,7 +216,7 @@ int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt) · 5 unmodified lines
217 return AVERROR(EINVAL);216 return AVERROR(EINVAL);
218 }217 }
219 218
220 if (!IS_EMPTY(bsfi->buffer_pkt))219 if (!AVPACKET_IS_EMPTY(bsfi->buffer_pkt))
221 return AVERROR(EAGAIN);220 return AVERROR(EAGAIN);
222 221
223 ret = av_packet_make_refcounted(pkt);222 ret = av_packet_make_refcounted(pkt);
@@ -241,7 +240,7 @@ int ff_bsf_get_packet(AVBSFContext *ctx, AVPacket **pkt) · 17 unmodified lines
241 if (bsfi->eof)240 if (bsfi->eof)
242 return AVERROR_EOF;241 return AVERROR_EOF;
243 242
244 if (IS_EMPTY(bsfi->buffer_pkt))243 if (AVPACKET_IS_EMPTY(bsfi->buffer_pkt))
245 return AVERROR(EAGAIN);244 return AVERROR(EAGAIN);
246 245
247 tmp_pkt = av_packet_alloc();246 tmp_pkt = av_packet_alloc();
@@ -261,7 +260,7 @@ int ff_bsf_get_packet_ref(AVBSFContext *ctx, AVPacket *pkt) · 13 unmodified lines
261 if (bsfi->eof)260 if (bsfi->eof)
262 return AVERROR_EOF;261 return AVERROR_EOF;
263 262
264 if (IS_EMPTY(bsfi->buffer_pkt))263 if (AVPACKET_IS_EMPTY(bsfi->buffer_pkt))
265 return AVERROR(EAGAIN);264 return AVERROR(EAGAIN);
266 265
267 av_packet_move_ref(pkt, bsfi->buffer_pkt);266 av_packet_move_ref(pkt, bsfi->buffer_pkt);
libavcodec/packet_internal.h+2−0
@@ -23,6 +23,8 @@ · 22 unmodified lines
23 23
24#include "packet.h"24#include "packet.h"
25 25
26#define AVPACKET_IS_EMPTY(pkt) (!(pkt)->data && !(pkt)->side_data_elems)
27
26typedef struct PacketListEntry {28typedef struct PacketListEntry {
27 struct PacketListEntry *next;29 struct PacketListEntry *next;
28 AVPacket pkt;30 AVPacket pkt;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t