[FFmpeg-devel] [PATCH] Add Apple HTTP Live Streaming protocol handler
Martin Storsjö
martin
Thu Aug 19 16:35:45 CEST 2010
On Wed, 18 Aug 2010, Michael Niedermayer wrote:
> On Wed, Aug 18, 2010 at 05:38:59PM +0300, Martin Storsj? wrote:
> [...]
> >
> > diff --git a/libavformat/internal.h b/libavformat/internal.h
> > index 6d3ec23..1b33fb1 100644
> > --- a/libavformat/internal.h
> > +++ b/libavformat/internal.h
> > @@ -192,4 +192,28 @@ int ff_get_line(ByteIOContext *s, char *buf, int maxlen);
> >
> > #define SPACE_CHARS " \t\r\n"
> >
> > +/**
> > + * Callback function type for ff_parse_key_value.
> > + *
> > + * @param key a pointer to the key
> > + * @param key_len the number of bytes that belong to the key, including the '='
> > + * char
> > + * @param dest return the destination pointer for the value in *dest, may
> > + * be null to ignore the value
> > + * @param dest_len the length of the *dest buffer
> > + */
> > +typedef void (*ff_parse_key_val_cb)(void *context, const char *key,
> > + int key_len, char **dest, int *dest_len);
> > +/**
> > + * Parse a string with comma-separated key=value pairs. The value strings
> > + * may be quoted and may contain escaped characters within quoted strings.
> > + *
> > + * @param str the string to parse
> > + * @param callback_get_buf function that returns where to store the
> > + * unescaped value string.
> > + * @param context the opaque context pointer to pass to callback_get_buf
> > + */
> > +void ff_parse_key_value(const char *str, ff_parse_key_val_cb callback_get_buf,
> > + void *context);
>
> maybe something here can be factored with the libavfilter command line parser
I had a look at the libavfilter parser, and while there are some
similarities (av_get_token from libavfilter/parseutils.c could be useful,
but it would need some modifications to allow tokens being quoted with
double quotes as in http and similar protocols (libavfilter uses single
quotes). That would still only replace a short part of what
ff_parse_key_value does (which already exists internally in
libavformat/httpauth.c). So I don't think it's worthwhile sharing it with
libavfilter at the moment.
// Martin
More information about the ffmpeg-devel
mailing list