Mercurial > mplayer.hg
changeset 5438:607d437c1d9d
fixed new_chunk calculation at seeking (seeking not work yet) and added -nosound support
author | arpi |
---|---|
date | Sun, 31 Mar 2002 22:44:03 +0000 |
parents | 498f1d575ca3 |
children | bc20fe5676ff |
files | libmpdemux/demux_film.c |
diffstat | 1 files changed, 15 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpdemux/demux_film.c Sun Mar 31 22:12:39 2002 +0000 +++ b/libmpdemux/demux_film.c Sun Mar 31 22:44:03 2002 +0000 @@ -49,16 +49,13 @@ void demux_seek_film(demuxer_t *demuxer, float rel_seek_secs, int flags) { film_data_t *film_data = (film_data_t *)demuxer->priv; - int new_current_chunk; + int new_current_chunk=(flags&1)?0:film_data->current_chunk; - // bit 2 of the flags apparently means that the seek is relative to - // the beginning of the file - if (flags & 1) - new_current_chunk = - rel_seek_secs * film_data->chunks_per_second; + if(flags&2) + new_current_chunk += rel_seek_secs * film_data->total_chunks; // 0..1 else - new_current_chunk = film_data->current_chunk + - rel_seek_secs * film_data->chunks_per_second; + new_current_chunk += rel_seek_secs * film_data->chunks_per_second; // secs + printf ("current, total chunks = %d, %d; seek %5.3f sec, new chunk guess = %d\n", film_data->current_chunk, film_data->total_chunks, @@ -110,6 +107,7 @@ // (all ones in syncinfo1 indicates an audio chunk) if (film_chunk.syncinfo1 == 0xFFFFFFFF) { + if(demuxer->audio->id>=-1){ // audio not disabled dp = new_demux_packet(film_chunk.chunk_size); if (stream_read(demuxer->stream, dp->buffer, film_chunk.chunk_size) != film_chunk.chunk_size) @@ -134,7 +132,7 @@ // append packet to DS stream ds_add_packet(demuxer->audio, dp); - film_data->current_chunk++; + } } else { @@ -171,16 +169,15 @@ // append packet to DS stream ds_add_packet(demuxer->video, dp); - film_data->current_chunk++; } else { ds_read_packet(demuxer->video, demuxer->stream, film_chunk.chunk_size, film_chunk.pts, film_chunk.chunk_offset, (film_chunk.syncinfo1 & 0x80000000) ? 1 : 0); - film_data->current_chunk++; } } + film_data->current_chunk++; return 1; } @@ -266,6 +263,12 @@ // skip height and width if no video stream_skip(demuxer->stream, 8); + if(demuxer->audio->id<-1){ + printf("chunk size = 0x%X \n",chunk_size); + stream_skip(demuxer->stream, chunk_size-12-8); + break; // audio disabled (or no soundcard) + } + // skip over unknown byte, but only if file had non-NULL version if (film_data->film_version) stream_skip(demuxer->stream, 1); @@ -378,6 +381,7 @@ // precalculate PTS if (film_chunk.syncinfo1 == 0xFFFFFFFF) { + if(demuxer->audio->id>=-1) film_chunk.pts = (float)total_audio_bytes / (float)sh_audio->wf->nAvgBytesPerSec; total_audio_bytes += film_chunk.chunk_size;