VLC  4.0.0-dev
Data Structures | Functions
decoder_helpers.c File Reference
Include dependency graph for decoder_helpers.c:

Data Structures

struct  vlc_decoder_device_priv
 
struct  vlc_video_context
 

Functions

void decoder_Init (decoder_t *p_dec, const es_format_t *restrict p_fmt)
 
void decoder_Clean (decoder_t *p_dec)
 Unload a decoder module and reset the input/output formats. More...
 
void decoder_Destroy (decoder_t *p_dec)
 Destroy a decoder and reset the structure. More...
 
int decoder_UpdateVideoFormat (decoder_t *dec)
 Updates the video output format. More...
 
int decoder_UpdateVideoOutput (decoder_t *dec, vlc_video_context *vctx_out)
 Creates/Updates the rest of the video output pipeline. More...
 
picture_t * decoder_NewPicture (decoder_t *dec)
 Allocates an output picture buffer. More...
 
void decoder_AbortPictures (decoder_t *dec, bool abort)
 Abort any calls of decoder_NewPicture. More...
 
static int decoder_device_Open (void *func, bool forced, va_list ap)
 
vlc_decoder_device * vlc_decoder_device_Create (vout_window_t *window)
 Create a decoder device from a window. More...
 
vlc_decoder_device * vlc_decoder_device_Hold (vlc_decoder_device *device)
 Hold a decoder device. More...
 
void vlc_decoder_device_Release (vlc_decoder_device *device)
 Release a decoder device. More...
 
vlc_video_context * vlc_video_context_Create (vlc_decoder_device *device, enum vlc_video_context_type private_type, size_t private_size, const struct vlc_video_context_operations *ops)
 
void * vlc_video_context_GetPrivate (vlc_video_context *vctx, enum vlc_video_context_type type)
 
enum vlc_video_context_type vlc_video_context_GetType (const vlc_video_context *vctx)
 
vlc_video_context * vlc_video_context_Hold (vlc_video_context *vctx)
 
void vlc_video_context_Release (vlc_video_context *vctx)
 
vlc_decoder_device * vlc_video_context_HoldDevice (vlc_video_context *vctx)
 Get the decoder device used by the device context. More...
 

Function Documentation

◆ decoder_AbortPictures()

void decoder_AbortPictures ( decoder_t *  dec,
bool  b_abort 
)

Abort any calls of decoder_NewPicture.

If b_abort is true, all pending and futures calls of decoder_NewPicture will be aborted. This function can be used by asynchronous video decoders to unblock a thread that is waiting for a picture.

References decoder_t::cbs, decoder_t::fmt_in, es_format_t::i_cat, decoder_owner_callbacks::video, VIDEO_ES, and vlc_assert.

Referenced by decoder_GetDecoderDevice().

◆ decoder_Clean()

void decoder_Clean ( decoder_t *  p_dec)

Unload a decoder module and reset the input/output formats.

To be used by decoder owners.

References es_format_Clean(), decoder_t::fmt_in, decoder_t::fmt_out, module_unneed, decoder_t::p_description, decoder_t::p_module, and vlc_meta_Delete().

Referenced by decoder_Destroy(), decoder_GetDecoderDevice(), DecoderThread_Reload(), DeleteDecoder(), and LoadDecoder().

◆ decoder_Destroy()

void decoder_Destroy ( decoder_t *  p_dec)

Destroy a decoder and reset the structure.

To be used by decoder owners.

References decoder_Clean(), and vlc_object_delete.

Referenced by CreateDecoder(), decoder_GetDecoderDevice(), DeleteDecoder(), image_HandlerDelete(), and ImageRead().

◆ decoder_device_Open()

static int decoder_device_Open ( void *  func,
bool  forced,
va_list  ap 
)
static

◆ decoder_Init()

void decoder_Init ( decoder_t *  p_dec,
const es_format_t *restrict  p_fmt 
)

◆ decoder_NewPicture()

picture_t* decoder_NewPicture ( decoder_t *  dec)

Allocates an output picture buffer.

This function pulls an output picture buffer for the decoder from the buffer pool of the video output. The picture must be released with picture_Release() when it is no longer referenced by the decoder.

Note
This function is reentrant. However, decoder_UpdateVideoFormat() cannot be used concurrently; the caller is responsible for serialization.
Warning
The behaviour is undefined if decoder_UpdateVideoFormat() was not called or if the last call returned an error.
Returns
a picture buffer on success, NULL on error

References decoder_t::cbs, decoder_t::fmt_in, decoder_t::fmt_out, es_format_t::i_cat, picture_NewFromFormat(), decoder_owner_callbacks::video, es_format_t::video, VIDEO_ES, and vlc_assert.

Referenced by decoder_GetDecoderDevice().

◆ decoder_UpdateVideoFormat()

int decoder_UpdateVideoFormat ( decoder_t *  dec)

Updates the video output format.

This function notifies the video output pipeline of a new video output format (fmt_out.video). If there was no video output from the decoder so far or if the video output format has changed, a new video output will be set up. decoder_NewPicture() can then be used to allocate picture buffers.

If the format is unchanged, this function has no effects and returns zero.

Note
This function is not reentrant.
Returns
0 if the video output was set up successfully, -1 otherwise.

References decoder_UpdateVideoOutput().

Referenced by decoder_GetDecoderDevice().

◆ decoder_UpdateVideoOutput()

int decoder_UpdateVideoOutput ( decoder_t *  dec,
vlc_video_context *  vctx_out 
)

Creates/Updates the rest of the video output pipeline.

After a call to decoder_GetDecoderDevice() this function notifies the video output pipeline of a new video output format (fmt_out.video). If there was no video output from the decoder so far, a new decoder video output will be set up. decoder_NewPicture() can then be used to allocate picture buffers.

If the format is unchanged, this function has no effects and returns zero.

Note
This function is not reentrant.
Returns
0 if the video output was set up successfully, -1 otherwise.

References decoder_t::cbs, vlc_rational_t::den, decoder_t::fmt_in, decoder_t::fmt_out, vlc_chroma_description_t::h, es_format_t::i_cat, video_format_t::i_chroma, es_format_t::i_codec, video_format_t::i_height, video_format_t::i_sar_den, video_format_t::i_sar_num, video_format_t::i_visible_height, video_format_t::i_visible_width, video_format_t::i_width, video_format_t::i_x_offset, video_format_t::i_y_offset, msg_Warn, vlc_chroma_description_t::p, vlc_chroma_description_t::plane_count, unlikely, var_CreateGetBool(), decoder_owner_callbacks::video, es_format_t::video, VIDEO_ES, video_format_AdjustColorSpace(), vlc_assert, vlc_fourcc_GetChromaDescription(), vlc_fourcc_IsYUV(), vlc_ureduce(), and vlc_chroma_description_t::w.

Referenced by decoder_GetDecoderDevice(), and decoder_UpdateVideoFormat().

◆ vlc_video_context_Create()

vlc_video_context* vlc_video_context_Create ( vlc_decoder_device *  device,
enum vlc_video_context_type  private_type,
size_t  private_size,
const struct vlc_video_context_operations *  ops 
)

◆ vlc_video_context_GetPrivate()

void* vlc_video_context_GetPrivate ( vlc_video_context *  vctx,
enum vlc_video_context_type  type 
)

◆ vlc_video_context_GetType()

enum vlc_video_context_type vlc_video_context_GetType ( const vlc_video_context *  vctx)

◆ vlc_video_context_Hold()

vlc_video_context* vlc_video_context_Hold ( vlc_video_context *  vctx)

◆ vlc_video_context_HoldDevice()

vlc_decoder_device* vlc_video_context_HoldDevice ( vlc_video_context *  )

Get the decoder device used by the device context.

This will increment the refcount of the decoder device.

References vlc_video_context::device, and vlc_decoder_device_Hold().

Referenced by vout_Start().

◆ vlc_video_context_Release()

void vlc_video_context_Release ( vlc_video_context *  vctx)