Re: [FFmpeg-devel] [PATCH 1/3] lavu: add a template for refcounted objects.

2020-07-06 Thread Alexander Strasser
Hi all! On 2020-07-01 17:05 +0200, Anton Khirnov wrote: > Quoting Nicolas George (2020-06-27 17:16:44) > > Signed-off-by: Nicolas George > > --- > > libavutil/avrefcount_template.h | 140 > > tests/ref/fate/source | 1 + > > 2 files changed, 141 inser

Re: [FFmpeg-devel] [PATCH 1/3] lavu: add a template for refcounted objects.

2020-07-03 Thread Anton Khirnov
Quoting James Almer (2020-07-01 20:20:32) > On 7/1/2020 12:05 PM, Anton Khirnov wrote: > > Quoting Nicolas George (2020-06-27 17:16:44) > >> Signed-off-by: Nicolas George > >> --- > >> libavutil/avrefcount_template.h | 140 > >> tests/ref/fate/source |

Re: [FFmpeg-devel] [PATCH 1/3] lavu: add a template for refcounted objects.

2020-07-01 Thread Lynne
Jul 1, 2020, 19:20 by jamr...@gmail.com: > On 7/1/2020 12:05 PM, Anton Khirnov wrote: > >> Quoting Nicolas George (2020-06-27 17:16:44) >> >>> Signed-off-by: Nicolas George >>> --- >>> libavutil/avrefcount_template.h | 140 >>> tests/ref/fate/source |

Re: [FFmpeg-devel] [PATCH 1/3] lavu: add a template for refcounted objects.

2020-07-01 Thread Nicolas George
Anton Khirnov (12020-07-01): > You do not dereference buf->opaque. You pass it to the free callback > when the refcount reaches zero, that is the only way it should ever be > used. You are talking about the implementation of the refcounted structure. I was talking about when we use the refcounted

Re: [FFmpeg-devel] [PATCH 1/3] lavu: add a template for refcounted objects.

2020-07-01 Thread Nicolas George
James Almer (12020-07-01): > I very much prefer this approach, being clean looking, public, and free > of macros from unguarded headers Please do not forget the major drawback: This version makes the creation of the refcounted structure simpler, and every single use more complex. One creation, m

Re: [FFmpeg-devel] [PATCH 1/3] lavu: add a template for refcounted objects.

2020-07-01 Thread Anton Khirnov
Quoting Nicolas George (2020-07-01 18:47:15) > Anton Khirnov (12020-07-01): > > instead of > > #define AVRC_TYPE AVBuffer > > #define AVRC_PREFIX prefix > > #define AVRC_FIELD refcount > > you'd have > > av_refcount_init(&buf->refcount, buf, buffer_free); > > Does not look more annoying to me, to t

Re: [FFmpeg-devel] [PATCH 1/3] lavu: add a template for refcounted objects.

2020-07-01 Thread James Almer
On 7/1/2020 12:05 PM, Anton Khirnov wrote: > Quoting Nicolas George (2020-06-27 17:16:44) >> Signed-off-by: Nicolas George >> --- >> libavutil/avrefcount_template.h | 140 >> tests/ref/fate/source | 1 + >> 2 files changed, 141 insertions(+) >> create

Re: [FFmpeg-devel] [PATCH 1/3] lavu: add a template for refcounted objects.

2020-07-01 Thread Nicolas George
Anton Khirnov (12020-07-01): > instead of > #define AVRC_TYPE AVBuffer > #define AVRC_PREFIX prefix > #define AVRC_FIELD refcount > you'd have > av_refcount_init(&buf->refcount, buf, buffer_free); > Does not look more annoying to me, to the contrary macro templates > require more effort to understa

Re: [FFmpeg-devel] [PATCH 1/3] lavu: add a template for refcounted objects.

2020-07-01 Thread Anton Khirnov
Quoting Nicolas George (2020-07-01 17:13:22) > Anton Khirnov (12020-07-01): > > Why a template? It seems simpler to add a struct like > > typedef struct AVRefcount { > > atomic_uint refcount; > > void *opaque; > > void (*free)(void *opaque); > > } AVRefcount; > > and then emb

Re: [FFmpeg-devel] [PATCH 1/3] lavu: add a template for refcounted objects.

2020-07-01 Thread Nicolas George
Anton Khirnov (12020-07-01): > Why a template? It seems simpler to add a struct like > typedef struct AVRefcount { > atomic_uint refcount; > void *opaque; > void (*free)(void *opaque); > } AVRefcount; > and then embed it in everything that wants to be refcounted. All just > n

Re: [FFmpeg-devel] [PATCH 1/3] lavu: add a template for refcounted objects.

2020-07-01 Thread Anton Khirnov
Quoting Nicolas George (2020-06-27 17:16:44) > Signed-off-by: Nicolas George > --- > libavutil/avrefcount_template.h | 140 > tests/ref/fate/source | 1 + > 2 files changed, 141 insertions(+) > create mode 100644 libavutil/avrefcount_template.h > >