[Ffmpeg-devel] mpegts pid values

Måns Rullgård mru
Mon Jul 18 09:55:10 CEST 2005


Nicolas Roussel said:
> Hi,
>
> I'd like to be able to specify the pid used by each MpegTSWriteStream
> of an MPEG transport stream.
>
> I thought I could use the sub_id field of the AVCodecContext for that.
> Is that ok?
>
> Here's the change I propose:

Index: libavformat/mpegtsenc.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/mpegtsenc.c,v
retrieving revision 1.9
diff -u -r1.9 mpegtsenc.c
--- libavformat/mpegtsenc.c	17 Jul 2005 22:24:35 -0000	1.9
+++ libavformat/mpegtsenc.c	18 Jul 2005 00:26:45 -0000
@@ -449,7 +449,10 @@
             goto fail;
         st->priv_data = ts_st;
         ts_st->service = service;
-        ts_st->pid = DEFAULT_START_PID + i;
+	   if (st->codec->sub_id)
+		ts_st->pid = st->codec->sub_id ;
+	   else
+		ts_st->pid = DEFAULT_START_PID + i;
         ts_st->payload_pts = AV_NOPTS_VALUE;
         /* update PCR pid by using the first video stream */
         if (st->codec->codec_type == CODEC_TYPE_VIDEO &&

Unacceptable.  AVCodecContext fields are for codec information, noting else.
Use AVStream.id instead.

-- 
M?ns Rullg?rd
mru at inprovide.com





More information about the ffmpeg-devel mailing list