Also, use the sample rate as the time base.
---
libavformat/bethsoftvid.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/libavformat/bethsoftvid.c b/libavformat/bethsoftvid.c
index 204960b..6a73f62 100644
--- a/libavformat/bethsoftvid.c
+++ b/libavformat/bethsoftvid.c
@@ -42,9 +42,9 @@ typedef struct BVID_DemuxContext
* to free, unofficial documentation) */
int bethsoft_global_delay;
- /** video presentation time stamp.
- * delay = 16 milliseconds * (global_delay + per_frame_delay) */
- int video_pts;
+ int video_pts; /**< video time stamp */
+ int audio_pts; /**< audio time stamp */
+
uint8_t *palette;
int is_finished;
@@ -122,6 +122,7 @@ static int read_frame(BVID_DemuxContext *vid, AVIOContext
*pb, AVPacket *pkt,
vidbuf_start[vidbuf_nbytes++] = block_type;
// get the video delay (next int16), and set the presentation time
+ // duration = approx. 16 ms * (global_delay + per_frame_delay)
duration = vid->bethsoft_global_delay + avio_rl16(pb);
// set the y offset if it exists (decoder header data should be in data
section)
@@ -226,6 +227,7 @@ static int vid_read_packet(AVFormatContext *s,
// soundblaster DAC used for sample rate, as on specification page
(link above)
s->streams[1]->codec->sample_rate = 1000000 / (256 - avio_r8(pb));
s->streams[1]->codec->bit_rate = s->streams[1]->codec->channels *
s->streams[1]->codec->sample_rate * s->streams[1]->codec->bits_per_coded_sample;
+ avpriv_set_pts_info(s->streams[1], 64, 1,
s->streams[1]->codec->sample_rate);
case AUDIO_BLOCK:
audio_length = avio_rl16(pb);
if ((ret_value = av_get_packet(pb, pkt, audio_length)) !=
audio_length) {
@@ -235,6 +237,9 @@ static int vid_read_packet(AVFormatContext *s,
return AVERROR(EIO);
}
pkt->stream_index = 1;
+ pkt->duration = audio_length;
+ pkt->pts = vid->audio_pts;
+ vid->audio_pts += audio_length;
pkt->flags |= AV_PKT_FLAG_KEY;
return 0;
--
1.7.1
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel