Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH] avcodec/internal: Hide stuff only used by the core decode API
Date: Wed, 11 May 2022 20:26:03 +0200
Message-ID: <DB6PR0101MB2214CE2C5A6A7BBDE6A7FFA58FC89@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com> (raw)
In-Reply-To: <DB6PR0101MB221441E04BE7DA936CAD823C8FC69@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com>

Andreas Rheinhardt:
> 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>
> ---
>  libavcodec/avcodec.c   | 1 +
>  libavcodec/cuviddec.c  | 1 +
>  libavcodec/decode.c    | 1 +
>  libavcodec/internal.h  | 6 ++----
>  libavcodec/libvpxenc.c | 1 +
>  5 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
> index d11f035481..f4ce6b8459 100644
> --- a/libavcodec/avcodec.c
> +++ b/libavcodec/avcodec.c
> @@ -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"
> diff --git a/libavcodec/cuviddec.c b/libavcodec/cuviddec.c
> index 81d4c89215..cb3cda7e24 100644
> --- a/libavcodec/cuviddec.c
> +++ b/libavcodec/cuviddec.c
> @@ -34,6 +34,7 @@
>  #include "libavutil/pixdesc.h"
>  
>  #include "avcodec.h"
> +#include "bsf.h"
>  #include "codec_internal.h"
>  #include "decode.h"
>  #include "hwconfig.h"
> diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> index 69e68ab09d..209585c540 100644
> --- a/libavcodec/decode.c
> +++ b/libavcodec/decode.c
> @@ -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"
> diff --git a/libavcodec/internal.h b/libavcodec/internal.h
> index 2fa56d3a59..17e1de8127 100644
> --- a/libavcodec/internal.h
> +++ b/libavcodec/internal.h
> @@ -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
> diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
> index e35b47b87e..187a9e9a36 100644
> --- a/libavcodec/libvpxenc.c
> +++ b/libavcodec/libvpxenc.c
> @@ -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"

Will apply this patchset tomorrow unless there are objections.

- Andreas
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

      parent reply	other threads:[~2022-05-11 18:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-09 21:18 Andreas Rheinhardt
2022-05-10  7:33 ` [FFmpeg-devel] [PATCH 2/3] avformat/internal: Move FFERROR_REDO to demux.h Andreas Rheinhardt
2022-05-10  7:33 ` [FFmpeg-devel] [PATCH 3/3] avformat/internal: Hide BSF stuff only used by the core APIs Andreas Rheinhardt
2022-05-11 18:26 ` Andreas Rheinhardt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DB6PR0101MB2214CE2C5A6A7BBDE6A7FFA58FC89@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com \
    --to=andreas.rheinhardt@outlook.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git