[Libav-user] pkt.dts/pts clarification
Gonzalo Garramuno
ggarra13 at gmail.com
Wed Apr 17 20:04:58 CEST 2013
I am looking for the final word on pkt.pts/dts for movies that are not
streaming and how to hold a valid packet queue.
int got_pict = 0;
while( pkt.size > 0 )
{
int err = avcodec_decode_video2( stream->codec, av_frame, &got_pict,
&pkt );
if ( err < 0 ) {
return kDecodeError;
}
if ( got_pict ) {
ptsframe = av_frame_get_best_effort_timestamp( av_frame );
ptsframe = pts2frame( stream, ptsframe );
store_image( ptsframe ); // store image in queue
std::cerr << "STORE REPEAT " << store << " PTSFRAME " << ptsframe
<< " pkt.pts " << pkt.pts
<< " pkt.dts " << pkt.dts
<< " f->pts " << _av_frame->pts << " f->pkt_pts "
<< _av_frame->pkt_pts << " f->pkt_dts "
<< _av_frame->pkt_dts << std::endl;
}
pkt.size -= err;
pkt.data += err;
}
if ( got_pict ) return kDecodeOK;
return kDecodeMissingFrame;
The above works well with decoding images with a proper pts. However, it
does not work well with the "cached" frames of the video (mainly 2
frames in my case).
I am wondering how should I work around that.
More information about the Libav-user
mailing list