[vlc-commits] avcodec: encoder: user send_frame/receive_packet in video encoding
Ilkka Ollakka
git at videolan.org
Fri Sep 30 08:43:26 CEST 2016
vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Sun Sep 18 16:25:54 2016 +0300| [25e13fba9260c2e71f50907be4b716b96809f8a2] | committer: Ilkka Ollakka
avcodec: encoder: user send_frame/receive_packet in video encoding
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=25e13fba9260c2e71f50907be4b716b96809f8a2
---
modules/codec/avcodec/encoder.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
index 0174f9e..1748a1f 100644
--- a/modules/codec/avcodec/encoder.c
+++ b/modules/codec/avcodec/encoder.c
@@ -1221,9 +1221,16 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
av_init_packet( &av_pkt );
- if( avcodec_encode_video2( p_sys->p_context, &av_pkt, frame, &is_data ) < 0
- || is_data == 0 )
+ int ret = avcodec_send_frame( p_sys->p_context, frame );
+ if( ret != 0 && ret != AVERROR(EAGAIN) )
{
+ msg_Warn( p_enc, "cannot send one frame to encoder");
+ return NULL;
+ }
+ ret = avcodec_receive_packet( p_sys->p_context, &av_pkt );
+ if( ret != 0 && ret != AVERROR(EAGAIN) )
+ {
+ msg_Warn( p_enc, "cannot encode one frame" );
return NULL;
}
More information about the vlc-commits
mailing list