VLC  4.0.0-dev
Files | Data Structures | Typedefs
Collaboration diagram for Decoder:

Files

file  vlc_codec.h
 

Data Structures

struct  decoder_owner_callbacks
 
struct  decoder_t
 
struct  decoder_cc_desc_t
 

Typedefs

typedef struct decoder_cc_desc_t decoder_cc_desc_t
 
static vlc_decoder_devicedecoder_GetDecoderDevice (decoder_t *dec)
 Creates/Updates the output decoder device. More...
 
VLC_EXPORT int decoder_UpdateVideoOutput (decoder_t *dec, vlc_video_context *vctx_out)
 Creates/Updates the rest of the video output pipeline. More...
 
VLC_EXPORT int decoder_UpdateVideoFormat (decoder_t *dec)
 Updates the video output format. More...
 
VLC_EXPORT picture_tdecoder_NewPicture (decoder_t *dec)
 Allocates an output picture buffer. More...
 
VLC_EXPORT void decoder_Init (decoder_t *dec, const es_format_t *)
 Initialize a decoder structure before creating the decoder. More...
 
VLC_EXPORT void decoder_Destroy (decoder_t *p_dec)
 Destroy a decoder and reset the structure. More...
 
VLC_EXPORT void decoder_Clean (decoder_t *p_dec)
 Unload a decoder module and reset the input/output formats. More...
 
static void decoder_QueueVideo (decoder_t *dec, picture_t *p_pic)
 This function queues a single picture to the video output. More...
 
static void decoder_QueueCc (decoder_t *dec, block_t *p_cc, const decoder_cc_desc_t *p_desc)
 This function queues the Closed Captions. More...
 
static void decoder_QueueAudio (decoder_t *dec, block_t *p_aout_buf)
 This function queues a single audio block to the audio output. More...
 
static void decoder_QueueSub (decoder_t *dec, subpicture_t *p_spu)
 This function queues a single subtitle to the video output. More...
 
static int decoder_UpdateAudioFormat (decoder_t *dec)
 This function notifies the audio output pipeline of a new audio output format (fmt_out.audio). More...
 
VLC_EXPORT block_tdecoder_NewAudioBuffer (decoder_t *, int i_nb_samples)
 This function will return a new audio buffer usable by a decoder as an output buffer. More...
 
static subpicture_tdecoder_NewSubpicture (decoder_t *dec, const subpicture_updater_t *p_dyn)
 This function will return a new subpicture usable by a decoder as an output buffer. More...
 
static int decoder_GetInputAttachments (decoder_t *dec, input_attachment_t ***ppp_attachment, int *pi_attachment)
 This function gives all input attachments at once. More...
 
static vlc_tick_t decoder_GetDisplayDate (decoder_t *dec, vlc_tick_t system_now, vlc_tick_t i_ts)
 This function converts a decoder timestamp into a display date comparable to vlc_tick_now(). More...
 
static float decoder_GetDisplayRate (decoder_t *dec)
 This function returns the current input rate. More...
 
typedef struct vlc_input_decoder_t vlc_input_decoder_t
 
typedef struct input_resource_t input_resource_t
 This defines an opaque input resource handler. More...
 
VLC_EXPORT vlc_input_decoder_tvlc_input_decoder_Create (vlc_object_t *, const es_format_t *, input_resource_t *)
 Spawn a decoder thread outside of the input thread. More...
 
VLC_EXPORT void vlc_input_decoder_Delete (vlc_input_decoder_t *)
 Kills a decoder thread and waits until it's finished. More...
 
VLC_EXPORT void vlc_input_decoder_Decode (vlc_input_decoder_t *, block_t *, bool b_do_pace)
 Put a block_t in the decoder's fifo. More...
 
VLC_EXPORT void vlc_input_decoder_Drain (vlc_input_decoder_t *)
 Signals that there are no further blocks to decode, and requests that the decoder drain all pending buffers. More...
 
VLC_EXPORT void vlc_input_decoder_Flush (vlc_input_decoder_t *)
 Requests that the decoder immediately discard all pending buffers. More...
 
VLC_EXPORT int vlc_input_decoder_SetSpuHighlight (vlc_input_decoder_t *, const vlc_spu_highlight_t *)
 
VLC_EXPORT input_resource_tinput_resource_New (vlc_object_t *)
 It creates an empty input resource handler. More...
 
VLC_EXPORT void input_resource_Release (input_resource_t *)
 It releases an input resource. More...
 
VLC_EXPORT audio_output_tinput_resource_HoldAout (input_resource_t *)
 
VLC_EXPORT audio_output_tinput_resource_GetAout (input_resource_t *)
 This function creates or recycles an audio output. More...
 
VLC_EXPORT void input_resource_PutAout (input_resource_t *, audio_output_t *)
 This function retains or destroys an audio output. More...
 

Detailed Description

Audio, video and text decoders

Typedef Documentation

◆ decoder_cc_desc_t

◆ input_resource_t

This defines an opaque input resource handler.

◆ vlc_input_decoder_t

Function Documentation

◆ decoder_Clean()

VLC_EXPORT 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(), DecoderThread_Reload(), DeleteDecoder(), and LoadDecoder().

◆ decoder_Destroy()

VLC_EXPORT 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_GetDecoderDevice()

static vlc_decoder_device* decoder_GetDecoderDevice ( decoder_t dec)
inlinestatic

Creates/Updates the output decoder device.

This function notifies the video output pipeline of a new video output format (fmt_out.video). If there was no decoder device so far or a new decoder device is required, a new decoder device will be set up. decoder_UpdateVideoOutput() can then be used.

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

Parameters
decthe decoder object
Note
This function is not reentrant.
Returns
the received of the held decoder device, NULL not to get one

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

◆ decoder_GetDisplayDate()

static vlc_tick_t decoder_GetDisplayDate ( decoder_t dec,
vlc_tick_t  system_now,
vlc_tick_t  i_ts 
)
inlinestatic

This function converts a decoder timestamp into a display date comparable to vlc_tick_now().

You MUST use it only for gathering statistics about speed.

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

◆ decoder_GetDisplayRate()

static float decoder_GetDisplayRate ( decoder_t dec)
inlinestatic

This function returns the current input rate.

You MUST use it only for gathering statistics about speed.

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

◆ decoder_GetInputAttachments()

static int decoder_GetInputAttachments ( decoder_t dec,
input_attachment_t ***  ppp_attachment,
int *  pi_attachment 
)
inlinestatic

This function gives all input attachments at once.

You MUST release the returned values

References decoder_t::cbs, decoder_owner_callbacks::get_attachments, vlc_assert, and VLC_EGENERIC.

◆ decoder_Init()

VLC_EXPORT void decoder_Init ( decoder_t dec,
const es_format_t  
)

Initialize a decoder structure before creating the decoder.

To be used by decoder owners. By default frame drop is not allowed.

◆ decoder_NewAudioBuffer()

VLC_EXPORT block_t* decoder_NewAudioBuffer ( decoder_t ,
int  i_nb_samples 
)

This function will return a new audio buffer usable by a decoder as an output buffer.

It must be released with block_Release() or returned it to the caller as a decoder_QueueAudio parameter.

References es_format_t::audio, block_Alloc(), decoder_t::fmt_out, audio_format_t::i_bytes_per_frame, audio_format_t::i_frame_length, block_t::i_length, block_t::i_nb_samples, block_t::i_pts, and likely.

◆ decoder_NewPicture()

VLC_EXPORT 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.

◆ decoder_NewSubpicture()

static subpicture_t* decoder_NewSubpicture ( decoder_t dec,
const subpicture_updater_t p_dyn 
)
inlinestatic

This function will return a new subpicture usable by a decoder as an output buffer.

You have to release it using subpicture_Delete() or by returning it to the caller as a decoder_QueueSub parameter.

References decoder_t::cbs, decoder_t::fmt_in, es_format_t::i_cat, msg_Warn, decoder_owner_callbacks::spu, SPU_ES, and vlc_assert.

◆ decoder_QueueAudio()

static void decoder_QueueAudio ( decoder_t dec,
block_t p_aout_buf 
)
inlinestatic

This function queues a single audio block to the audio output.

Note
The caller doesn't own the audio block anymore after this call (even in case of error).

References decoder_owner_callbacks::audio, AUDIO_ES, decoder_t::cbs, decoder_t::fmt_in, es_format_t::i_cat, block_t::p_next, and vlc_assert.

◆ decoder_QueueCc()

static void decoder_QueueCc ( decoder_t dec,
block_t p_cc,
const decoder_cc_desc_t p_desc 
)
inlinestatic

This function queues the Closed Captions.

Parameters
decthe decoder object
p_ccthe closed-caption to queue
p_descdecoder_cc_desc_t description structure

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

◆ decoder_QueueSub()

static void decoder_QueueSub ( decoder_t dec,
subpicture_t p_spu 
)
inlinestatic

This function queues a single subtitle to the video output.

Note
The caller doesn't own the subtitle anymore after this call (even in case of error).

References decoder_t::cbs, decoder_t::fmt_in, es_format_t::i_cat, subpicture_t::p_next, decoder_owner_callbacks::spu, SPU_ES, and vlc_assert.

◆ decoder_QueueVideo()

static void decoder_QueueVideo ( decoder_t dec,
picture_t p_pic 
)
inlinestatic

This function queues a single picture to the video output.

Note
The caller doesn't own the picture anymore after this call (even in case of error). FIXME: input_DecoderFrameNext won't work if a module use this function.

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

◆ decoder_UpdateAudioFormat()

static int decoder_UpdateAudioFormat ( decoder_t dec)
inlinestatic

This function notifies the audio output pipeline of a new audio output format (fmt_out.audio).

If there is currently no audio output or if the audio output format has changed, a new audio output will be set up.

Returns
0 if the audio output is working, -1 if not.

References decoder_owner_callbacks::audio, AUDIO_ES, decoder_t::cbs, decoder_t::fmt_in, es_format_t::i_cat, and vlc_assert.

◆ decoder_UpdateVideoFormat()

VLC_EXPORT 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()

VLC_EXPORT 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_UpdateVideoFormat().

◆ input_resource_GetAout()

VLC_EXPORT audio_output_t* input_resource_GetAout ( input_resource_t )

◆ input_resource_HoldAout()

VLC_EXPORT audio_output_t* input_resource_HoldAout ( input_resource_t )
Returns
the current audio output if any. Use aout_Release() to drop the reference.

References aout_Hold(), input_resource_t::lock_hold, input_resource_t::p_aout, vlc_mutex_lock(), and vlc_mutex_unlock().

Referenced by ControlNav(), ViewpointApply(), and vlc_player_aout_Hold().

◆ input_resource_New()

VLC_EXPORT input_resource_t* input_resource_New ( vlc_object_t )

◆ input_resource_PutAout()

VLC_EXPORT void input_resource_PutAout ( input_resource_t ,
audio_output_t  
)

◆ input_resource_Release()

VLC_EXPORT void input_resource_Release ( input_resource_t )

◆ vlc_input_decoder_Create()

VLC_EXPORT vlc_input_decoder_t* vlc_input_decoder_Create ( vlc_object_t ,
const es_format_t ,
input_resource_t  
)

Spawn a decoder thread outside of the input thread.

References decoder_New().

◆ vlc_input_decoder_Decode()

VLC_EXPORT void vlc_input_decoder_Decode ( vlc_input_decoder_t p_owner,
block_t p_block,
bool  b_do_pace 
)

◆ vlc_input_decoder_Delete()

VLC_EXPORT void vlc_input_decoder_Delete ( vlc_input_decoder_t p_owner)

◆ vlc_input_decoder_Drain()

VLC_EXPORT void vlc_input_decoder_Drain ( vlc_input_decoder_t p_owner)

Signals that there are no further blocks to decode, and requests that the decoder drain all pending buffers.

This is used to ensure that all intermediate buffers empty and no samples get lost at the end of the stream.

Note
The function does not actually wait for draining. It just signals that draining should be performed once the decoder has emptied FIFO.

References vlc_input_decoder_t::b_draining, vlc_input_decoder_t::p_fifo, vlc_fifo_Lock(), vlc_fifo_Signal(), and vlc_fifo_Unlock().

Referenced by EsOutDrainCCChannels(), EsOutDrainDecoder(), and EsOutVaPrivControlLocked().

◆ vlc_input_decoder_Flush()

VLC_EXPORT void vlc_input_decoder_Flush ( vlc_input_decoder_t p_owner)

◆ vlc_input_decoder_SetSpuHighlight()

VLC_EXPORT int vlc_input_decoder_SetSpuHighlight ( vlc_input_decoder_t ,
const vlc_spu_highlight_t  
)