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

Piers Hawksley piers.hawksley at panogenics.com
Mon Jun 30 09:37:40 PDT 2014


Hi Ross,

Now that I more fully understand how Packetized Elementary Streams are 
fed into the transport stream multiplexor, may I provide one final patch 
that extends the Elementary Stream interface to the transport stream 
multiplexor to allow Packet IDs to be set separately from the stream 
IDs, but preserves the Packetized Elementary Stream interface.

This patch extends MPEG2TransportStreamMultiplexor::handleNewBuffer with 
a default variable, PID (the transport stream Packet ID). If this is not 
present (e.g when the MPEG2TransportStreamFromPESSource subclass calls 
it) the current behaviour is maintained. If this is present, the PID is 
used in place of the stream_id for the Packet ID for the buffer being 
handled.

The patch includes the addition of default variables to 
InputESSourceRecord::InputESSourceRecord, 
MPEG2TransportStreamFromESSource::addNewInputSource, 
MPEG2TransportStreamFromESSource::addNewAudioSource and 
MPEG2TransportStreamFromESSource::addNewVideoSource in 
MPEG2TransportStreamFromESSource.cpp/.hh to allow the Packet ID to be 
set for each Video / Audio source at the time it it added. Again the 
default behaviour is to use the Elementary Stream stream_id calculated 
in addNewVideoSource / addNewAudioSource. Each instance of the 
InputESSourceRecord class maintains its own stream ID (fStreamId) and 
Packet ID (fPID).

I hope you are able to review and accept this patch (I am sorry for not 
understanding the full picture when sending in earlier patches and thus 
wasting your time reviewing them) as we have an installed set of 
hardware decoders that require a specific packet ID in order to 
function. We are reluctant to modify your code (with a much simpler fix 
that only works for our specific usage), so hope that this fix is 
general enough and of potential interest to other Live555 users.

Best Regards,

Piers
AMG Signature

-------------- next part --------------
33c33
<   void addNewVideoSource(FramedSource* inputSource, int mpegVersion, int16_t PID = -1);
---
>   void addNewVideoSource(FramedSource* inputSource, int mpegVersion);
35c35
<   void addNewAudioSource(FramedSource* inputSource, int mpegVersion, int16_t PID = -1);
---
>   void addNewAudioSource(FramedSource* inputSource, int mpegVersion);
43c43
< 			 u_int8_t streamId, int mpegVersion, int16_t PID = -1);
---
> 			 u_int8_t streamId, int mpegVersion);
-------------- next part --------------
36c36
< 		      InputESSourceRecord* next, int16_t PID = -1);
---
> 		      InputESSourceRecord* next);
71d70
<   int16_t fPID;
83c82
< ::addNewVideoSource(FramedSource* inputSource, int mpegVersion, int16_t PID) {
---
> ::addNewVideoSource(FramedSource* inputSource, int mpegVersion) {
85c84
<   addNewInputSource(inputSource, streamId, mpegVersion, PID);
---
>   addNewInputSource(inputSource, streamId, mpegVersion);
90c89
< ::addNewAudioSource(FramedSource* inputSource, int mpegVersion, int16_t PID) {
---
> ::addNewAudioSource(FramedSource* inputSource, int mpegVersion) {
92c91
<   addNewInputSource(inputSource, streamId, mpegVersion, PID);
---
>   addNewInputSource(inputSource, streamId, mpegVersion);
147c146
< 		    u_int8_t streamId, int mpegVersion, int16_t PID) {
---
> 		    u_int8_t streamId, int mpegVersion) {
150c149
< 					  mpegVersion, fInputSources, PID);
---
> 					  mpegVersion, fInputSources);
160c159
< 		      InputESSourceRecord* next, int16_t PID)
---
> 		      InputESSourceRecord* next)
162c161
<     fStreamId(streamId), fMPEGVersion(mpegVersion), fPID(PID) {
---
>     fStreamId(streamId), fMPEGVersion(mpegVersion) {
220c219
< 			 fMPEGVersion, fSCR, fPID);
---
> 			 fMPEGVersion, fSCR);
-------------- next part --------------
43c43
< 		       int mpegVersion, MPEG1or2Demux::SCR scr, int16_t PID = -1);
---
> 		       int mpegVersion, MPEG1or2Demux::SCR scr);
-------------- next part --------------
94c94
< 		  int mpegVersion, MPEG1or2Demux::SCR scr, int16_t PID) {
---
> 		  int mpegVersion, MPEG1or2Demux::SCR scr) {
109,112c109
<     if (PID == -1)
<       fCurrentPID = stream_id;
<     else
<       fCurrentPID = (u_int8_t)PID;
---
>     fCurrentPID = stream_id;


More information about the live-devel mailing list