[vlc-devel] [PATCH 1/2] dec: move all callbacks handling in vlc_codec.h
Thomas Guillem
thomas at gllm.fr
Wed May 16 14:50:38 CEST 2018
---
include/vlc_codec.h | 38 ++++++++++++++++++++++++++++++++++----
src/input/decoder.c | 39 ---------------------------------------
src/libvlccore.sym | 4 ----
3 files changed, 34 insertions(+), 47 deletions(-)
diff --git a/include/vlc_codec.h b/include/vlc_codec.h
index 67ac0057e1..0f7f7c280b 100644
--- a/include/vlc_codec.h
+++ b/include/vlc_codec.h
@@ -385,27 +385,57 @@ VLC_API block_t * decoder_NewAudioBuffer( decoder_t *, int i_nb_samples ) VLC_US
* buffer. You have to release it using subpicture_Delete() or by returning
* it to the caller as a decoder_QueueSub parameter.
*/
-VLC_API subpicture_t * decoder_NewSubpicture( decoder_t *, const subpicture_updater_t * ) VLC_USED;
+VLC_USED
+static inline subpicture_t *decoder_NewSubpicture( decoder_t *dec,
+ const subpicture_updater_t *p_dyn )
+{
+ subpicture_t *p_subpicture = dec->pf_spu_buffer_new( dec, p_dyn );
+ if( !p_subpicture )
+ msg_Warn( dec, "can't get output subpicture" );
+ return p_subpicture;
+}
/**
* This function gives all input attachments at once.
*
* You MUST release the returned values
*/
-VLC_API int decoder_GetInputAttachments( decoder_t *, input_attachment_t ***ppp_attachment, int *pi_attachment );
+static inline int decoder_GetInputAttachments( decoder_t *dec,
+ input_attachment_t ***ppp_attachment,
+ int *pi_attachment )
+{
+ if( !dec->pf_get_attachments )
+ return VLC_EGENERIC;
+
+ return dec->pf_get_attachments( dec, ppp_attachment, pi_attachment );
+}
/**
* This function converts a decoder timestamp into a display date comparable
* to mdate().
* You MUST use it *only* for gathering statistics about speed.
*/
-VLC_API mtime_t decoder_GetDisplayDate( decoder_t *, mtime_t ) VLC_USED;
+VLC_USED
+static inline mtime_t decoder_GetDisplayDate( decoder_t *dec, mtime_t i_ts )
+{
+ if( !dec->pf_get_display_date )
+ return VLC_TS_INVALID;
+
+ return dec->pf_get_display_date( dec, i_ts );
+}
/**
* This function returns the current input rate.
* You MUST use it *only* for gathering statistics about speed.
*/
-VLC_API int decoder_GetDisplayRate( decoder_t * ) VLC_USED;
+VLC_USED
+static inline int decoder_GetDisplayRate( decoder_t *dec )
+{
+ if( !dec->pf_get_display_rate )
+ return 1000 /* XXX: INPUT_RATE_DEFAULT */;
+
+ return dec->pf_get_display_rate( dec );
+}
/** @} */
/** @} */
diff --git a/src/input/decoder.c b/src/input/decoder.c
index 32a98b5132..ee559043e9 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -665,15 +665,6 @@ block_t *decoder_NewAudioBuffer( decoder_t *dec, int samples )
return block;
}
-subpicture_t *decoder_NewSubpicture( decoder_t *p_decoder,
- const subpicture_updater_t *p_dyn )
-{
- subpicture_t *p_subpicture = p_decoder->pf_spu_buffer_new( p_decoder, p_dyn );
- if( !p_subpicture )
- msg_Warn( p_decoder, "can't get output subpicture" );
- return p_subpicture;
-}
-
static void RequestReload( decoder_t * p_dec )
{
decoder_owner_sys_t *p_owner = p_dec->p_owner;
@@ -682,36 +673,6 @@ static void RequestReload( decoder_t * p_dec )
atomic_compare_exchange_strong( &p_owner->reload, &expected, RELOAD_DECODER );
}
-/* decoder_GetInputAttachments:
- */
-int decoder_GetInputAttachments( decoder_t *p_dec,
- input_attachment_t ***ppp_attachment,
- int *pi_attachment )
-{
- if( !p_dec->pf_get_attachments )
- return VLC_EGENERIC;
-
- return p_dec->pf_get_attachments( p_dec, ppp_attachment, pi_attachment );
-}
-/* decoder_GetDisplayDate:
- */
-mtime_t decoder_GetDisplayDate( decoder_t *p_dec, mtime_t i_ts )
-{
- if( !p_dec->pf_get_display_date )
- return VLC_TS_INVALID;
-
- return p_dec->pf_get_display_date( p_dec, i_ts );
-}
-/* decoder_GetDisplayRate:
- */
-int decoder_GetDisplayRate( decoder_t *p_dec )
-{
- if( !p_dec->pf_get_display_rate )
- return INPUT_RATE_DEFAULT;
-
- return p_dec->pf_get_display_rate( p_dec );
-}
-
void decoder_AbortPictures( decoder_t *p_dec, bool b_abort )
{
decoder_owner_sys_t *p_owner = p_dec->p_owner;
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 9528af18b0..8df3a7ab4a 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -72,11 +72,7 @@ date_Decrement
date_Increment
date_Init
decoder_AbortPictures
-decoder_GetDisplayDate
-decoder_GetDisplayRate
-decoder_GetInputAttachments
decoder_NewAudioBuffer
-decoder_NewSubpicture
demux_PacketizerDestroy
demux_PacketizerNew
demux_New
--
2.17.0
More information about the vlc-devel
mailing list