[FFmpeg-devel] [PATCH] ffserver: add stream Metadata option

Stefano Sabatini stefasab at gmail.com
Sun Dec 15 11:34:26 CET 2013


On date Saturday 2013-12-14 17:10:15 +0100, Michael Niedermayer encoded:
> On Fri, Nov 29, 2013 at 08:43:58AM +0100, Stefano Sabatini wrote:
> > Deprecate Author, Comment, Copyright, Title options.
> > 
> > Note that the old options (and the new), has no effect with FFM output
> > because the format does not export metadata.
> > ---
> >  doc/ffserver.texi |  6 +++++-
> >  ffserver.c        | 60 +++++++++++++++++++++++++++++++++----------------------
> >  2 files changed, 41 insertions(+), 25 deletions(-)
> > 
> > diff --git a/doc/ffserver.texi b/doc/ffserver.texi
> > index efaa664..290f6e0 100644
> > --- a/doc/ffserver.texi
> > +++ b/doc/ffserver.texi
> > @@ -451,7 +451,11 @@ for regular streams.
> >  @item Comment @var{value}
> >  @item Copyright @var{value}
> >  @item Title @var{value}
> > -Set metadata corresponding to the option.
> > +Set metadata corresponding to the option. All these options are
> > +deprecated in favor of @option{Metadata}.
> > +
> > + at item Metadata @var{key} @var{value}
> > +Set metadata value on the output stream.
> >  
> >  @item NoAudio
> >  @item NoVideo
> > diff --git a/ffserver.c b/ffserver.c
> > index 6ce09c4..f9efaf7 100644
> > --- a/ffserver.c
> > +++ b/ffserver.c
> > @@ -216,6 +216,7 @@ typedef struct FFStream {
> >      struct FFStream *feed;   /* feed we are using (can be null if
> >                                  coming from file) */
> >      AVDictionary *in_opts;   /* input parameters */
> > +    AVDictionary *metadata;  /* metadata to set on the stream */
> >      AVInputFormat *ifmt;       /* if non NULL, force input format */
> >      AVOutputFormat *fmt;
> >      IPAddressACL *acl;
> > @@ -228,10 +229,6 @@ typedef struct FFStream {
> >      int feed_streams[MAX_STREAMS]; /* index of streams in the feed */
> >      char feed_filename[1024]; /* file name of the feed storage, or
> >                                   input file name for a stream */
> > -    char author[512];
> > -    char title[512];
> > -    char copyright[512];
> > -    char comment[512];
> >      pid_t pid;  /* Of ffmpeg process */
> >      time_t pid_start;  /* Of ffmpeg process */
> >      char **child_argv;
> > @@ -2279,11 +2276,7 @@ static int http_prepare_data(HTTPContext *c)
> >      switch(c->state) {
> >      case HTTPSTATE_SEND_DATA_HEADER:
> >          memset(&c->fmt_ctx, 0, sizeof(c->fmt_ctx));
> > -        av_dict_set(&c->fmt_ctx.metadata, "author"   , c->stream->author   , 0);
> > -        av_dict_set(&c->fmt_ctx.metadata, "comment"  , c->stream->comment  , 0);
> > -        av_dict_set(&c->fmt_ctx.metadata, "copyright", c->stream->copyright, 0);
> > -        av_dict_set(&c->fmt_ctx.metadata, "title"    , c->stream->title    , 0);
> > -
> > +        av_dict_copy(&(c->fmt_ctx.metadata), c->stream->metadata, 0);
> >          c->fmt_ctx.streams = av_mallocz(sizeof(AVStream *) * c->stream->nb_streams);
> >  
> >          for(i=0;i<c->stream->nb_streams;i++) {
> > @@ -2991,6 +2984,7 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer,
> >      AVFormatContext *avc;
> >      AVStream *avs = NULL;
> >      AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL);
> > +    AVDictionaryEntry *entry = av_dict_get(stream->metadata, "title", NULL, 0);
> >      int i;
> >  
> >      avc =  avformat_alloc_context();
> > @@ -2999,7 +2993,7 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer,
> >      }
> >      avc->oformat = rtp_format;
> >      av_dict_set(&avc->metadata, "title",
> > -               stream->title[0] ? stream->title : "No Title", 0);
> > +               entry->key[0] ? entry->key : "No Title", 0);
> 
> entry can be NULL here i think

Changed.
-- 
FFmpeg = Funny and Fundamentalist Muttering Patchable Enhanced God
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-ffserver-add-stream-Metadata-option.patch
Type: text/x-diff
Size: 6351 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20131215/f7bb60c3/attachment.bin>


More information about the ffmpeg-devel mailing list