[FFmpeg-devel] [PATCH 1/7] [GSoC] lavf: add directory listing API

Michael Niedermayer michaelni at gmx.at
Fri Mar 20 23:26:34 CET 2015

On Fri, Mar 20, 2015 at 10:31:56PM +0100, Lukasz Marek wrote:
> On 20.03.2015 14:55, Michael Niedermayer wrote:
> >On Fri, Mar 20, 2015 at 03:01:56AM +0100, Mariusz Szczepańczyk wrote:
> >>From: Lukasz Marek <lukasz.m.luki2 at gmail.com>
> >>  /**
> >>+ * Open directory for reading.
> >>+ *
> >>+ * @param s       directory read context. Pointer to a NULL pointer must be passed.
> >>+ * @param url     directory to be listed.
> >>+ * @param options protocol options.
> >>+ * @return >=0 on success or negative on error.
> >>+ */
> >>+int avio_open_dir(void **s, const char *url, AVDictionary **options);
> >
> >why void ** ? and not a more specific type ?
> >a more specific type would allow the compiler to check types
> I can't remember exactly why, but as far as I remember
> it could be URLContext, but it is not a public struct.

> Also, creating dummy struct, to have it stored as void * inside is
> not much better, but maybe it is. (the same as AVIOContext stores it
> in void *opaque)

I think the type should not be void ** when in fact theres only one
type that is valid and allowed
Its different if it would be intended to allow multiple types

The goal is that a user application cannot mistakely pass the wrong
If a struct was used, the layout of that struct does not need to be
defined in a public header so it can be a URLContext

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The educated differ from the uneducated as much as the living from the
dead. -- Aristotle 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150320/180fb76a/attachment.asc>

More information about the ffmpeg-devel mailing list