how to find video and audio stream times without the deprecated values? Fork: libav 10.5

972 views Asked by At

After looking into the documentation, AVStream.pts has been deprecated. Before I was using this loop to try and get the video and audio time. it's the same as whats in the api-example.c (which no longer works):

if (audioStream_)
    {
        VideoTime = (double)videoStream_->pts.val*videoStream_->time_base.num/videoStream_->time_base.den;
        do
        {
            AudioTime = (double)audioStream_->pts.val*audioStream_->time_base.num/audioStream_->time_base.den;
            ret = WriteAudioFrame();
        }
        while (AudioTime < VideoTime && ret);
        if (ret < 0)
            return ret;
    }

what is the current alternative? I haven't been able to get anything to work as of yet and I've been searching for around 3 hours.

1

There are 1 answers

5
llogan On

According to doc/APIchanges:

2014-05-19 - 999a99c / a312f71 - lavf 55.38.101 / 55.17.1 - avformat.h
Deprecate AVStream.pts and the AVFrac struct, which was its only use
case. Use av_stream_get_end_pts().

I don't know where you got api-example.c, but that has been moved to doc/examples/decoding_encoding.c (I'm referring to code from the current git master branch).