comparison libmpdemux/demux_ty.c @ 24469:afbab72dbf2c

Do not misuse a_streams for private info, demuxer->priv is for that!
author reimar
date Fri, 14 Sep 2007 18:40:57 +0000
parents 8b63c9487612
children 656a62a00e94
comparison
equal deleted inserted replaced
24468:8b63c9487612 24469:afbab72dbf2c
483 int esOffset2; 483 int esOffset2;
484 484
485 unsigned char lastCC[ 16 ]; 485 unsigned char lastCC[ 16 ];
486 unsigned char lastXDS[ 16 ]; 486 unsigned char lastXDS[ 16 ];
487 487
488 TiVoInfo *tivo = 0; 488 TiVoInfo *tivo = demux->priv;
489 489
490 if ( demux->stream->type == STREAMTYPE_DVD ) 490 if ( demux->stream->type == STREAMTYPE_DVD )
491 return 0; 491 return 0;
492 492
493 mp_msg( MSGT_DEMUX, MSGL_DBG3, "ty:ty processing\n" ); 493 mp_msg( MSGT_DEMUX, MSGL_DBG3, "ty:ty processing\n" );
494 if ( demux->a_streams[ MAX_A_STREAMS - 1 ] == 0 )
495 {
496 demux->a_streams[ MAX_A_STREAMS - 1 ] = malloc( sizeof( TiVoInfo ) );
497 tivo = demux->a_streams[ MAX_A_STREAMS - 1 ];
498 memset( tivo, 0, sizeof( TiVoInfo ) );
499 tivo->firstAudioPTS = MP_NOPTS_VALUE;
500 tivo->firstVideoPTS = MP_NOPTS_VALUE;
501 }
502 else
503 tivo = demux->a_streams[ MAX_A_STREAMS - 1 ];
504 494
505 if( demux->stream->eof ) return 0; 495 if( demux->stream->eof ) return 0;
506 496
507 // ====================================================================== 497 // ======================================================================
508 // If we haven't figured out the size of the stream, let's do so 498 // If we haven't figured out the size of the stream, let's do so
1042 demux_stream_t *d_video = demuxer->video; 1032 demux_stream_t *d_video = demuxer->video;
1043 sh_audio_t *sh_audio = d_audio->sh; 1033 sh_audio_t *sh_audio = d_audio->sh;
1044 sh_video_t *sh_video = d_video->sh; 1034 sh_video_t *sh_video = d_video->sh;
1045 off_t newpos; 1035 off_t newpos;
1046 off_t res; 1036 off_t res;
1047 TiVoInfo *tivo = 0; 1037 TiVoInfo *tivo = demuxer->priv;
1048 1038
1049 mp_msg( MSGT_DEMUX, MSGL_DBG3, "ty:Seeking to %7.1f\n", rel_seek_secs ); 1039 mp_msg( MSGT_DEMUX, MSGL_DBG3, "ty:Seeking to %7.1f\n", rel_seek_secs );
1050 1040
1051 if ( demuxer->a_streams[ MAX_A_STREAMS - 1 ] != 0 )
1052 {
1053 tivo = demuxer->a_streams[ MAX_A_STREAMS - 1 ];
1054 tivo->lastAudioEnd = 0; 1041 tivo->lastAudioEnd = 0;
1055 tivo->lastAudioPTS = MP_NOPTS_VALUE; 1042 tivo->lastAudioPTS = MP_NOPTS_VALUE;
1056 tivo->lastVideoPTS = MP_NOPTS_VALUE; 1043 tivo->lastVideoPTS = MP_NOPTS_VALUE;
1057 }
1058 // 1044 //
1059 //================= seek in MPEG ========================== 1045 //================= seek in MPEG ==========================
1060 demuxer->filepos = stream_tell( demuxer->stream ); 1046 demuxer->filepos = stream_tell( demuxer->stream );
1061 1047
1062 newpos = ( flags & 1 ) ? demuxer->movi_start : demuxer->filepos; 1048 newpos = ( flags & 1 ) ? demuxer->movi_start : demuxer->filepos;
1143 } 1129 }
1144 1130
1145 1131
1146 static void demux_close_ty( demuxer_t *demux ) 1132 static void demux_close_ty( demuxer_t *demux )
1147 { 1133 {
1148 TiVoInfo *tivo = 0; 1134 TiVoInfo *tivo = demux->priv;
1149 1135
1150 if ( demux->a_streams[ MAX_A_STREAMS - 1 ] != 0 )
1151 {
1152 tivo = demux->a_streams[ MAX_A_STREAMS - 1 ];
1153 free( tivo ); 1136 free( tivo );
1154 demux->a_streams[ MAX_A_STREAMS - 1 ] = 0;
1155 sub_justify = 0; 1137 sub_justify = 0;
1156 }
1157 } 1138 }
1158 1139
1159 1140
1160 static int ty_check_file(demuxer_t* demuxer) 1141 static int ty_check_file(demuxer_t* demuxer)
1161 { 1142 {
1143 TiVoInfo *tivo = calloc(1, sizeof(TiVoInfo));
1144 tivo->firstAudioPTS = MP_NOPTS_VALUE;
1145 tivo->firstVideoPTS = MP_NOPTS_VALUE;
1146 demuxer->priv = tivo;
1162 return ds_fill_buffer(demuxer->video) ? DEMUXER_TYPE_MPEG_TY : 0; 1147 return ds_fill_buffer(demuxer->video) ? DEMUXER_TYPE_MPEG_TY : 0;
1163 } 1148 }
1164 1149
1165 1150
1166 static demuxer_t* demux_open_ty(demuxer_t* demuxer) 1151 static demuxer_t* demux_open_ty(demuxer_t* demuxer)