[FFmpeg-devel] PATCH: mpegtsenc.c

Måns Rullgård mans
Wed Jan 19 03:02:59 CET 2011


JULIAN GARDNER <joolzg at btinternet.com> writes:

> Hi new user here.
>
> I have the following patch which allows the user through the
> --metadata to also change the provider name on TS files, a bit like
> the title option changes the service name.
>
> Index: libavformat/mpegtsenc.c
> ===================================================================
> --- libavformat/mpegtsenc.c	(revision 25941)
> +++ libavformat/mpegtsenc.c	(working copy)
> @@ -392,17 +392,22 @@
>      MpegTSService *service;
>      AVStream *st, *pcr_st = NULL;
>      AVMetadataTag *title;
> +    AVMetadataTag *program;
>      int i, j;
>      const char *service_name;
> +    const char *program_name;
>      int *pids;
> +	int default_pid = DEFAULT_START_PID;

That line doesn't belong.

>      ts->tsid = DEFAULT_TSID;
>      ts->onid = DEFAULT_ONID;
>      /* allocate a single DVB service */
>      title = av_metadata_get(s->metadata, "title", NULL, 0);
>      service_name = title ? title->value : DEFAULT_SERVICE_NAME;
> +    program = av_metadata_get(s->metadata, "program", NULL, 0);
> +    program_name = program ? program->value : DEFAULT_PROVIDER_NAME;
>      service = mpegts_add_service(ts, DEFAULT_SID,
> -                                 DEFAULT_PROVIDER_NAME, service_name);
> +                                 program_name, service_name);
>      service->pmt.write_packet = section_write_packet;
>      service->pmt.opaque = s;
>      service->pmt.cc = 15;

This change looks sane as far as the code goes.  However, I'm not
sure "program" is the best choice of tag name.  Perhaps someone with
a fresher memory of DVB specs and practices can comment.

> @@ -432,7 +437,7 @@
>          /* MPEG pid values < 16 are reserved. Applications which set st->id in
>           * this range are assigned a calculated pid. */
>          if (st->id < 16) {
> -            ts_st->pid = DEFAULT_START_PID + i;
> +            ts_st->pid = default_pid + i;
>          } else if (st->id < 0x1FFF) {
>              ts_st->pid = st->id;
>          } else {

Unrelated.

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



More information about the ffmpeg-devel mailing list