- if( p_fmt != NULL )
- es_format_Copy( p_fmt, &p_owner->fmt );
-
- if( pp_meta )
- {
- *pp_meta = NULL;
- if( p_owner->p_description )
- {
- *pp_meta = vlc_meta_New();
- if( *pp_meta )
- vlc_meta_Merge( *pp_meta, p_owner->p_description );
- }
- }
- p_owner->b_fmt_description = false;
- }
- vlc_mutex_unlock( &p_owner->lock );
- return b_changed;
-}
-
-size_t input_DecoderGetFifoSize( decoder_t *p_dec )
-{
- decoder_owner_sys_t *p_owner = p_dec->p_owner;
-
- return block_FifoSize( p_owner->p_fifo );
-}
-
-void input_DecoderGetObjects( decoder_t *p_dec,
- vout_thread_t **pp_vout, audio_output_t **pp_aout )
-{
- decoder_owner_sys_t *p_owner = p_dec->p_owner;
-
- vlc_mutex_lock( &p_owner->lock );
- if( pp_vout )
- *pp_vout = p_owner->p_vout ? vlc_object_hold( p_owner->p_vout ) : NULL;
- if( pp_aout )
- *pp_aout = p_owner->p_aout ? vlc_object_hold( p_owner->p_aout ) : NULL;
- vlc_mutex_unlock( &p_owner->lock );
-}
-
-/*****************************************************************************
- * Internal functions
- *****************************************************************************/
-static int DecoderGetInputAttachments( decoder_t *p_dec,
- input_attachment_t ***ppp_attachment,
- int *pi_attachment )
-{
- input_thread_t *p_input = p_dec->p_owner->p_input;
-
- if( unlikely(p_input == NULL) )
- return VLC_ENOOBJ;
- return input_Control( p_input, INPUT_GET_ATTACHMENTS,
- ppp_attachment, pi_attachment );
-}
-static mtime_t DecoderGetDisplayDate( decoder_t *p_dec, mtime_t i_ts )
-{
- decoder_owner_sys_t *p_owner = p_dec->p_owner;
-
- vlc_mutex_lock( &p_owner->lock );
- if( p_owner->b_waiting || p_owner->b_paused )
- i_ts = VLC_TS_INVALID;
- vlc_mutex_unlock( &p_owner->lock );
-
- if( !p_owner->p_clock || i_ts <= VLC_TS_INVALID )
- return i_ts;
-
- if( input_clock_ConvertTS( p_owner->p_clock, NULL, &i_ts, NULL, INT64_MAX ) ) {
- msg_Err(p_dec, "Could not get display date for timestamp %"PRId64"", i_ts);
- return VLC_TS_INVALID;
- }
-
- return i_ts;
-}
-static int DecoderGetDisplayRate( decoder_t *p_dec )
-{
- decoder_owner_sys_t *p_owner = p_dec->p_owner;
-
- if( !p_owner->p_clock )
- return INPUT_RATE_DEFAULT;
- return input_clock_GetRate( p_owner->p_clock );
-}
-
-/* */
-static void DecoderUnsupportedCodec( decoder_t *p_dec, vlc_fourcc_t codec )
-{
- if (codec != VLC_FOURCC('u','n','d','f')) {
- const char *desc = vlc_fourcc_GetDescription(p_dec->fmt_in.i_cat, codec);
- if (!desc || !*desc)
- desc = N_("No description for this codec");
- msg_Err( p_dec, "Codec `%4.4s' (%s) is not supported.", (char*)&codec, desc );
- dialog_Fatal( p_dec, _("Codec not supported"),
- _("VLC could not decode the format \"%4.4s\" (%s)"),
- (char*)&codec, desc );
- } else {
- msg_Err( p_dec, "could not identify codec" );
- dialog_Fatal( p_dec, _("Unidentified codec"),
- _("VLC could not identify the audio or video codec" ) );
- }
-}
-
-
-/**
- * Create a decoder object
- *
- * \param p_input the input thread
- * \param p_es the es descriptor
- * \param b_packetizer instead of a decoder
- * \return the decoder object
- */
-static decoder_t * CreateDecoder( vlc_object_t *p_parent,
- input_thread_t *p_input,
- es_format_t *fmt, bool b_packetizer,
- input_resource_t *p_resource,
- sout_instance_t *p_sout )
-{
- decoder_t *p_dec;
- decoder_owner_sys_t *p_owner;
- es_format_t null_es_format;
-
- p_dec = vlc_custom_create( p_parent, sizeof( *p_dec ), "decoder" );
- if( p_dec == NULL )
- return NULL;
-
- p_dec->pf_decode_audio = NULL;
- p_dec->pf_decode_video = NULL;
- p_dec->pf_decode_sub = NULL;
- p_dec->pf_get_cc = NULL;
- p_dec->pf_packetize = NULL;
-
- /* Initialize the decoder */
- p_dec->p_module = NULL;
-
- memset( &null_es_format, 0, sizeof(es_format_t) );
- es_format_Copy( &p_dec->fmt_in, fmt );
- es_format_Copy( &p_dec->fmt_out, &null_es_format );