[MPlayer-dev-eng] [PATCH] initial transport stream demuxer

Arpi arpi at thot.banki.hu
Wed Feb 19 14:01:54 CET 2003


Hi,

> >> This patch assumes that video is MPEG2 and audio is MP2; I'll add 
> >> support for more formats in the future.
> >> 
> >> Please, can anyone help me to develop it  further?
> >
> >this one seems to implement TS->ES demuxing, and it doesn't chain
> >through the existing PS->ES demuxer we discussed here few days ago.
> >am i right?
> 
> Yes, because I realized that ffmpeg's demuxer was already doing all the pes parsing and 
> working quite well.

hmm. i don't know the TS format enough to decide which one is better.
if it works well this way, it's simpler. if you have to duplicate lots of
PS demuxing code then it sucks.

> At the end it was simpler than the chaining, that didn't work for audio.
it should work for audio.

> Also, I wonder if it's possible to seek when using the chaining.
yes, it's possible.

> If you believe that chaining is preferrable  to pes parsing I'll revert to that method, If I can 
> make it work.
> 
> 
> P.S, I realized that ES have a signature too, so now I understand why sooner I was 
> confusing ES and PES streams. Sorry.

i've fixed yoru patch. there were 2 problems:

1. you forgot to add DEMPXER_TYPE_MPEG_TS to the mpeg header and frame
parsers in video.c:

Index: libmpdemux/video.c
===================================================================
RCS file: /cvsroot/mplayer/0_90/libmpdemux/video.c,v
retrieving revision 1.34
diff -u -r1.34 video.c
--- libmpdemux/video.c	2 Feb 2003 14:02:32 -0000	1.34
+++ libmpdemux/video.c	19 Feb 2003 12:52:34 -0000
@@ -130,6 +130,7 @@
    break;
  }
  case DEMUXER_TYPE_PVA:
+ case DEMUXER_TYPE_MPEG_TS:
  case DEMUXER_TYPE_MPEG_ES:
  case DEMUXER_TYPE_MPEG_PS: {
 //mpeg_header_parser:
@@ -267,6 +268,7 @@
 
   if(demuxer->file_format==DEMUXER_TYPE_MPEG_ES || demuxer->file_format==DEMUXER_TYPE_MPEG_PS
 		  || demuxer->file_format==DEMUXER_TYPE_PVA
+		  || demuxer->file_format==DEMUXER_TYPE_MPEG_TS
 #ifdef STREAMING_LIVE_DOT_COM
     || (demuxer->file_format==DEMUXER_TYPE_RTP && demux_is_mpeg_rtp_stream(demuxer))
 #endif


now it plays the TS sample file i have.

the 2. problem is more like implementation, and understaning of the demuxer
API. your emuxer should honor the stream IDs it get from the caller.
including the 2 special values:
demuxer->audio(/video)->id == -2 means 'ignore this stream', used for
   -nosound, no vidoe codec and -dump* options.
demuxer->audio(/video)->id == -1 means autodetection of stream ID (use the
   first/best available stream)
all ID values >=0 means stream id explicitly given by use (-aid/-vid/-sid
options) so you should take only the requested stream id, and fail if no
such stream in the file. in the case of TS, you should consider this ID as
TS PID.
unfortunatelly TS PIDs may be 0..8192, while the current limits in demuxer
layer are 0..255. so, you should do either some internal remapping of PIDs
to IDs (probably an &255 si enough) or change limits in demuxer.h and
cfg-common.h for IDs.

the most important that you should not create streams (new_sh_audio/video)
if ID==-2, and drop packets (instead of calling ds_add_packet()) if ID==-2
the next step - for supporting more than one a/v streams in a TS file) is
the ID checking.


A'rpi / Astral & ESP-team

--
Developer of MPlayer, the Movie Player for Linux - http://www.MPlayerHQ.hu
    "However, many people beg for its inclusion in Debian. Why?" - Gabucino
  "Because having new software in Debian is good." - Josselin Mouette
"Because having good software in Debian is new." - Gabucino


More information about the MPlayer-dev-eng mailing list