encoder: add a function to get the decoder device to use with the encoder
authorSteve Lhomme <robux4@ycbcr.xyz>
Tue, 20 Aug 2019 06:28:29 +0000 (08:28 +0200)
committerSteve Lhomme <robux4@ycbcr.xyz>
Wed, 8 Jan 2020 11:41:55 +0000 (12:41 +0100)
Similar to decoder_GetDecoderDevice() but for the encoder.

include/vlc_codec.h
src/input/decoder_helpers.c
src/libvlccore.sym

index 2ea6c1f..d8503a2 100644 (file)
@@ -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;
 };
 
 /**
index 3f03394..2af7960 100644 (file)
@@ -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 );
+}
index 2c12034..98b1a9f 100644 (file)
@@ -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