It will be useful in other places.
Unified · Split
| @@ -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 | ||
| 37 | static av_always_inline const FFBitStreamFilter *ff_bsf(const AVBitStreamFilter *bsf) | 36 | static 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); |
| @@ -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 | |||
| 26 | typedef struct PacketListEntry { | 28 | typedef struct PacketListEntry { |
| 27 | struct PacketListEntry *next; | 29 | struct PacketListEntry *next; |
| 28 | AVPacket pkt; | 30 | AVPacket pkt; |