1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

avcodec/internal: Hide stuff only used by the core decode API

The general decoding API uses bitstream filters and an AVFifo
and therefore AVCodecInternal contains pointers to an AVBSFContext
and to an AVFifo and lavc/internal.h includes lavc/bsf.h and
lavu/fifo.h.
Yet actually, only two files are supposed to use these, namely
avcodec.c and (mainly) decode.c. For all the other files,
it should be an opaque type that they should not touch and that
they need not know anything about. This can be achieved by not
including these headers and using the structs instead of the
corresponding typedefs.
This also forces translation units that really use the BSF
and the FIFO APIs themselves to include the relevant headers
directly instead of relying on indirect inclusions (up until now,
even avcodec.c and decode.c relied on fifo.h to be included
by internal.h).
Of course, it also avoids unnecessary rebuilds when bsf.h or fifo.h
change.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2022-05-09 22:30:11 +02:00
parent e92e74b897
commit c19797bf59
5 changed files with 6 additions and 4 deletions

View File

@ -28,6 +28,7 @@
#include "libavutil/avstring.h"
#include "libavutil/bprint.h"
#include "libavutil/channel_layout.h"
#include "libavutil/fifo.h"
#include "libavutil/imgutils.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"

View File

@ -34,6 +34,7 @@
#include "libavutil/pixdesc.h"
#include "avcodec.h"
#include "bsf.h"
#include "codec_internal.h"
#include "decode.h"
#include "hwconfig.h"

View File

@ -32,6 +32,7 @@
#include "libavutil/bprint.h"
#include "libavutil/channel_layout.h"
#include "libavutil/common.h"
#include "libavutil/fifo.h"
#include "libavutil/frame.h"
#include "libavutil/hwcontext.h"
#include "libavutil/imgutils.h"

View File

@ -28,11 +28,9 @@
#include "libavutil/buffer.h"
#include "libavutil/channel_layout.h"
#include "libavutil/fifo.h"
#include "libavutil/mathematics.h"
#include "libavutil/pixfmt.h"
#include "avcodec.h"
#include "bsf.h"
#include "config.h"
#define FF_SANE_NB_CHANNELS 512U
@ -73,14 +71,14 @@ typedef struct AVCodecInternal {
* avcodec_flush_buffers().
*/
AVPacket *in_pkt;
AVBSFContext *bsf;
struct AVBSFContext *bsf;
/**
* Properties (timestamps+side data) extracted from the last packet passed
* for decoding.
*/
AVPacket *last_pkt_props;
AVFifo *pkt_props;
struct AVFifo *pkt_props;
/**
* temporary buffer used for encoders to store their bitstream

View File

@ -42,6 +42,7 @@
#include "libavutil/base64.h"
#include "libavutil/common.h"
#include "libavutil/cpu.h"
#include "libavutil/fifo.h"
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mathematics.h"