Commit 7916202b authored by Georgi Chorbadzhiyski's avatar Georgi Chorbadzhiyski Committed by Michael Niedermayer

Add service_provider and service_name metadata

This patch adds support in mpegts muxer for using service_provider and
service_name metadata to set service_provider_name and service_name
fields in SDT.

Example usage:
   ffmpeg -i file.ts -f mpegts -re -acodec copy -vcodec copy -f mpegts \
       -metadata service_provider="Some provider" \
       -metadata service_name="Some Channel" \
       "udp://239.0.70.2:5000?pkt_size=1316&ttl=1"
Signed-off-by: 's avatarMans Rullgard <mans@mansr.com>
(cherry picked from commit 69688e71)
parent e25f19a1
......@@ -161,6 +161,8 @@ struct AVFormatContext;
* E.g for "Also sprach Zarathustra", artist would be "Richard
* Strauss" and performer "London Philharmonic Orchestra".
* publisher -- name of the label/publisher.
* service_name -- name of the service in broadcasting (channel name).
* service_provider -- name of the service provider in broadcasting.
* title -- name of the work.
* track -- number of this work in the set, can be in form current/total.
*/
......
......@@ -391,18 +391,22 @@ static int mpegts_write_header(AVFormatContext *s)
MpegTSWriteStream *ts_st;
MpegTSService *service;
AVStream *st, *pcr_st = NULL;
AVMetadataTag *title;
AVMetadataTag *title, *provider;
int i, j;
const char *service_name;
const char *provider_name;
int *pids;
ts->tsid = DEFAULT_TSID;
ts->onid = DEFAULT_ONID;
/* allocate a single DVB service */
title = av_metadata_get(s->metadata, "title", NULL, 0);
if (!title)
title = av_metadata_get(s->metadata, "service_name", NULL, 0);
service_name = title ? title->value : DEFAULT_SERVICE_NAME;
service = mpegts_add_service(ts, DEFAULT_SID,
DEFAULT_PROVIDER_NAME, service_name);
provider = av_metadata_get(s->metadata, "service_provider", NULL, 0);
provider_name = provider ? provider->value : DEFAULT_PROVIDER_NAME;
service = mpegts_add_service(ts, DEFAULT_SID, provider_name, service_name);
service->pmt.write_packet = section_write_packet;
service->pmt.opaque = s;
service->pmt.cc = 15;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment