VLC 4.0.0-dev
decoder_helpers.c File Reference
Include dependency graph for decoder_helpers.c:

Functions

void decoder_Init (decoder_t *p_dec, es_format_t *restrict fmt_in, 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_tdecoder_NewPicture (decoder_t *dec)
 Allocates an output picture buffer. More...
 
vlc_decoder_devicevlc_encoder_GetDecoderDevice (encoder_t *enc)
 encoder More...
 
void vlc_encoder_Destroy (encoder_t *encoder)
 

Function Documentation

◆ 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_out, module_unneed, decoder_t::p_description, decoder_t::p_module, and vlc_meta_Delete().

Referenced by decoder_Destroy(), 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(), DeleteDecoder(), image_HandlerDelete(), and ImageRead().

◆ decoder_Init()

◆ 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_owner_callbacks::buffer_new, 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.

◆ 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().

◆ 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, decoder_owner_callbacks::format_update, 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_UpdateVideoFormat().

◆ vlc_encoder_GetDecoderDevice()

vlc_decoder_device * vlc_encoder_GetDecoderDevice ( encoder_t enc)