VLC 4.0.0-dev
|
Audio, video and text decoders. More...
Files | |
file | vlc_codec.h |
Decoder and encoder modules interface. | |
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 |
typedef struct vlc_input_decoder_t | vlc_input_decoder_t |
typedef struct vlc_spu_highlight_t | vlc_spu_highlight_t |
typedef struct input_resource_t | input_resource_t |
This defines an opaque input resource handler. | |
vlc_input_decoder_t * | vlc_input_decoder_Create (vlc_object_t *, const es_format_t *, const char *es_id, struct vlc_clock_t *, input_resource_t *) |
Spawn a decoder thread outside of the input thread. | |
void | vlc_input_decoder_Delete (vlc_input_decoder_t *decoder) |
Delete an existing vlc_input_decoder_t instance. | |
void | vlc_input_decoder_Decode (vlc_input_decoder_t *p_dec, struct vlc_frame_t *frame, bool do_pace) |
Put a vlc_frame_t in the decoder's fifo. | |
void | vlc_input_decoder_Drain (vlc_input_decoder_t *) |
Signals that there are no further frames to decode, and requests that the decoder drain all pending buffers. | |
void | vlc_input_decoder_Flush (vlc_input_decoder_t *) |
Requests that the decoder immediately discard all pending buffers. | |
int | vlc_input_decoder_SetSpuHighlight (vlc_input_decoder_t *, const vlc_spu_highlight_t *) |
void | vlc_input_decoder_ChangeDelay (vlc_input_decoder_t *, vlc_tick_t i_delay) |
input_resource_t * | input_resource_New (vlc_object_t *) |
It creates an empty input resource handler. | |
void | input_resource_Release (input_resource_t *) |
It releases an input resource. | |
static vlc_decoder_device * | decoder_GetDecoderDevice (decoder_t *dec) |
Creates/Updates the output decoder device. | |
int | decoder_UpdateVideoOutput (decoder_t *dec, vlc_video_context *vctx_out) |
Creates/Updates the rest of the video output pipeline. | |
int | decoder_UpdateVideoFormat (decoder_t *dec) |
Updates the video output format. | |
picture_t * | decoder_NewPicture (decoder_t *dec) |
Allocates an output picture buffer. | |
void | decoder_Init (decoder_t *dec, es_format_t *fmt_in, const es_format_t *fmt) |
Initialize a decoder structure before creating the decoder. | |
void | decoder_Destroy (decoder_t *p_dec) |
Destroy a decoder and reset the structure. | |
void | decoder_Clean (decoder_t *p_dec) |
Unload a decoder module and reset the input/output formats. | |
static void | decoder_QueueVideo (decoder_t *dec, picture_t *p_pic) |
This function queues a single picture to the video output. | |
static void | decoder_QueueCc (decoder_t *dec, vlc_frame_t *p_cc, const decoder_cc_desc_t *p_desc) |
This function queues the Closed Captions. | |
static void | decoder_QueueAudio (decoder_t *dec, vlc_frame_t *p_aout_buf) |
This function queues a single audio block to the audio output. | |
static void | decoder_QueueSub (decoder_t *dec, subpicture_t *p_spu) |
This function queues a single subtitle to the video output. | |
static int | decoder_UpdateAudioFormat (decoder_t *dec) |
This function notifies the audio output pipeline of a new audio output format (fmt_out.audio). | |
vlc_frame_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. | |
static subpicture_t * | decoder_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. | |
static int | decoder_GetInputAttachments (decoder_t *dec, input_attachment_t ***ppp_attachment, int *pi_attachment) |
This function gives all input attachments at once. | |
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(). | |
static float | decoder_GetDisplayRate (decoder_t *dec) |
This function returns the current input rate. | |
Audio, video and text decoders.
typedef struct decoder_cc_desc_t decoder_cc_desc_t |
typedef struct input_resource_t input_resource_t |
This defines an opaque input resource handler.
typedef struct vlc_input_decoder_t vlc_input_decoder_t |
typedef struct vlc_spu_highlight_t vlc_spu_highlight_t |
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().
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().
|
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.
dec | the decoder object |
References decoder_t::cbs, decoder_t::fmt_in, decoder_owner_callbacks::get_device, es_format_t::i_cat, unlikely, decoder_owner_callbacks::video, VIDEO_ES, and vlc_assert.
|
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, decoder_owner_callbacks::get_display_date, es_format_t::i_cat, decoder_owner_callbacks::video, VIDEO_ES, vlc_assert, and VLC_TICK_INVALID.
|
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, decoder_owner_callbacks::get_display_rate, es_format_t::i_cat, decoder_owner_callbacks::video, VIDEO_ES, and vlc_assert.
|
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.
void decoder_Init | ( | decoder_t * | dec, |
es_format_t * | fmt_in, | ||
const es_format_t * | fmt | ||
) |
Initialize a decoder structure before creating the decoder.
To be used by decoder owners. By default frame drop is not allowed.
dec | the decoder to be initialized |
fmt_in | the es_format_t where the decoder owner stores the input ES format |
fmt | the input es_format_t used to initialize the decoder |
vlc_frame_t * decoder_NewAudioBuffer | ( | decoder_t * | dec, |
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, vlc_frame_t::i_length, vlc_frame_t::i_nb_samples, vlc_frame_t::i_pts, and likely.
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.
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.
|
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 subpicture_t::b_subtitle, decoder_owner_callbacks::buffer_new, decoder_t::cbs, decoder_t::fmt_in, es_format_t::i_cat, msg_Warn, decoder_owner_callbacks::spu, SPU_ES, and vlc_assert.
|
inlinestatic |
This function queues a single audio block to the audio output.
References decoder_owner_callbacks::audio, AUDIO_ES, decoder_t::cbs, decoder_t::fmt_in, es_format_t::i_cat, vlc_frame_t::p_next, decoder_owner_callbacks::queue, and vlc_assert.
|
inlinestatic |
This function queues the Closed Captions.
dec | the decoder object |
p_cc | the closed-caption to queue |
p_desc | decoder_cc_desc_t description structure |
References block_Release, decoder_t::cbs, decoder_t::fmt_in, es_format_t::i_cat, decoder_owner_callbacks::queue_cc, decoder_owner_callbacks::video, VIDEO_ES, and vlc_assert.
|
inlinestatic |
This function queues a single subtitle to the video output.
References decoder_t::cbs, decoder_t::fmt_in, es_format_t::i_cat, subpicture_t::p_next, decoder_owner_callbacks::queue, decoder_owner_callbacks::spu, SPU_ES, and vlc_assert.
This function queues a single picture to the video output.
References decoder_t::cbs, decoder_t::fmt_in, es_format_t::i_cat, picture_HasChainedPics(), decoder_owner_callbacks::queue, decoder_owner_callbacks::video, VIDEO_ES, and vlc_assert.
|
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.
References decoder_owner_callbacks::audio, AUDIO_ES, decoder_t::cbs, decoder_t::fmt_in, decoder_owner_callbacks::format_update, es_format_t::i_cat, and vlc_assert.
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.
References 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.
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().
input_resource_t * input_resource_New | ( | vlc_object_t * | p_parent | ) |
It creates an empty input resource handler.
The given object MUST stay alive as long as the input_resource_t is not deleted.
References input_resource_t::lock, input_resource_t::lock_hold, input_resource_t::p_parent, input_resource_t::p_vout_dummy, input_resource_t::rc, vlc_atomic_rc_init(), vlc_list_init(), vlc_mutex_init(), vout_CreateDummy(), and input_resource_t::vout_rscs.
Referenced by input_Create(), and vlc_player_New().
void input_resource_Release | ( | input_resource_t * | p_resource | ) |
It releases an input resource.
References aout_Release(), DestroySout(), DestroyVout(), input_resource_t::p_aout, input_resource_t::p_vout_dummy, input_resource_t::rc, vlc_atomic_rc_dec(), and vout_Release().
Referenced by Destroy(), End(), Init(), vlc_player_Delete(), and vlc_player_New().
void vlc_input_decoder_ChangeDelay | ( | vlc_input_decoder_t * | owner, |
vlc_tick_t | i_delay | ||
) |
References vlc_input_decoder_t::delay, vlc_input_decoder_t::p_fifo, vlc_fifo_Lock(), and vlc_fifo_Unlock().
Referenced by EsOutDecoderChangeDelay().
vlc_input_decoder_t * vlc_input_decoder_Create | ( | vlc_object_t * | p_parent, |
const es_format_t * | fmt, | ||
const char * | es_id, | ||
struct vlc_clock_t * | clock, | ||
input_resource_t * | p_resource | ||
) |
Spawn a decoder thread outside of the input thread.
References vlc_input_decoder_cfg::clock, decoder_New(), vlc_input_decoder_cfg::fmt, INPUT_TYPE_PLAYBACK, and var_InheritBool().
void vlc_input_decoder_Decode | ( | vlc_input_decoder_t * | p_dec, |
struct vlc_frame_t * | frame, | ||
bool | do_pace | ||
) |
Put a vlc_frame_t in the decoder's fifo.
Thread-safe w.r.t. the decoder. May be a cancellation point.
p_dec | the decoder object |
frame | the data frame |
do_pace | whether we wait for some decoding to happen or not |
References vlc_input_decoder_DecodeWithStatus().
Referenced by EsOutSend().
void vlc_input_decoder_Delete | ( | vlc_input_decoder_t * | decoder | ) |
Delete an existing vlc_input_decoder_t instance.
Close the decoder implementation and delete the vlc_input_decoder_t instance. The instance must have been drained using vlc_input_decoder_Drain() or flushed using vlc_input_decoder_Flush() after any previous call to vlc_input_decoder_Decode() before calling the destructor.
decoder | The vlc_input_decoder_t to delete, created from vlc_input_decoder_Create(). |
References vlc_input_decoder_t::aborting, vlc_input_decoder_t::b_waiting, vlc_input_decoder_t::cc, vlc_input_decoder_t::count, vlc_input_decoder_t::dec_fmt_in, DeleteDecoder(), es_format_t::i_cat, vlc_input_decoder_t::list, vlc_input_decoder_t::lock, vlc_input_decoder_t::master_dec, vlc_input_decoder_t::p_fifo, RemoveCcDecoder(), vlc_input_decoder_t::subdecs, vlc_input_decoder_t::thread, vlc_cond_signal(), vlc_fifo_Lock(), vlc_fifo_Signal(), vlc_fifo_Unlock(), vlc_input_decoder_IsSynchronous(), vlc_join(), vlc_list_is_empty(), vlc_mutex_lock(), vlc_mutex_unlock(), and vlc_input_decoder_t::wait_request.
Referenced by EsOutDestroyDecoder(), EsOutSetRecord(), and EsOutTerminate().
void vlc_input_decoder_Drain | ( | vlc_input_decoder_t * | p_owner | ) |
Signals that there are no further frames 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.
References vlc_input_decoder_t::b_draining, DecoderThread_ProcessInput(), vlc_input_decoder_t::p_fifo, vlc_fifo_Lock(), vlc_fifo_Signal(), vlc_fifo_Unlock(), and vlc_input_decoder_IsSynchronous().
Referenced by EsOutDrainDecoder(), and EsOutDrainSubESes().
void vlc_input_decoder_Flush | ( | vlc_input_decoder_t * | p_owner | ) |
Requests that the decoder immediately discard all pending buffers.
This is useful when seeking or when deselecting a stream.
References AUDIO_ES, vlc_input_decoder_t::b_draining, vlc_input_decoder_t::b_has_data, vlc_input_decoder_t::b_waiting, block_ChainRelease, vlc_input_decoder_t::dec, DecoderThread_Flush(), vlc_input_decoder_t::flushing, decoder_t::fmt_in, vlc_input_decoder_t::frames_countdown, es_format_t::i_cat, vlc_input_decoder_t::i_preroll_end, vlc_input_decoder_t::i_spu_channel, vlc_input_decoder_t::p_astream, vlc_input_decoder_t::p_fifo, vlc_input_decoder_t::p_sout, vlc_input_decoder_t::p_sout_input, vlc_input_decoder_t::p_vout, vlc_input_decoder_t::paused, PREROLL_NONE, sout_InputFlush(), SPU_ES, unlikely, VIDEO_ES, vlc_aout_stream_Flush(), vlc_cond_signal(), vlc_fifo_DequeueAllUnlocked(), vlc_fifo_Lock(), vlc_fifo_Signal(), vlc_fifo_Unlock(), vlc_fifo_WaitCond(), vlc_input_decoder_IsSynchronous(), vout_FlushAll, vout_FlushSubpictureChannel(), VOUT_SPU_CHANNEL_INVALID, vlc_input_decoder_t::vout_started, vlc_input_decoder_t::wait_acknowledge, and vlc_input_decoder_t::wait_request.
Referenced by EsOutChangePosition(), EsOutDestroyDecoder(), EsOutSetRecord(), and EsOutTerminate().
int vlc_input_decoder_SetSpuHighlight | ( | vlc_input_decoder_t * | p_owner, |
const vlc_spu_highlight_t * | spu_hl | ||
) |
References vlc_input_decoder_t::dec, decoder_t::fmt_in, es_format_t::i_cat, vlc_input_decoder_t::p_fifo, vlc_input_decoder_t::p_sout, vlc_input_decoder_t::p_sout_input, vlc_input_decoder_t::p_vout, SOUT_INPUT_SET_SPU_HIGHLIGHT, sout_InputControl(), SPU_ES, VLC_EGENERIC, vlc_fifo_Lock(), vlc_fifo_Unlock(), VLC_SUCCESS, and vout_SetSpuHighlight().
Referenced by EsOutVaControlLocked().