dvd sub parser move dto mplayer.c

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@555 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
arpi_esp 2001-04-20 23:00:11 +00:00
parent 5cfb67c65e
commit 357832494c
3 changed files with 31 additions and 6 deletions

View File

@ -3,9 +3,9 @@
//#define MAX_PS_PACKETSIZE 2048
#define MAX_PS_PACKETSIZE (224*1024)
static void parse_dvdsub(unsigned char *buf,int len){
printf("\rDVDsub packet: %d \n",len);
}
//static void parse_dvdsub(unsigned char *buf,int len){
// printf("\rDVDsub packet: %d \n",len);
//}
static int mpeg_pts_error=0;
@ -226,7 +226,7 @@ static int demux_mpg_read_packet(demuxer_t *demux,int id){
}
#endif
ds_read_packet(ds,demux->stream,len,pts/90000.0f,0);
if(ds==demux->sub) parse_dvdsub(ds->last->buffer,ds->last->len);
// if(ds==demux->sub) parse_dvdsub(ds->last->buffer,ds->last->len);
return 1;
}
if(verbose>=2) printf("DEMUX_MPG: Skipping %d data bytes from packet %04X\n",len,id);
@ -289,14 +289,12 @@ do{
} // else
if(demux->synced==2){
ret=demux_mpg_read_packet(demux,head);
/*
if(!ret)
if(--max_packs==0){
demux->stream->eof=1;
printf("demux: file doesn't contain the selected audio or video stream\n");
return 0;
}
*/
} else {
if(head>=0x100 && head<0x1B0){
if(head==0x100)

View File

@ -289,3 +289,19 @@ int ds_get_packet(demux_stream_t *ds,char **start){
return len;
}
}
int ds_get_packet_sub(demux_stream_t *ds,char **start){
while(1){
int len;
if(ds->buffer_pos>=ds->buffer_size){
*start = NULL;
if(!ds->packs) return -1; // no sub
if(!ds_fill_buffer(ds)) return -1; // EOF
}
len=ds->buffer_size-ds->buffer_pos;
*start = &ds->buffer[ds->buffer_pos];
ds->buffer_pos+=len;
return len;
}
}

View File

@ -289,6 +289,7 @@ sh_video_t* new_sh_video(int id){
demuxer_t *demuxer=NULL;
demux_stream_t *d_audio=NULL;
demux_stream_t *d_video=NULL;
demux_stream_t *d_dvdsub=NULL;
sh_audio_t *sh_audio=NULL;//&sh_audio_i;
sh_video_t *sh_video=NULL;//&sh_video_i;
@ -708,6 +709,7 @@ if(file_format==DEMUXER_TYPE_UNKNOWN){
//====== File format recognized, set up these for compatibility: =========
d_audio=demuxer->audio;
d_video=demuxer->video;
d_dvdsub=demuxer->sub;
//d_audio->sh=sh_audio;
//d_video->sh=sh_video;
//sh_audio=d_audio->sh;sh_audio->ds=d_audio;
@ -2039,6 +2041,15 @@ switch(file_format){
find_sub(sub_uses_time?(100*(v_pts+sub_delay)):((v_pts+sub_delay)*sub_fps)); // FIXME! frame counter...
current_module=NULL;
}
// DVD sub:
{ unsigned char* buf=NULL;
int len=ds_get_packet_sub(d_dvdsub,&buf);
if(len>0){
printf("\rDVD sub: %d \n",len);
}
}
}
} // while(!eof)