[Mplayer-cvslog] CVS: main/libmpdemux demux_film.c,1.8,1.9
Arpi of Ize
arpi at mplayer.dev.hu
Mon Apr 1 00:44:06 CEST 2002
Update of /cvsroot/mplayer/main/libmpdemux
In directory mplayer:/var/tmp.root/cvs-serv22534
Modified Files:
demux_film.c
Log Message:
fixed new_chunk calculation at seeking (seeking not work yet) and added -nosound support
Index: demux_film.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_film.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- demux_film.c 31 Mar 2002 02:57:53 -0000 1.8
+++ demux_film.c 31 Mar 2002 22:44:03 -0000 1.9
@@ -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;
More information about the MPlayer-cvslog
mailing list