On 01/20/2012 02:06 AM, Anton Khirnov wrote:

> 
> On Thu, 19 Jan 2012 15:01:20 -0500, Justin Ruggles <[email protected]> 
> wrote:
>> 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);
> 
> Is the timebase allowed to change during read packet like this?
> I expect it's not.


It's happening before a packet is output, so I don't see why not. But I
can merge 5 and 6 if you prefer.

-Justin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to