[vlc-commits] encoder: add a function to get the decoder device to use with the encoder
Steve Lhomme
git at videolan.org
Wed Jan 8 12:47:25 CET 2020
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Aug 20 08:28:29 2019 +0200| [61b6c9b08abcead88ac5753ceaa341d5213b7cbb] | committer: Steve Lhomme
encoder: add a function to get the decoder device to use with the encoder
Similar to decoder_GetDecoderDevice() but for the encoder.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=61b6c9b08abcead88ac5753ceaa341d5213b7cbb
---
include/vlc_codec.h | 22 ++++++++++++++++++++++
src/input/decoder_helpers.c | 11 +++++++++++
src/libvlccore.sym | 1 +
3 files changed, 34 insertions(+)
diff --git a/include/vlc_codec.h b/include/vlc_codec.h
index 2ea6c1f8ed..d8503a2531 100644
--- a/include/vlc_codec.h
+++ b/include/vlc_codec.h
@@ -214,6 +214,25 @@ struct decoder_cc_desc_t
* @}
*/
+struct encoder_owner_callbacks
+{
+ struct
+ {
+ vlc_decoder_device *(*get_device)( encoder_t * );
+ } video;
+};
+
+/**
+ * Creates/Updates the output decoder device.
+ *
+ * \note
+ * This function is not reentrant.
+ *
+ * @return the held decoder device, NULL if none should be used
+ */
+VLC_API vlc_decoder_device *encoder_GetDecoderDevice( encoder_t * );
+
+
/**
* \defgroup encoder Encoder
* \ingroup sout
@@ -247,6 +266,9 @@ struct encoder_t
/* Encoder config */
config_chain_t *p_cfg;
+
+ /* Private structure for the owner of the encoder */
+ const struct encoder_owner_callbacks *cbs;
};
/**
diff --git a/src/input/decoder_helpers.c b/src/input/decoder_helpers.c
index 3f03394ead..2af7960b76 100644
--- a/src/input/decoder_helpers.c
+++ b/src/input/decoder_helpers.c
@@ -294,3 +294,14 @@ vlc_decoder_device* vlc_video_context_HoldDevice(vlc_video_context *vctx)
return NULL;
return vlc_decoder_device_Hold( vctx->device );
}
+
+
+/** encoder **/
+vlc_decoder_device *encoder_GetDecoderDevice( encoder_t *enc )
+{
+ vlc_assert( enc->fmt_in.i_cat == VIDEO_ES && enc->cbs != NULL );
+ if ( unlikely(enc->fmt_in.i_cat != VIDEO_ES || enc->cbs == NULL ) )
+ return NULL;
+
+ return enc->cbs->video.get_device( enc );
+}
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 2c12034990..98b1a9f797 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -83,6 +83,7 @@ decoder_AbortPictures
decoder_NewAudioBuffer
decoder_UpdateVideoFormat
decoder_UpdateVideoOutput
+encoder_GetDecoderDevice
vlc_decoder_device_Create
vlc_decoder_device_Hold
vlc_decoder_device_Release
More information about the vlc-commits
mailing list