[vlc-devel] [PATCH 7/9] avcodec: video: use send_packet/receive_frame API

ileoo at videolan.org ileoo at videolan.org
Sun Sep 4 14:34:07 CEST 2016


From: Ilkka Ollakka <ileoo at videolan.org>

---
 modules/codec/avcodec/video.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index c2f96c6..83bb454 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -796,7 +796,7 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
 
     while( !p_block || p_block->i_buffer > 0 || p_sys->b_flush )
     {
-        int i_used, b_gotpicture;
+        int i_used;
         AVPacket pkt;
 
         AVFrame *frame = av_frame_alloc();
@@ -839,9 +839,11 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
             p_block->i_dts = VLC_TS_INVALID;
         }
 
-        i_used = avcodec_decode_video2( p_context, frame, &b_gotpicture,
-                                        &pkt );
-        av_free_packet( &pkt );
+        int not_able_to_send_packet = avcodec_send_packet( p_context, &pkt );
+        av_packet_unref( &pkt );
+
+        int not_received_frame = avcodec_receive_frame( p_context, frame);
+        i_used = p_block->i_size;
 
         wait_mt( p_sys );
 
@@ -873,7 +875,7 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
         }
 
         /* Nothing to display */
-        if( !b_gotpicture )
+        if( not_received_frame )
         {
             av_frame_unref(frame);
             if( i_used == 0 ) break;
-- 
2.6.6



More information about the vlc-devel mailing list