[Live-devel] Separating Transport Stream IDs from PES IDs

Piers Hawksley piers.hawksley at panogenics.com
Tue Jun 17 09:44:35 PDT 2014


Hi Ross,

Attached are patches to 4 files (MPEG2TransportStreamFromESSource.cpp/hh 
& MPEG2TransportStreamMultiplexor.cpp/hh). These changes allow 
addNewVideoSource and addNewAudioSource to be called with an optional 
third parameter streamId. If this is set to a value other than -1 the 
PES ID and Stream ID are set differently. If not, current behaviour 
(Stream ID = PES ID) remains.

I have coded this to take a 16 bit integer to allow for a default value 
outside the range that would be chosen (-1) and to allow for the code to 
be extended to accept 12 bit stream IDs in the future. It is currently 
limited to 8 bit Stream IDs.

Please consider this small change for inclusion in your code. I'm happy 
to clarify / answer any questions / resubmit with changes.

Many Thanks,

Piers Hawksley
-------------- next part --------------
35c35
< 		      u_int8_t pesId, int mpegVersion,
---
> 		      u_int8_t streamId, int mpegVersion,
65c65
<   u_int8_t fPESid;
---
>   u_int8_t fStreamId;
82,84c82,84
< ::addNewVideoSource(FramedSource* inputSource, int mpegVersion, int16_t streamId) {
<   u_int8_t pesId = 0xE0 | (fVideoSourceCounter++&0x0F);
<   addNewInputSource(inputSource, pesId, mpegVersion, streamId);
---
> ::addNewVideoSource(FramedSource* inputSource, int mpegVersion) {
>   u_int8_t streamId = 0xE0 | (fVideoSourceCounter++&0x0F);
>   addNewInputSource(inputSource, streamId, mpegVersion);
89,91c89,91
< ::addNewAudioSource(FramedSource* inputSource, int mpegVersion, int16_t streamId) {
<   u_int8_t pesId = 0xC0 | (fAudioSourceCounter++&0x0F);
<   addNewInputSource(inputSource, pesId, mpegVersion, streamId);
---
> ::addNewAudioSource(FramedSource* inputSource, int mpegVersion) {
>   u_int8_t streamId = 0xC0 | (fAudioSourceCounter++&0x0F);
>   addNewInputSource(inputSource, streamId, mpegVersion);
146c146
< 		    u_int8_t pesId, int mpegVersion, int16_t streamId) {
---
> 		    u_int8_t streamId, int mpegVersion) {
148,152c148
<   if (streamId == -1)
<     fStreamId = pesId;
<   else
<     fStreamId = streamId;
<   fInputSources = new InputESSourceRecord(*this, inputSource, pesId,
---
>   fInputSources = new InputESSourceRecord(*this, inputSource, streamId,
162c158
< 		      u_int8_t pesId, int mpegVersion,
---
> 		      u_int8_t streamId, int mpegVersion,
165c161
<     fPESid(pesId), fMPEGVersion(mpegVersion) {
---
>     fStreamId(streamId), fMPEGVersion(mpegVersion) {
182c178
<     fInputBuffer[3] = fPESid;
---
>     fInputBuffer[3] = fStreamId;
-------------- next part --------------
62d61
<   u_int8_t fStreamId;	// Should this be 16 bit signed
74c73
<       // Note: We used to map 8-bit stream_ids directly to PIDs
---
>       // Note: We map 8-bit stream_ids directly to PIDs
-------------- next part --------------
109c109
<     fCurrentPID = fStreamId;
---
>     fCurrentPID = stream_id;
-------------- next part --------------
33c33
<   void addNewVideoSource(FramedSource* inputSource, int mpegVersion, int16_t streamId = -1);
---
>   void addNewVideoSource(FramedSource* inputSource, int mpegVersion);
35c35
<   void addNewAudioSource(FramedSource* inputSource, int mpegVersion, int16_t streamId = -1);
---
>   void addNewAudioSource(FramedSource* inputSource, int mpegVersion);
43c43
< 			 u_int8_t pesId, int mpegVersion, int16_t streamId = -1);
---
> 			 u_int8_t streamId, int mpegVersion);


More information about the live-devel mailing list