-
-
Save lindenle/72fab989fc053a89c6c0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//set teh timestamp to 0 before we start | |
pReadFrame->pts = 0; | |
while (av_read_frame(pReadFormatCtx, &readPkt) >= 0) { | |
AVPacket origPkt = readPkt; | |
do { | |
lastPTSValue = pReadFrame->pts; | |
//the decode packet blows away the last values | |
ret = decode_packet(&gotFrame, 0); | |
fprintf(stdout,"pts/dts read: %lld\n",pReadFrame->pts); | |
pReadFrame->pts = lastPTSValue; | |
if (ret < 0) | |
break; | |
fprintf(stdout,"pts/dts read: %lld\n",pReadFrame->pts); | |
//what type of frame was this | |
if ( pWriteVideo_st && readPkt.stream_index == readVideoStreamIdx ) { | |
write_video_frame(pWriteFormatCtx, pWriteVideo_st); | |
pReadFrame->pts += av_rescale_q(1, pWriteVideo_st->codec->time_base, pWriteVideo_st->time_base); | |
} else if (pWriteAudio_st && readPkt.stream_index == readAudioStreamIdx) { | |
write_audio_frame(pWriteFormatCtx,pWriteAudio_st); | |
} else { | |
fprintf(stderr,"Something bad happened in decode"); | |
return -1; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment