[FFmpeg-devel] [PATCH] Add Apple HTTP Live Streaming protocol handler
Michael Niedermayer
michaelni
Tue Aug 17 19:19:18 CEST 2010
On Tue, Aug 17, 2010 at 04:15:20PM +0300, Martin Storsj? wrote:
> On Thu, 5 Aug 2010, Ronald S. Bultje wrote:
>
> > On Thu, Aug 5, 2010 at 4:09 PM, Martin Storsj? <martin at martin.st> wrote:
> > > On Wed, 4 Aug 2010, Ronald S. Bultje wrote:
> > >> On Tue, Jul 27, 2010 at 5:45 AM, Martin Storsj? <martin at martin.st> wrote:
> > >> [..]
> > >> > -static void handle_basic_params(HTTPAuthState *state, const char *key,
> > >> > +static void handle_basic_params(void *context, const char *key,
> > >> > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?int key_len, char **dest, int *dest_len)
> > >> > ?{
> > >> > + ? ?HTTPAuthState *state = context;
> > >> > ? ? ?if (!strncmp(key, "realm=", key_len)) {
> > >> > ? ? ? ? ?*dest ? ? = ? ? ? ?state->realm;
> > >> > ? ? ? ? ?*dest_len = sizeof(state->realm);
> > >> > ? ? ?}
> > >> > ?}
> > >> >
> > >> > -static void handle_digest_params(HTTPAuthState *state, const char *key,
> > >> > +static void handle_digest_params(void *context, const char *key,
> > >> > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? int key_len, char **dest, int *dest_len)
> > >> > ?{
> > >> > + ? ?HTTPAuthState *state = context;
> > >> > ? ? ?DigestParams *digest = &state->digest_params;
> > >> >
> > >> > ? ? ?if (!strncmp(key, "realm=", key_len)) {
> > >> > @@ -116,9 +62,10 @@ static void handle_digest_params(HTTPAuthState *state, const char *key,
> > >> > ? ? ?}
> > >> > ?}
> > >> >
> > >> > -static void handle_digest_update(HTTPAuthState *state, const char *key,
> > >> > +static void handle_digest_update(void *context, const char *key,
> > >> > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? int key_len, char **dest, int *dest_len)
> > >> > ?{
> > >> > + ? ?HTTPAuthState *state = context;
> > >> > ? ? ?DigestParams *digest = &state->digest_params;
> > >> >
> > >> > ? ? ?if (!strncmp(key, "nextnonce=", key_len)) {
> > >>
> > >> These extra lines should be avoidable by casting the function to a
> > >> proper type (a typedef helps here) when passing it to the function.
> > >> Other than that, this patch is OK, feel free to apply once #2 is OK'ed
> > >> also (since without it, this isn't needed).
> > >
> > > I tried doing this, but I'm not sure I agree it's prettier. The attached
> > > patch is the diff compared to the previous version. What do you think?
> >
> > I personally like it a lot better, but that's just me. If others
> > disagree violently, then let's not...
>
> Does anyone else have an opinion on this? That is, of these two variants,
> which one do you prefer:
>
> static void handle_basic_params(void *context, const char *key,
> int key_len, char **dest, int *dest_len)
> {
> HTTPAuthState *state = context;
> if (!strncmp(key, "realm=", key_len)) {
> *dest = state->realm;
> *dest_len = sizeof(state->realm);
> }
> }
>
> ff_parse_key_value(p, handle_basic_params, state);
>
> Or:
>
> static void handle_basic_params(HTTPAuthState *state, const char *key,
> int key_len, char **dest, int *dest_len)
> {
> if (!strncmp(key, "realm=", key_len)) {
> *dest = state->realm;
> *dest_len = sizeof(state->realm);
> }
> }
>
> ff_parse_key_value(p, (ff_parse_key_val_cb) handle_basic_params, state);
>
>
> That is, keeping the context pointer as an opaque void pointer that is
> cast within the callback function, or casting the whole function pointer
> using a typedef?
iam definitly prefering the handle_basic_params(HTTPAuthState *state
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The real ebay dictionary, page 1
"Used only once" - "Some unspecified defect prevented a second use"
"In good condition" - "Can be repaird by experienced expert"
"As is" - "You wouldnt want it even if you were payed for it, if you knew ..."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100817/df32e5ca/attachment.pgp>
More information about the ffmpeg-devel
mailing list