[Mplayer-cvslog] CVS: main mplayer.c,1.82,1.83 cfg-mplayer.h,1.30,1.31 demux_mpg.c,1.13,1.14 demuxer.c,1.2,1.3

GEREOFFY arpi_esp at users.sourceforge.net
Sat Apr 21 00:35:17 CEST 2001


Update of /cvsroot/mplayer/main
In directory usw-pr-cvs1:/tmp/cvs-serv6097

Modified Files:
	mplayer.c cfg-mplayer.h demux_mpg.c demuxer.c 
Log Message:
dvd sub support reading

Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -C2 -r1.82 -r1.83
*** mplayer.c	2001/04/20 18:28:13	1.82
--- mplayer.c	2001/04/20 22:35:14	1.83
***************
*** 252,255 ****
--- 252,256 ----
    sh_audio_t* a_streams[256];
    sh_video_t* v_streams[256];
+   char s_streams[32]; // dvd subtitles
    // video:
    unsigned int bitrate;
***************
*** 463,466 ****
--- 464,468 ----
  int audio_id=-1;
  int video_id=-1;
+ int dvdsub_id=-1;
  float default_max_pts_correction=0.01f;
  int delay_corrected=1;
***************
*** 498,502 ****
  float sub_fps=0;
  int   sub_auto = 1;
! char stream_dump_name=NULL;
  int stream_dump_type=0;
  //int user_bpp=0;
--- 500,504 ----
  float sub_fps=0;
  int   sub_auto = 1;
! char *stream_dump_name=NULL;
  int stream_dump_type=0;
  //int user_bpp=0;
***************
*** 639,643 ****
  //=============== Try to open as AVI file: =================
  stream_reset(stream);
! demuxer=new_demuxer(stream,DEMUXER_TYPE_AVI,audio_id,video_id);
  stream_seek(demuxer->stream,seek_to_byte);
  { //---- RIFF header:
--- 641,645 ----
  //=============== Try to open as AVI file: =================
  stream_reset(stream);
! demuxer=new_demuxer(stream,DEMUXER_TYPE_AVI,audio_id,video_id,dvdsub_id);
  stream_seek(demuxer->stream,seek_to_byte);
  { //---- RIFF header:
***************
*** 655,659 ****
  if(file_format==DEMUXER_TYPE_UNKNOWN){
    stream_reset(stream);
!   demuxer=new_demuxer(stream,DEMUXER_TYPE_ASF,audio_id,video_id);
    stream_seek(demuxer->stream,seek_to_byte);
    if(asf_check_header()){
--- 657,661 ----
  if(file_format==DEMUXER_TYPE_UNKNOWN){
    stream_reset(stream);
!   demuxer=new_demuxer(stream,DEMUXER_TYPE_ASF,audio_id,video_id,dvdsub_id);
    stream_seek(demuxer->stream,seek_to_byte);
    if(asf_check_header()){
***************
*** 665,669 ****
  if(file_format==DEMUXER_TYPE_UNKNOWN){
    stream_reset(stream);
!   demuxer=new_demuxer(stream,DEMUXER_TYPE_MPEG_PS,audio_id,video_id);
    stream_seek(demuxer->stream,seek_to_byte);
    if(audio_format) demuxer->audio->type=audio_format; // override audio format
--- 667,671 ----
  if(file_format==DEMUXER_TYPE_UNKNOWN){
    stream_reset(stream);
!   demuxer=new_demuxer(stream,DEMUXER_TYPE_MPEG_PS,audio_id,video_id,dvdsub_id);
    stream_seek(demuxer->stream,seek_to_byte);
    if(audio_format) demuxer->audio->type=audio_format; // override audio format
***************
*** 689,693 ****
  if(file_format==DEMUXER_TYPE_MPEG_ES){ // little hack, see above!
    stream_reset(stream);
!   demuxer=new_demuxer(stream,DEMUXER_TYPE_MPEG_ES,audio_id,video_id);
    stream_seek(demuxer->stream,seek_to_byte);
    if(!ds_fill_buffer(demuxer->video)){
--- 691,695 ----
  if(file_format==DEMUXER_TYPE_MPEG_ES){ // little hack, see above!
    stream_reset(stream);
!   demuxer=new_demuxer(stream,DEMUXER_TYPE_MPEG_ES,audio_id,video_id,dvdsub_id);
    stream_seek(demuxer->stream,seek_to_byte);
    if(!ds_fill_buffer(demuxer->video)){

Index: cfg-mplayer.h
===================================================================
RCS file: /cvsroot/mplayer/main/cfg-mplayer.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -r1.30 -r1.31
*** cfg-mplayer.h	2001/04/20 18:28:13	1.30
--- cfg-mplayer.h	2001/04/20 22:35:15	1.31
***************
*** 61,66 ****
--- 61,68 ----
  	{"ni", &force_ni, CONF_TYPE_FLAG, 0, 0, 1},
  	{"noni", &force_ni, CONF_TYPE_FLAG, 0, 1, 0},
+ 
  	{"aid", &audio_id, CONF_TYPE_INT, CONF_RANGE, 0, 256},
  	{"vid", &video_id, CONF_TYPE_INT, CONF_RANGE, 0, 256},
+ 	{"sid", &dvdsub_id, CONF_TYPE_INT, CONF_RANGE, 0, 32},
  
  	{"dumpfile", &stream_dump_name, CONF_TYPE_STRING, 0, 0, 0},
***************
*** 79,83 ****
  	{"br", &encode_bitrate, CONF_TYPE_INT, CONF_RANGE, 10000, 10000000},
  #ifdef HAVE_PNG
! 	{"z", &z_compression, CONF_TYPE_INT, CONF_RANGE, 0, 9},
  #endif	
  
--- 81,85 ----
  	{"br", &encode_bitrate, CONF_TYPE_INT, CONF_RANGE, 10000, 10000000},
  #ifdef HAVE_PNG
! 	{"z", &z_compression, CONF_TYPE_INT, CONF_RANGE, 0, 10},
  #endif	
  

Index: demux_mpg.c
===================================================================
RCS file: /cvsroot/mplayer/main/demux_mpg.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** demux_mpg.c	2001/04/20 16:43:17	1.13
--- demux_mpg.c	2001/04/20 22:35:15	1.14
***************
*** 4,7 ****
--- 4,11 ----
  #define MAX_PS_PACKETSIZE (224*1024)
  
+ static void parse_dvdsub(unsigned char *buf,int len){
+     printf("\rDVDsub packet: %d  \n",len);
+ }
+ 
  static int mpeg_pts_error=0;
  
***************
*** 113,122 ****
      //============== DVD Audio sub-stream ======================
      if(id==0x1BD){
!       int aid=128+(stream_read_char(demux->stream)&0x7F);--len;
        if(len<3) return -1; // invalid audio packet
  
!       if(!avi_header.a_streams[aid]) new_sh_audio(aid);
!       if(demux->audio->id==-1) demux->audio->id=aid;
  
        if(demux->audio->id==aid){
  //        int type;
--- 117,151 ----
      //============== DVD Audio sub-stream ======================
      if(id==0x1BD){
!       int aid=stream_read_char(demux->stream);--len;
        if(len<3) return -1; // invalid audio packet
+       
+       // AID:
+       // 0x20..0x3F  subtitle
+       // 0x80..0x9F  AC3 audio
+       // 0xA0..0xBF  PCM audio
+       
+       if((aid & 0xE0) == 0x20){
+         // subtitle:
+         aid&=0x1F;
+ 
+         if(!avi_header.s_streams[aid]){
+             printf("==> Found subtitle: %d\n",aid);
+             avi_header.s_streams[aid]=1;
+             // new_sh_audio(aid);
+         }
+ 
+         //if(demux->audio->id==-1) demux->audio->id=aid; // autodetect :)
+         if(demux->sub->id==aid){
+             ds=demux->sub;
+         }
+           
+       } else if((aid & 0xC0) == 0x80) {
  
! //        aid=128+(aid&0x7F);
!         // aid=0x80..0xBF
  
+         if(!avi_header.a_streams[aid]) new_sh_audio(aid);
+         if(demux->audio->id==-1) demux->audio->id=aid;
+ 
        if(demux->audio->id==aid){
  //        int type;
***************
*** 131,135 ****
          if(ds->type==-1){
            // autodetect type
!           ds->type=((aid&0x70)==0x20)?2:3;
          }
          if(ds->type==2 && len>=2){
--- 160,164 ----
          if(ds->type==-1){
            // autodetect type
!           ds->type=((aid&0xE0)==0xA0)?2:3;
          }
          if(ds->type==2 && len>=2){
***************
*** 145,150 ****
            if(!len) printf("End of packet while searching for PCM header\n");
          }
!       }
!     }
  
    } else {
--- 174,182 ----
            if(!len) printf("End of packet while searching for PCM header\n");
          }
!       } //  if(demux->audio->id==aid)
! 
!       } else printf("Unknown 0x1BD substream: 0x%02X  \n",aid);
! 
!     } //if(id==0x1BD)
  
    } else {
***************
*** 195,198 ****
--- 227,231 ----
  #endif
      ds_read_packet(ds,demux->stream,len,pts/90000.0f,0);
+     if(ds==demux->sub) parse_dvdsub(ds->last->buffer,ds->last->len);
      return 1;
    }
***************
*** 257,260 ****
--- 290,294 ----
    if(demux->synced==2){
        ret=demux_mpg_read_packet(demux,head);
+ /*
        if(!ret)
          if(--max_packs==0){
***************
*** 263,266 ****
--- 297,301 ----
            return 0;
          }
+ */
    } else {
      if(head>=0x100 && head<0x1B0){

Index: demuxer.c
===================================================================
RCS file: /cvsroot/mplayer/main/demuxer.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** demuxer.c	2001/04/06 01:18:59	1.2
--- demuxer.c	2001/04/20 22:35:15	1.3
***************
*** 95,101 ****
    demux_stream_t *audio;
    demux_stream_t *video;
  } demuxer_t;
  
! demuxer_t* new_demuxer(stream_t *stream,int type,int a_id,int v_id){
    demuxer_t *d=malloc(sizeof(demuxer_t));
    d->stream=stream;
--- 95,102 ----
    demux_stream_t *audio;
    demux_stream_t *video;
+   demux_stream_t *sub;
  } demuxer_t;
  
! demuxer_t* new_demuxer(stream_t *stream,int type,int a_id,int v_id,int s_id){
    demuxer_t *d=malloc(sizeof(demuxer_t));
    d->stream=stream;
***************
*** 104,107 ****
--- 105,109 ----
    d->audio=new_demuxer_stream(d,a_id);
    d->video=new_demuxer_stream(d,v_id);
+   d->sub=new_demuxer_stream(d,s_id);
    d->type=type;
    return d;


_______________________________________________
Mplayer-cvslog mailing list
Mplayer-cvslog at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog



More information about the MPlayer-cvslog mailing list