[MPlayer-cvslog] CVS: main/libmpdemux video.c, 1.46, 1.47 demuxer.h, 1.70, 1.71 demuxer.c, 1.174, 1.175 demux_ts.c, 1.21, 1.22

Nico Sabbi CVS syncmail at mplayerhq.hu
Wed Nov 24 19:55:06 CET 2004


CVS change done by Nico Sabbi CVS

Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var2/tmp/cvs-serv1362

Modified Files:
	video.c demuxer.h demuxer.c demux_ts.c 
Log Message:
merged DEMUXER_TYPE_MPEG4_ES in the ordinary TS; added support for H264 in TS

Index: video.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/video.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- video.c	11 Apr 2004 19:03:12 -0000	1.46
+++ video.c	24 Nov 2004 18:55:03 -0000	1.47
@@ -37,10 +37,38 @@
 int video_read_properties(sh_video_t *sh_video){
 demux_stream_t *d_video=sh_video->ds;
 
+enum {
+	VIDEO_MPEG12,
+	VIDEO_MPEG4,
+	VIDEO_H264,
+	VIDEO_OTHER
+} video_codec;
+
+if((d_video->demuxer->file_format == DEMUXER_TYPE_PVA) ||
+   (d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_ES) ||
+   (d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_PS) ||
+   (d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_TY) ||
+   (d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_TS && ((sh_video->format==0x10000001) || (sh_video->format==0x10000002)))
+#ifdef STREAMING_LIVE_DOT_COM
+  || ((d_video->demuxer->file_format == DEMUXER_TYPE_RTP) && demux_is_mpeg_rtp_stream(d_video->demuxer))
+#endif
+  )
+    video_codec = VIDEO_MPEG12;
+  else if((d_video->demuxer->file_format == DEMUXER_TYPE_MPEG4_ES) ||
+    ((d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_TS) && (sh_video->format==0x10000004))
+  )
+    video_codec = VIDEO_MPEG4;
+  else if((d_video->demuxer->file_format == DEMUXER_TYPE_H264_ES) ||
+    ((d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_TS) && (sh_video->format==0x10000005))
+  )
+    video_codec = VIDEO_H264;
+  else
+    video_codec = VIDEO_OTHER;
+    
 // Determine image properties:
-switch(d_video->demuxer->file_format){
- case DEMUXER_TYPE_AVI:
- case DEMUXER_TYPE_ASF: {
+switch(video_codec){
+ case VIDEO_OTHER: {
+ if((d_video->demuxer->file_format == DEMUXER_TYPE_ASF) || (d_video->demuxer->file_format == DEMUXER_TYPE_AVI)) {
   // display info: 
   
 #if 0
@@ -84,10 +112,10 @@
 //	goto mpeg_header_parser;
     }
 #endif
+  }
   break;
  }
- case DEMUXER_TYPE_MPEG4_ES: 
- case DEMUXER_TYPE_MPEG4_IN_TS: {
+ case VIDEO_MPEG4: {
    videobuf_len=0; videobuf_code_len=0;
    mp_msg(MSGT_DECVIDEO,MSGL_V,"Searching for Video Object Start code... ");fflush(stdout);
    while(1){
@@ -107,7 +135,7 @@
    mp_msg(MSGT_DECVIDEO,MSGL_V,"Searching for Video Object Layer Start code... ");fflush(stdout);
    while(1){
       int i=sync_video_packet(d_video);
-      printf("0x%X\n",i);
+      mp_msg(MSGT_DECVIDEO,MSGL_V,"M4V: 0x%X\n",i);
       if(i>=0x120 && i<=0x12F) break; // found it!
       if(!i || !read_video_packet(d_video)){
         mp_msg(MSGT_DECVIDEO,MSGL_V,"NONE :(\n");
@@ -127,7 +155,7 @@
    sh_video->format=0x10000004;
    break;
  }
- case DEMUXER_TYPE_H264_ES: {
+ case VIDEO_H264: {
    videobuf_len=0; videobuf_code_len=0;
    mp_msg(MSGT_DECVIDEO,MSGL_V,"Searching for sequence parameter set... ");fflush(stdout);
    while(1){
@@ -147,7 +175,7 @@
    mp_msg(MSGT_DECVIDEO,MSGL_V,"Searching for picture parameter set... ");fflush(stdout);
    while(1){
       int i=sync_video_packet(d_video);
-      printf("0x%X\n",i);
+      mp_msg(MSGT_DECVIDEO,MSGL_V,"H264: 0x%X\n",i);
       if((i&~0x60) == 0x108 && i != 0x108) break; // found it!
       if(!i || !read_video_packet(d_video)){
         mp_msg(MSGT_DECVIDEO,MSGL_V,"NONE :(\n");
@@ -167,18 +195,7 @@
    sh_video->format=0x10000005;
    break;
  }
-#ifdef STREAMING_LIVE_DOT_COM
- case DEMUXER_TYPE_RTP:
-   // If the RTP stream is a MPEG stream, then we use this code to check
-   // for MPEG headers:
-   if (!demux_is_mpeg_rtp_stream(d_video->demuxer)) break;
-   // otherwise fall through to...
-#endif
- case DEMUXER_TYPE_PVA:
- case DEMUXER_TYPE_MPEG_TS:
- case DEMUXER_TYPE_MPEG_ES:
- case DEMUXER_TYPE_MPEG_TY:
- case DEMUXER_TYPE_MPEG_PS: {
+ case VIDEO_MPEG12: {
 //mpeg_header_parser:
    // Find sequence_header first:
    videobuf_len=0; videobuf_code_len=0;
@@ -244,7 +261,7 @@
        sh_video->aspect=0.0;
      break;
      default:
-       fprintf(stderr,"Detected unknown aspect_ratio_information in mpeg sequence header.\n"
+       mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Detected unknown aspect_ratio_information in mpeg sequence header.\n"
                "Please report the aspect value (%i) along with the movie type (VGA,PAL,NTSC,"
                "SECAM) and the movie resolution (720x576,352x240,480x480,...) to the MPlayer"
                " developers, so that we can add support for it!\nAssuming 1:1 aspect for now.\n",
@@ -322,7 +339,8 @@
     *start=NULL;
 
   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
+		  || demuxer->file_format==DEMUXER_TYPE_PVA || 
+		  ((demuxer->file_format==DEMUXER_TYPE_MPEG_TS) && ((sh_video->format==0x10000001) || (sh_video->format==0x10000002)))
 		  || demuxer->file_format==DEMUXER_TYPE_MPEG_TY
 #ifdef STREAMING_LIVE_DOT_COM
     || (demuxer->file_format==DEMUXER_TYPE_RTP && demux_is_mpeg_rtp_stream(demuxer))
@@ -413,7 +431,7 @@
 	    telecine=1;
 	}
 
-  } else if((demuxer->file_format==DEMUXER_TYPE_MPEG4_ES) || (demuxer->file_format==DEMUXER_TYPE_MPEG4_IN_TS)){
+  } else if((demuxer->file_format==DEMUXER_TYPE_MPEG4_ES) || ((demuxer->file_format==DEMUXER_TYPE_MPEG_TS) && (sh_video->format==0x10000004))){
       //
         while(videobuf_len<VIDEOBUFFER_SIZE-MAX_VIDEO_PACKET_SIZE){
           int i=sync_video_packet(d_video);
@@ -423,7 +441,7 @@
 	*start=videobuffer; in_size=videobuf_len;
 	videobuf_len=0;
 
-  } else if(demuxer->file_format==DEMUXER_TYPE_H264_ES){
+  } else if(demuxer->file_format==DEMUXER_TYPE_H264_ES || ((demuxer->file_format==DEMUXER_TYPE_MPEG_TS) && (sh_video->format==0x10000005))){
       //
         while(videobuf_len<VIDEOBUFFER_SIZE-MAX_VIDEO_PACKET_SIZE){
           int i=sync_video_packet(d_video);
@@ -494,7 +512,7 @@
     }
     
     if(demuxer->file_format==DEMUXER_TYPE_MPEG_PS ||
-       demuxer->file_format==DEMUXER_TYPE_MPEG_TS ||
+       ((demuxer->file_format==DEMUXER_TYPE_MPEG_TS) && ((sh_video->format==0x10000001) || (sh_video->format==0x10000002))) ||
        demuxer->file_format==DEMUXER_TYPE_MPEG_ES ||
        demuxer->file_format==DEMUXER_TYPE_MPEG_TY){
 

Index: demuxer.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demuxer.h,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -r1.70 -r1.71
--- demuxer.h	28 Sep 2004 14:00:49 -0000	1.70
+++ demuxer.h	24 Nov 2004 18:55:03 -0000	1.71
@@ -55,10 +55,6 @@
 // A virtual demuxer type for the network code
 #define DEMUXER_TYPE_PLAYLIST (2<<16)
 
-//This one is needed only to identify mpeg4 in mpeg2-ts, shouldn't be used explicitly,
-// rather use ths usual _TYPE_TS
-#define DEMUXER_TYPE_MPEG4_IN_TS (3<<16)
-
 
 #define DEMUXER_TIME_NONE 0
 #define DEMUXER_TIME_PTS 1

Index: demuxer.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demuxer.c,v
retrieving revision 1.174
retrieving revision 1.175
diff -u -r1.174 -r1.175
--- demuxer.c	15 Nov 2004 09:09:28 -0000	1.174
+++ demuxer.c	24 Nov 2004 18:55:03 -0000	1.175
@@ -231,7 +231,6 @@
     case DEMUXER_TYPE_LMLM4:
       demux_close_lmlm4(demuxer); break;
     case DEMUXER_TYPE_MPEG_TS:
-    case DEMUXER_TYPE_MPEG4_IN_TS:
       demux_close_ts(demuxer); break;
     case DEMUXER_TYPE_MPEG_PS:
       demux_close_mpg(demuxer); break;
@@ -386,7 +385,6 @@
 #endif
     case DEMUXER_TYPE_LMLM4: return demux_lmlm4_fill_buffer(demux);
     case DEMUXER_TYPE_MPEG_TS: 
-    case DEMUXER_TYPE_MPEG4_IN_TS: 
 	return demux_ts_fill_buffer(demux);
     case DEMUXER_TYPE_REALAUDIO: return demux_ra_fill_buffer(demux);
 #ifdef USE_LIBAVFORMAT
@@ -1363,8 +1361,7 @@
    break;
  }
 #endif
- case DEMUXER_TYPE_MPEG_TS: 
- case DEMUXER_TYPE_MPEG4_IN_TS: {
+ case DEMUXER_TYPE_MPEG_TS: {
   demux_open_ts(demuxer);
   break;
  }
@@ -1586,7 +1583,6 @@
       demux_mkv_seek(demuxer,rel_seek_secs,flags);  break;
 #endif
  case DEMUXER_TYPE_MPEG_TS:
- case DEMUXER_TYPE_MPEG4_IN_TS:
       demux_seek_ts(demuxer,rel_seek_secs,flags); break;
  #ifdef USE_LIBAVFORMAT
  case DEMUXER_TYPE_LAVF:
@@ -1667,7 +1663,6 @@
 	case DEMUXER_TYPE_MPEG_ES:
 	case DEMUXER_TYPE_MPEG_PS:
 	case DEMUXER_TYPE_MPEG_TS:
-	case DEMUXER_TYPE_MPEG4_IN_TS:
 	    return demux_mpg_control(demuxer,cmd,arg);
 	case DEMUXER_TYPE_ASF:
 	    return demux_asf_control(demuxer,cmd,arg);

Index: demux_ts.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_ts.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- demux_ts.c	20 Nov 2004 14:33:39 -0000	1.21
+++ demux_ts.c	24 Nov 2004 18:55:03 -0000	1.22
@@ -61,6 +61,7 @@
 	VIDEO_MPEG1 	= 0x10000001,
 	VIDEO_MPEG2 	= 0x10000002,
 	VIDEO_MPEG4 	= 0x10000004,
+	VIDEO_H264 	= 0x10000005,
 	AUDIO_MP2   	= 0x50,
 	AUDIO_A52   	= 0x2000,
 	AUDIO_LPCM_BE  	= 0x10001,
@@ -500,7 +501,7 @@
 			}
 			
 			is_audio = ((es.type == AUDIO_MP2) || (es.type == AUDIO_A52) || (es.type == AUDIO_LPCM_BE) || (es.type == AUDIO_AAC));
-			is_video = ((es.type == VIDEO_MPEG1) || (es.type == VIDEO_MPEG2) || (es.type == VIDEO_MPEG4));
+			is_video = ((es.type == VIDEO_MPEG1) || (es.type == VIDEO_MPEG2) || (es.type == VIDEO_MPEG4) || (es.type == VIDEO_H264));
 			is_sub   = ((es.type == SPU_DVD) || (es.type == SPU_DVB));
 
 
@@ -650,7 +651,7 @@
 	}
 						
 	if(video_found)
-		mp_msg(MSGT_DEMUXER, MSGL_INFO, "VIDEO MPEG%d(pid=%d)...", (param->vtype == VIDEO_MPEG1 ? 1 : (param->vtype == VIDEO_MPEG2 ? 2 : 4)), param->vpid);
+		mp_msg(MSGT_DEMUXER, MSGL_INFO, "VIDEO %s(pid=%d)...", (param->vtype == VIDEO_MPEG1 ? "MPEG1" : (param->vtype == VIDEO_MPEG2 ? "MPEG2" : (param->vtype == VIDEO_MPEG4 ? "MPEG4" : "H264"))), param->vpid);
 	else
 	{
 		video_found = 0;
@@ -790,9 +791,6 @@
 
 	if(params.vtype != UNKNOWN)
 	{
-		if(params.vtype == VIDEO_MPEG4)
-			demuxer->file_format= DEMUXER_TYPE_MPEG4_IN_TS;
-
 		sh_video = new_sh_video(demuxer, 0);
 		sh_video->ds = demuxer->video;
 		sh_video->format = params.vtype;
@@ -1573,6 +1571,9 @@
 				break;
 			*/
 
+			case 0x1b:
+				pmt->es[idx].type = VIDEO_H264;
+				break;
 			case 0x81:
 				pmt->es[idx].type = AUDIO_A52;
 				break;
@@ -1845,7 +1846,7 @@
 
 		priv->last_pid = pid;
 
-		is_video = ((tss->type == VIDEO_MPEG1) || (tss->type == VIDEO_MPEG2) || (tss->type == VIDEO_MPEG4));
+		is_video = ((tss->type == VIDEO_MPEG1) || (tss->type == VIDEO_MPEG2) || (tss->type == VIDEO_MPEG4) || (tss->type == VIDEO_H264));
 		is_audio = ((tss->type == AUDIO_MP2) || (tss->type == AUDIO_A52) || (tss->type == AUDIO_LPCM_BE) ||  (tss->type == AUDIO_AAC) 
 			|| (tss->type == PES_PRIVATE1));
 		is_sub	= ((tss->type == SPU_DVD) || (tss->type == SPU_DVB));
@@ -2263,10 +2264,14 @@
 		{
 			if(i==0x1B3 || i==0x1B8) break; // found it!
 		}
-		else //MPEG4
+		else if(sh_video->format == VIDEO_MPEG4)
 		{
 			if(i==0x1B6) break; // found it!
 		}
+		else	//H264
+		{
+			if((i & ~0x60) == 0x101 || (i & ~0x60) == 0x102 || (i & ~0x60) == 0x105) break;
+		}
 
 		if(!i || !skip_video_packet(d_video)) break; // EOF?
 	}




More information about the MPlayer-cvslog mailing list