mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-01-04 21:25:40 +01:00
avcodec/internal: Allow receive_frame codecs to use decode_simple pkt
Decoders implementing the receive_frame API currently mostly use stack packets to temporarily hold the packet they receive from ff_decode_get_packet(). This role directly parallels the role of in_pkt, the spare packet used in decode_simple_internal for the decoders implementing the traditional decoding API. Said packet is unused by the generic code for the decoders implementing the receive_frame API, so allow them to use it to fulfill the function it already fulfills for the traditional API for both APIs. There is only one caveat in this: The packet is automatically unreferenced in avcodec_flush_buffers(). But this is actually positive as it means the decoders don't have to do this themselves (in case the packet is preserved between receive_frame calls). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@@ -112,10 +112,6 @@
|
||||
# define STRIDE_ALIGN 8
|
||||
#endif
|
||||
|
||||
typedef struct DecodeSimpleContext {
|
||||
AVPacket *in_pkt;
|
||||
} DecodeSimpleContext;
|
||||
|
||||
typedef struct EncodeSimpleContext {
|
||||
AVFrame *in_frame;
|
||||
} EncodeSimpleContext;
|
||||
@@ -137,7 +133,15 @@ typedef struct AVCodecInternal {
|
||||
|
||||
void *thread_ctx;
|
||||
|
||||
DecodeSimpleContext ds;
|
||||
/**
|
||||
* This packet is used to hold the packet given to decoders
|
||||
* implementing the .decode API; it is unused by the generic
|
||||
* code for decoders implementing the .receive_frame API and
|
||||
* may be freely used (but not freed) by them with the caveat
|
||||
* that the packet will be unreferenced generically in
|
||||
* avcodec_flush_buffers().
|
||||
*/
|
||||
AVPacket *in_pkt;
|
||||
AVBSFContext *bsf;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user