[FFmpeg-devel] [PATCH] use new metadata API in mpegts

Måns Rullgård mans
Thu Feb 5 02:22:26 CET 2009


Aurelien Jacobs <aurel at gnuage.org> writes:

> Hi,
>
> The first 2 patches use the new metadata API respectively in the mpegts
> demuxer and muxer.
> The 3rd patch removes the av_set_program_name() function, which, despite his
> name, never was part of public API, and which is not used anymore.
>
> Aurel
>
> Index: libavformat/mpegts.c
> ===================================================================
> --- libavformat/mpegts.c	(revision 16826)
> +++ libavformat/mpegts.c	(working copy)
> @@ -652,7 +652,7 @@
>  
>          if (st) {
>              if (language[0] != 0) {
> -                memcpy(st->language, language, 4);
> +                av_metadata_set(&st->metadata, "language", language);
>              }
>  
>              if (stream_type == STREAM_TYPE_SUBTITLE_DVB) {
> @@ -778,8 +778,10 @@
>                  name = getstr8(&p, p_end);
>                  if (name) {
>                      AVProgram *program = av_new_program(ts->stream, sid);
> -                    if(program)
> -                        av_set_program_name(program, provider_name, name);
> +                    if(program) {
> +                        av_metadata_set(&program->metadata, "name", name);
> +                        av_metadata_set(&program->metadata, "provider_name", provider_name);
> +                    }
>                  }
>                  av_free(name);
>                  av_free(provider_name);

OK

> Index: libavformat/utils.c
> ===================================================================
> --- libavformat/utils.c	(revision 16826)
> +++ libavformat/utils.c	(working copy)
> @@ -2354,17 +2354,6 @@
>      return program;
>  }
>  
> -void av_set_program_name(AVProgram *program, char *provider_name, char *name)
> -{
> -    assert(!provider_name == !name);
> -    if(name){
> -        av_free(program->provider_name);
> -        av_free(program->         name);
> -        program->provider_name = av_strdup(provider_name);
> -        program->         name = av_strdup(         name);
> -    }
> -}
> -
>  AVChapter *ff_new_chapter(AVFormatContext *s, int id, AVRational time_base, int64_t start, int64_t end, const char *title)
>  {
>      AVChapter *chapter = NULL;
> Index: libavformat/internal.h
> ===================================================================
> --- libavformat/internal.h	(revision 16826)
> +++ libavformat/internal.h	(working copy)
> @@ -26,7 +26,6 @@
>  
>  char *ff_data_to_hex(char *buf, const uint8_t *src, int size);
>  
> -void av_set_program_name(AVProgram *program, char *provider_name, char *name);
>  void av_program_add_stream_index(AVFormatContext *ac, int progid, unsigned int idx);
>  
>  #endif /* AVFORMAT_INTERNAL_H */

OK with my, but I'm not maintainer of utils.c.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list