libavcodec/thread.h File Reference

Multithreading support functions. More...

#include "config.h"
#include "avcodec.h"

Go to the source code of this file.

Functions

void ff_thread_flush (AVCodecContext *avctx)
 Waits for decoding threads to finish and resets internal state.
int ff_thread_decode_frame (AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, AVPacket *avpkt)
 Submits a new frame to a decoding thread.
void ff_thread_finish_setup (AVCodecContext *avctx)
 If the codec defines update_thread_context(), call this when they are ready for the next thread to start decoding the next frame.
void ff_thread_report_progress (AVFrame *f, int progress, int field)
 Notifies later decoding threads when part of their reference picture is ready.
void ff_thread_await_progress (AVFrame *f, int progress, int field)
 Waits for earlier decoding threads to finish reference pictures Call this before accessing some part of a picture, with a given value for progress, and it will return after the responsible decoding thread calls ff_thread_report_progress() with the same or higher value for progress.
int ff_thread_get_buffer (AVCodecContext *avctx, AVFrame *f)
 Wrapper around get_buffer() for frame-multithreaded codecs.
void ff_thread_release_buffer (AVCodecContext *avctx, AVFrame *f)
 Wrapper around release_buffer() frame-for multithreaded codecs.
int ff_thread_init (AVCodecContext *s, int thread_count)
void ff_thread_free (AVCodecContext *s)
 Free what has been allocated by ff_thread_init().


Detailed Description

Multithreading support functions.

Author:
Alexander Strange <astrange@ithinksw.com>

Definition in file thread.h.


Function Documentation

void ff_thread_await_progress ( AVFrame f,
int  progress,
int  field 
)

Waits for earlier decoding threads to finish reference pictures Call this before accessing some part of a picture, with a given value for progress, and it will return after the responsible decoding thread calls ff_thread_report_progress() with the same or higher value for progress.

Parameters:
f The picture being referenced.
progress Value, in arbitrary units, to wait for.
field The field being referenced, for field-picture codecs. 0 for top field or frame pictures, 1 for bottom field.

Definition at line 579 of file pthread.c.

Referenced by await_reference_row().

int ff_thread_decode_frame ( AVCodecContext avctx,
AVFrame picture,
int *  got_picture_ptr,
AVPacket avpkt 
)

Submits a new frame to a decoding thread.

Returns the next available frame in picture. *got_picture_ptr will be 0 if none is available.

Parameters are the same as avcodec_decode_video2().

Definition at line 489 of file pthread.c.

Referenced by avcodec_decode_video2().

void ff_thread_finish_setup ( AVCodecContext avctx  ) 

If the codec defines update_thread_context(), call this when they are ready for the next thread to start decoding the next frame.

After calling it, do not change any variables read by the update_thread_context() method, or call ff_thread_get_buffer().

Parameters:
avctx The context.

Definition at line 597 of file pthread.c.

Referenced by ff_thread_get_buffer(), and frame_worker_thread().

void ff_thread_flush ( AVCodecContext avctx  ) 

Waits for decoding threads to finish and resets internal state.

Called by avcodec_flush_buffers().

Parameters:
avctx The context.

Definition at line 743 of file pthread.c.

Referenced by avcodec_flush_buffers().

void ff_thread_free ( AVCodecContext s  ) 

Free what has been allocated by ff_thread_init().

Must be called after decoding has finished, especially do not call while avcodec_thread_execute() is running.

Definition at line 902 of file pthread.c.

Referenced by avcodec_close(), avcodec_thread_free(), ff_thread_init(), and thread_init().

int ff_thread_get_buffer ( AVCodecContext avctx,
AVFrame f 
)

Wrapper around get_buffer() for frame-multithreaded codecs.

Call this function instead of avctx->get_buffer(f). Cannot be called after the codec has called ff_thread_finish_setup().

Parameters:
avctx The current context.
f The frame to write into.

Definition at line 776 of file pthread.c.

int ff_thread_init ( AVCodecContext s,
int  thread_count 
)

Definition at line 883 of file pthread.c.

Referenced by avcodec_open(), and avcodec_thread_init().

void ff_thread_release_buffer ( AVCodecContext avctx,
AVFrame f 
)

Wrapper around release_buffer() frame-for multithreaded codecs.

Call this function instead of avctx->release_buffer(f). The AVFrame will be copied and the actual release_buffer() call will be performed later. The contents of data pointed to by the AVFrame should not be changed until ff_thread_get_buffer() is called on it.

Parameters:
avctx The current context.
f The picture being released.

Definition at line 837 of file pthread.c.

Referenced by update_frames(), and vp3_decode_end().

void ff_thread_report_progress ( AVFrame f,
int  progress,
int  field 
)

Notifies later decoding threads when part of their reference picture is ready.

Call this when some part of the picture is finished decoding. Later calls with lower values of progress have no effect.

Parameters:
f The picture being decoded.
progress Value, in arbitrary units, of how much of the picture has decoded.
field The field being decoded, for field-picture codecs. 0 for top field or frame pictures, 1 for bottom field.

Definition at line 561 of file pthread.c.

Referenced by vp3_draw_horiz_band().


Generated on Mon May 2 19:50:22 2011 for FFmpeg by  doxygen 1.5.6