[vlc-commits] avcodec: video: use send_packet/receive_frame API

Ilkka Ollakka git at videolan.org
Wed Sep 7 11:16:45 CEST 2016


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Sun Sep  4 11:45:28 2016 +0300| [9513e66b43f757aa1037619ee4610b9f1741188b] | committer: Ilkka Ollakka

avcodec: video: use send_packet/receive_frame API

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9513e66b43f757aa1037619ee4610b9f1741188b
---

 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 eebc853..d07ae5d 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -795,7 +795,7 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
 
     while( !p_block || p_block->i_buffer > 0 || eos_spotted )
     {
-        int i_used, b_gotpicture;
+        int i_used;
         AVPacket pkt;
 
         AVFrame *frame = av_frame_alloc();
@@ -838,9 +838,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 );
 
@@ -872,7 +874,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;



More information about the vlc-commits mailing list