[mythtv-commits] Ticket #3416: mpegts adding av streams with bad codecs

MythTV mythtv at cvs.mythtv.org
Sat May 5 13:34:14 UTC 2007

#3416: mpegts adding av streams with bad codecs
 Reporter:  anonymous  |       Owner:  ijr    
     Type:  defect     |      Status:  new    
 Priority:  minor      |   Milestone:  unknown
Component:  mythtv     |     Version:  head   
 Severity:  medium     |  
 In the process of coding up support for Brighthouse Tampa's PACE550
 cablebox via FireWire, my final challenge came in the form of MythTV
 thinking that the AC3 audio stream was actually MPEG1 Video.  I tracked
 the problem down to r6861 (2005-06-18 ljr) where code was added to
 libavformat/mpegts.c handle_packet().
     if (ts->auto_guess && tss == NULL && is_start) {
         PESContext *pes = add_pes_stream(ts, pid, 0);
         if (pes)
             new_pes_av_stream(pes, 0);

         tss = ts->pids[pid];
 This adds a pes stream stream to the transport stream context then adds
 a "blank" (for lack of a better term) av stream as the handler for that
 pes.  Since both stream type and stream code are hardcoded to 0,
 codec_type is set to CODEC_TYPE_VIDEO and codec_id is set to
 CODEC_ID_MPEG1VIDEO.  That's fine except...

 When mpegts_push_data is later called to parse the actual data in the TS
 packets, the actual stream code is parsed correctly (0xe0 for the video
 ES, and th 0xbd for the audio ES).  However, since the av stream
 (pes->st) is already allocated
                     if (!pes->st && 0 == new_pes_av_stream(pes, code)) {
 Is is never updated with the appropriate codec type and ID.

 Long story short the video plays but the audio stream is still
 MPEG1VIDEO so I have no audio.  Removing the new_pes_av_stream() call
 from the first code block allows the code in mpegts_push_data to
 allocate it and set the values correctly.

 Sample recording is here (original filename 2690_20070505092733.mpg,

Ticket URL: <http://svn.mythtv.org/trac/ticket/3416>
MythTV <http://svn.mythtv.org/trac>

More information about the mythtv-commits mailing list