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-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH] avformat/async, cache: Use more unique context names
Date: Fri, 24 May 2024 08:24:58 +0200
Message-ID: <GV1P250MB0737A7C744279A99E356BFA28FF52@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <GV1P250MB073738AC4607986E8F762B268FEB2@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM>

Andreas Rheinhardt:
> Otherwise Doxygen thinks any text like "Context for foo"
> is a link to the async protocol's struct called "Context".
> 
> Reported-by: Andrew Sayers <ffmpeg-devel@pileofstuff.org>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavformat/async.c | 22 +++++++++++-----------
>  libavformat/cache.c | 18 +++++++++---------
>  2 files changed, 20 insertions(+), 20 deletions(-)
> 
> diff --git a/libavformat/async.c b/libavformat/async.c
> index e096b0bc6f..e0329e23ec 100644
> --- a/libavformat/async.c
> +++ b/libavformat/async.c
> @@ -53,7 +53,7 @@ typedef struct RingBuffer
>      int           read_pos;
>  } RingBuffer;
>  
> -typedef struct Context {
> +typedef struct AsyncContext {
>      AVClass        *class;
>      URLContext     *inner;
>  
> @@ -78,7 +78,7 @@ typedef struct Context {
>  
>      int             abort_request;
>      AVIOInterruptCB interrupt_callback;
> -} Context;
> +} AsyncContext;
>  
>  static int ring_init(RingBuffer *ring, unsigned int capacity, int read_back_capacity)
>  {
> @@ -132,7 +132,7 @@ static int ring_read(RingBuffer *ring, void *dest, int buf_size)
>  static int wrapped_url_read(void *src, void *dst, size_t *size)
>  {
>      URLContext *h   = src;
> -    Context    *c   = h->priv_data;
> +    AsyncContext *c = h->priv_data;
>      int         ret;
>  
>      ret = ffurl_read(c->inner, dst, *size);
> @@ -170,7 +170,7 @@ static int ring_drain(RingBuffer *ring, int offset)
>  static int async_check_interrupt(void *arg)
>  {
>      URLContext *h   = arg;
> -    Context    *c   = h->priv_data;
> +    AsyncContext *c = h->priv_data;
>  
>      if (c->abort_request)
>          return 1;
> @@ -184,7 +184,7 @@ static int async_check_interrupt(void *arg)
>  static void *async_buffer_task(void *arg)
>  {
>      URLContext   *h    = arg;
> -    Context      *c    = h->priv_data;
> +    AsyncContext *c    = h->priv_data;
>      RingBuffer   *ring = &c->ring;
>      int           ret  = 0;
>      int64_t       seek_ret;
> @@ -249,7 +249,7 @@ static void *async_buffer_task(void *arg)
>  
>  static int async_open(URLContext *h, const char *arg, int flags, AVDictionary **options)
>  {
> -    Context         *c = h->priv_data;
> +    AsyncContext *c = h->priv_data;
>      int              ret;
>      AVIOInterruptCB  interrupt_callback = {.callback = async_check_interrupt, .opaque = h};
>  
> @@ -316,7 +316,7 @@ fifo_fail:
>  
>  static int async_close(URLContext *h)
>  {
> -    Context *c = h->priv_data;
> +    AsyncContext *c = h->priv_data;
>      int      ret;
>  
>      pthread_mutex_lock(&c->mutex);
> @@ -339,7 +339,7 @@ static int async_close(URLContext *h)
>  
>  static int async_read_internal(URLContext *h, void *dest, int size)
>  {
> -    Context      *c       = h->priv_data;
> +    AsyncContext *c       = h->priv_data;
>      RingBuffer   *ring    = &c->ring;
>      int     read_complete = !dest;
>      int           to_read = size;
> @@ -391,7 +391,7 @@ static int async_read(URLContext *h, unsigned char *buf, int size)
>  
>  static int64_t async_seek(URLContext *h, int64_t pos, int whence)
>  {
> -    Context      *c    = h->priv_data;
> +    AsyncContext *c    = h->priv_data;
>      RingBuffer   *ring = &c->ring;
>      int64_t       ret;
>      int64_t       new_logical_pos;
> @@ -472,7 +472,7 @@ static int64_t async_seek(URLContext *h, int64_t pos, int whence)
>      return ret;
>  }
>  
> -#define OFFSET(x) offsetof(Context, x)
> +#define OFFSET(x) offsetof(AsyncContext, x)
>  #define D AV_OPT_FLAG_DECODING_PARAM
>  
>  static const AVOption options[] = {
> @@ -495,7 +495,7 @@ const URLProtocol ff_async_protocol = {
>      .url_read            = async_read,
>      .url_seek            = async_seek,
>      .url_close           = async_close,
> -    .priv_data_size      = sizeof(Context),
> +    .priv_data_size      = sizeof(AsyncContext),
>      .priv_data_class     = &async_context_class,
>  };
>  
> diff --git a/libavformat/cache.c b/libavformat/cache.c
> index 5f78adba9d..5d71e56f3d 100644
> --- a/libavformat/cache.c
> +++ b/libavformat/cache.c
> @@ -52,7 +52,7 @@ typedef struct CacheEntry {
>      int size;
>  } CacheEntry;
>  
> -typedef struct Context {
> +typedef struct CacheContext {
>      AVClass *class;
>      int fd;
>      char *filename;
> @@ -65,7 +65,7 @@ typedef struct Context {
>      URLContext *inner;
>      int64_t cache_hit, cache_miss;
>      int read_ahead_limit;
> -} Context;
> +} CacheContext;
>  
>  static int cmp(const void *key, const void *node)
>  {
> @@ -74,9 +74,9 @@ static int cmp(const void *key, const void *node)
>  
>  static int cache_open(URLContext *h, const char *arg, int flags, AVDictionary **options)
>  {
> +    CacheContext *c = h->priv_data;
>      int ret;
>      char *buffername;
> -    Context *c= h->priv_data;
>  
>      av_strstart(arg, "cache:", &arg);
>  
> @@ -99,7 +99,7 @@ static int cache_open(URLContext *h, const char *arg, int flags, AVDictionary **
>  
>  static int add_entry(URLContext *h, const unsigned char *buf, int size)
>  {
> -    Context *c= h->priv_data;
> +    CacheContext *c = h->priv_data;
>      int64_t pos = -1;
>      int ret;
>      CacheEntry *entry = NULL, *next[2] = {NULL, NULL};
> @@ -162,7 +162,7 @@ fail:
>  
>  static int cache_read(URLContext *h, unsigned char *buf, int size)
>  {
> -    Context *c= h->priv_data;
> +    CacheContext *c = h->priv_data;
>      CacheEntry *entry, *next[2] = {NULL, NULL};
>      int64_t r;
>  
> @@ -227,7 +227,7 @@ static int cache_read(URLContext *h, unsigned char *buf, int size)
>  
>  static int64_t cache_seek(URLContext *h, int64_t pos, int whence)
>  {
> -    Context *c= h->priv_data;
> +    CacheContext *c = h->priv_data;
>      int64_t ret;
>  
>      if (whence == AVSEEK_SIZE) {
> @@ -298,7 +298,7 @@ static int enu_free(void *opaque, void *elem)
>  
>  static int cache_close(URLContext *h)
>  {
> -    Context *c= h->priv_data;
> +    CacheContext *c = h->priv_data;
>      int ret;
>  
>      av_log(h, AV_LOG_INFO, "Statistics, cache hits:%"PRId64" cache misses:%"PRId64"\n",
> @@ -318,7 +318,7 @@ static int cache_close(URLContext *h)
>      return 0;
>  }
>  
> -#define OFFSET(x) offsetof(Context, x)
> +#define OFFSET(x) offsetof(CacheContext, x)
>  #define D AV_OPT_FLAG_DECODING_PARAM
>  
>  static const AVOption options[] = {
> @@ -339,6 +339,6 @@ const URLProtocol ff_cache_protocol = {
>      .url_read            = cache_read,
>      .url_seek            = cache_seek,
>      .url_close           = cache_close,
> -    .priv_data_size      = sizeof(Context),
> +    .priv_data_size      = sizeof(CacheContext),
>      .priv_data_class     = &cache_context_class,
>  };

Will apply 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".

      reply	other threads:[~2024-05-24  6:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-22 15:22 Andreas Rheinhardt
2024-05-24  6:24 ` 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=GV1P250MB0737A7C744279A99E356BFA28FF52@GV1P250MB0737.EURP250.PROD.OUTLOOK.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