[Mplayer-cvslog] CVS: main/libmpdemux demux_film.c,1.6,1.7
Mike Melanson
melanson at mplayer.dev.hu
Mon Mar 18 04:17:23 CET 2002
Update of /cvsroot/mplayer/main/libmpdemux
In directory mplayer:/var/tmp.root/cvs-serv5074/libmpdemux
Modified Files:
demux_film.c
Log Message:
added PTS for audio, but seeking still doesn't work
Index: demux_film.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_film.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- demux_film.c 17 Mar 2002 02:59:04 -0000 1.6
+++ demux_film.c 18 Mar 2002 03:17:20 -0000 1.7
@@ -29,6 +29,8 @@
int chunk_size;
unsigned int syncinfo1;
unsigned int syncinfo2;
+
+ float pts;
} film_chunk_t;
typedef struct _film_data_t
@@ -61,16 +63,17 @@
if (new_current_chunk < 0)
new_current_chunk = 0;
if ((unsigned int)new_current_chunk > film_data->total_chunks)
- new_current_chunk = film_data->total_chunks;
+ new_current_chunk = film_data->total_chunks - 1;
while (((film_data->chunks[new_current_chunk].syncinfo1 == 0xFFFFFFFF) ||
(film_data->chunks[new_current_chunk].syncinfo1 & 0x80000000)) &&
(new_current_chunk > 0))
new_current_chunk--;
-printf (" actual new chunk = %d (syncinfo1 = %08X)\n",
- new_current_chunk, film_data->chunks[new_current_chunk].syncinfo1);
film_data->current_chunk = new_current_chunk;
+
+printf (" (flags = %X) actual new chunk = %d (syncinfo1 = %08X)\n",
+ flags, film_data->current_chunk, film_data->chunks[film_data->current_chunk].syncinfo1);
}
// return value:
@@ -104,7 +107,7 @@
if (stream_read(demuxer->stream, dp->buffer, film_chunk.chunk_size) !=
film_chunk.chunk_size)
return 0;
- dp->pts = 0;
+ dp->pts = film_chunk.pts;
dp->pos = film_chunk.chunk_offset;
dp->flags = 0;
@@ -141,7 +144,7 @@
if (stream_read(demuxer->stream, dp->buffer + 10,
film_chunk.chunk_size - 12) != (film_chunk.chunk_size - 12))
return 0;
- dp->pts = (film_chunk.syncinfo1 & 0x7FFFFFFF) / sh_video->fps;
+ dp->pts = film_chunk.pts;
dp->pos = film_chunk.chunk_offset;
dp->flags = (film_chunk.syncinfo1 & 0x80000000) ? 1 : 0;
@@ -159,7 +162,7 @@
else
{
ds_read_packet(demuxer->video, demuxer->stream, film_chunk.chunk_size,
- (film_chunk.syncinfo1 & 0x7FFFFFFF) / sh_video->fps,
+ film_chunk.pts,
film_chunk.chunk_offset, (film_chunk.syncinfo1 & 0x80000000) ? 1 : 0);
film_data->current_chunk++;
}
@@ -182,6 +185,7 @@
int audio_channels;
unsigned int film_version;
int counting_chunks;
+ unsigned int total_audio_bytes = 0;
film_data = (film_data_t *)malloc(sizeof(film_data_t));
film_data->total_chunks = 0;
@@ -309,7 +313,6 @@
film_chunk.chunk_size = stream_read_dword(demuxer->stream);
film_chunk.syncinfo1 = stream_read_dword(demuxer->stream);
film_chunk.syncinfo2 = stream_read_dword(demuxer->stream);
- film_data->chunks[i] = film_chunk;
// count chunks for the purposes of seeking
if (counting_chunks)
@@ -323,9 +326,22 @@
else
film_data->chunks_per_second++;
}
+
+ // precalculate PTS
+ if (film_chunk.syncinfo1 == 0xFFFFFFFF)
+ {
+ film_chunk.pts =
+ (float)total_audio_bytes / (float)sh_audio->wf->nAvgBytesPerSec;
+ total_audio_bytes += film_chunk.chunk_size;
+ }
+ else
+ film_chunk.pts =
+ (film_chunk.syncinfo1 & 0x7FFFFFFF) / sh_video->fps;
+
+ film_data->chunks[i] = film_chunk;
}
- // in some FILM files (notable '1.09'), the length of the FDSC chunk
+ // in some FILM files (notably '1.09'), the length of the FDSC chunk
// follows different rules
if (chunk_size == (film_data->total_chunks * 16))
header_size -= 16;
More information about the MPlayer-cvslog
mailing list