diff options
author | Anton Khirnov <anton@khirnov.net> | 2014-05-18 21:20:25 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2014-05-19 13:12:46 +0200 |
commit | 9929b3564c0dca42ed7baa6798ef15b6f0013c83 (patch) | |
tree | e75e54ef7144fec91222b5ea74b25d2aff0653aa /libavcodec/pthread_frame.c | |
parent | cdf58f0599c39852ee3beafe5f64af7d57d4215b (diff) | |
download | ffmpeg-9929b3564c0dca42ed7baa6798ef15b6f0013c83.tar.gz |
pthread_frame: simplify the code by using new AVPacket API
This also handles side data properly.
Diffstat (limited to 'libavcodec/pthread_frame.c')
-rw-r--r-- | libavcodec/pthread_frame.c | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c index 34ca9a6fb7..66b1b20e96 100644 --- a/libavcodec/pthread_frame.c +++ b/libavcodec/pthread_frame.c @@ -63,8 +63,6 @@ typedef struct PerThreadContext { AVCodecContext *avctx; ///< Context used to decode packets passed to this thread. AVPacket avpkt; ///< Input packet (for decoding) or output (for encoding). - uint8_t *buf; ///< backup storage for packet data when the input packet is not refcounted - int allocated_buf_size; ///< Size allocated for buf AVFrame *frame; ///< Output frame (for decoding) or input (for encoding). int got_frame; ///< The output of got_picture_ptr from the last avcodec_decode_video() call. @@ -317,16 +315,8 @@ static int submit_packet(PerThreadContext *p, AVPacket *avpkt) } } - av_buffer_unref(&p->avpkt.buf); - p->avpkt = *avpkt; - if (avpkt->buf) - p->avpkt.buf = av_buffer_ref(avpkt->buf); - else { - av_fast_malloc(&p->buf, &p->allocated_buf_size, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE); - p->avpkt.data = p->buf; - memcpy(p->buf, avpkt->data, avpkt->size); - memset(p->buf + avpkt->size, 0, FF_INPUT_BUFFER_PADDING_SIZE); - } + av_packet_unref(&p->avpkt); + av_packet_ref(&p->avpkt, avpkt); p->state = STATE_SETTING_UP; pthread_cond_signal(&p->input_cond); @@ -542,8 +532,7 @@ void ff_frame_thread_free(AVCodecContext *avctx, int thread_count) pthread_cond_destroy(&p->input_cond); pthread_cond_destroy(&p->progress_cond); pthread_cond_destroy(&p->output_cond); - av_buffer_unref(&p->avpkt.buf); - av_freep(&p->buf); + av_packet_unref(&p->avpkt); av_freep(&p->released_buffers); if (i) { |