Last active
September 4, 2016 07:08
-
-
Save oozoofrog/1b8305aa7ea88b4030bb1265bfdb1b2a to your computer and use it in GitHub Desktop.
FFmpeg 3.xで新しく追加されたAPIの分析。 ref: http://qiita.com/funcodes/items/20b7c78723c6d1c4a958
This file contains hidden or 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
defer { | |
avcodec_send_packet(avctx, NULL) | |
while true { | |
if AVERROR_EOF == avcodec_receive_packet(avctx, frame) { | |
break | |
} | |
} | |
} | |
while 0 <= av_read_frame(avctx, packet) { | |
// avcodec_decode_video2[audio4](...)を下のコードに変更します。 | |
// もっと簡単に出来ると思いますが。サイドーイフェックトを避けるためほとんど変更しないままで適用してみました。 | |
... | |
var ret = avcodec_send_packet(avctx, packet) | |
// retがAVERROR(EAGAIN)の場合, receive_frameでAVERROR_EOFが返還されるまで、packet繰り返して送ります。 | |
if 0 > ret && ret != AVERROR(EAGAIN) && ret != AVERROR_EOF { | |
if 0 > ret { // error | |
break | |
} | |
continue | |
} | |
ret = avcodec_receive_frame(avctx, frame) | |
if 0 > ret && ret != AVERROR(EAGAIN) && ret != AVERROR_EOF { | |
if 0 > ret { | |
break | |
} | |
} | |
// success to get frame | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment