[FFmpeg-devel] [PATCH] http: add support for reading streamcast metadata

Stefano Sabatini stefasab at gmail.com
Wed Jun 26 01:36:59 CEST 2013


On date Wednesday 2013-06-26 01:20:52 +0200, wm4 encoded:
> Allow applications to request reading streamcast metadata. This uses
> AVOptions as API, and requires the application to explicitly request
> and read metadata. Metadata can be updated mid-stream; if an
> application is interested in that, it has to poll for the data by
> reading the "icy_meta_packet" option in regular intervals.
> 
> There doesn't seem to be a nice way to transfer the metadata in a nicer
> way. Converting the metadata to ID3v2 tags might be a nice idea, but
> the libavformat mp3 demuxer doesn't seem to read these tags mid-stream,
> and even then we couldn't guarantee that tags are not inserted in the
> middle of mp3 packet data.
> 
> This commit provides the minimum to enable applications to retrieve
> this information at all.
> ---
>  libavformat/http.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 53 insertions(+)
> 
> diff --git a/libavformat/http.c b/libavformat/http.c
> index 91f8d1f..d29822a 100644
> --- a/libavformat/http.c
> +++ b/libavformat/http.c
> @@ -28,6 +28,7 @@
>  #include "httpauth.h"
>  #include "url.h"
>  #include "libavutil/opt.h"
> +#include "libavutil/bprint.h"
>  
>  /* XXX: POST protocol is not completely implemented because ffmpeg uses
>     only a subset of it. */
> @@ -49,6 +50,8 @@ typedef struct {
>      char *content_type;
>      char *user_agent;
>      int64_t off, filesize;
> +    int icy_data_read;
> +    int icy_metaint;
>      char location[MAX_URL_SIZE];
>      HTTPAuthState auth_state;
>      HTTPAuthState proxy_auth_state;
> @@ -65,6 +68,9 @@ typedef struct {
>      int rw_timeout;
>      char *mime_type;
>      char *cookies;          ///< holds newline (\n) delimited Set-Cookie header field values (without the "Set-Cookie: " field name)
> +    int icy;
> +    char *icy_meta_header;
> +    char *icy_meta_packet;
>  } HTTPContext;
>  
>  #define OFFSET(x) offsetof(HTTPContext, x)
> @@ -82,6 +88,9 @@ static const AVOption options[] = {
>  {"timeout", "set timeout of socket I/O operations", OFFSET(rw_timeout), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, D|E },
>  {"mime_type", "set MIME type", OFFSET(mime_type), AV_OPT_TYPE_STRING, {0}, 0, 0, 0 },
>  {"cookies", "set cookies to be sent in applicable future requests, use newline delimited Set-Cookie HTTP field value syntax", OFFSET(cookies), AV_OPT_TYPE_STRING, {0}, 0, 0, 0 },

> +{"icy", "request ICY metadata", OFFSET(icy), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, D },
> +{"icy_meta_header", "return ICY metadata header", OFFSET(icy_meta_header), AV_OPT_TYPE_STRING, {0}, 0, 0, 0 },
> +{"icy_meta_packet", "return current ICY metadata packet", OFFSET(icy_meta_packet), AV_OPT_TYPE_STRING, {0}, 0, 0, 0 },

missing doc updates, especially considering that what these options do
is not very clear at least to me.

[...]
-- 
FFmpeg = Fundamental and Forgiving MultiPurpose Erudite Geek


More information about the ffmpeg-devel mailing list