Implement new GStreamer Element and Bin APIs - allow clients to create custom DSL Pipeline Components
rjhowell44 opened this issue · 1 comments
rjhowell44 commented
New DSL GStreamer API to allow users to create Custom GStreamer Bins with Elements created from proprietary or other GStreamer plugins.
Using a Queue and Identify plugin for example.
# Create a new queue element and set a property
retval = dsl_gst_element_new('my-queue', 'queue')
retval = dsl_gst_element_property_boolean_set('my-queue', 'flush-on-eos', True)
# Create a new Identity diagnostics element
retval = dsl_gst_element_new('my-identify-module', 'identity')
# Create a new GStreamer bin and add the elements to it.
retval = dsl_gst_bin_new_element_add_many('my-custom-bin',
['my-queue', 'my-identity', None])
# Add the Bin to the Pipeline or Branch along with other components.
There will be certain constraints on what type of plugins can be supported, for example, no Tees, Muxers, Streammuxers, Aggregators, etc.
New Symbolic Constants for the GStreammer Element and Bin Classes
/**
* GStreamer Element API Return Values
*/
#define DSL_RESULT_GST_ELEMENT_RESULT 0x00D00000
#define DSL_RESULT_GST_ELEMENT_NAME_NOT_UNIQUE 0x00D00001
#define DSL_RESULT_GST_ELEMENT_NAME_NOT_FOUND 0x00D00002
#define DSL_RESULT_GST_ELEMENT_THREW_EXCEPTION 0x00D00003
#define DSL_RESULT_GST_ELEMENT_IN_USE 0x00D00004
#define DSL_RESULT_GST_ELEMENT_SET_FAILED 0x00D00005
#define DSL_RESULT_GST_ELEMENT_HANDLER_ADD_FAILED 0x00D00006
#define DSL_RESULT_GST_ELEMENT_HANDLER_REMOVE_FAILED 0x00D00007
#define DSL_RESULT_GST_ELEMENT_PAD_TYPE_INVALID 0x00D00008
/**
* GStreamer Bin API Return Values
*/
#define DSL_RESULT_GST_BIN_RESULT 0x00E00000
#define DSL_RESULT_GST_BIN_NAME_NOT_UNIQUE 0x00E00001
#define DSL_RESULT_GST_BIN_NAME_NOT_FOUND 0x00E00002
#define DSL_RESULT_GST_BIN_NAME_BAD_FORMAT 0x00E00003
#define DSL_RESULT_GST_BIN_THREW_EXCEPTION 0x00E00004
#define DSL_RESULT_GST_BIN_IS_IN_USE 0x00E00005
#define DSL_RESULT_GST_BIN_SET_FAILED 0x00E00006
#define DSL_RESULT_GST_BIN_ELEMENT_ADD_FAILED 0x00E00007
#define DSL_RESULT_GST_BIN_ELEMENT_REMOVE_FAILED 0x00E00008
#define DSL_RESULT_GST_BIN_ELEMENT_NOT_IN_USE 0x00E00009
/**
* @brief Creates a uniquely named GStreamer Element from a plugin factory name.
* @param[in] name unique name for the Element to create
* @param[in] factory_name factory (plugin) name for the Element to create
* @return DSL_RESULT_SUCCESS on success, DSL_RESULT_GST_ELEMENT_RESULT otherwise.
*/
DslReturnType dsl_gst_element_new(const wchar_t* name, const wchar_t* factory_name);
/**
* @brief Deletes a GStreamer Element by name.
* @param[in] name unique name of the Element to delete.
* @return DSL_RESULT_SUCCESS on success, DSL_RESULT_PIPELINE_RESULT otherwise.
*/
DslReturnType dsl_gst_element_delete(const wchar_t* name);
/**
* @brief deletes a NULL terminated list of GStreamer Elements
* @param[in] names NULL terminated list of names to delete
* @return DSL_RESULT_SUCCESS on success, DSL_RESULT_PIPELINE_RESULT
*/
DslReturnType dsl_gst_element_delete_many(const wchar_t** names);
/**
* @brief deletes all GStreamer Elements in memory
* @return DSL_RESULT_SUCCESS on success, DSL_RESULT_COMPONENT_RESULT
*/
DslReturnType dsl_gst_element_delete_all();
/**
* @brief returns the current number of GStreamer Elements
* @return size of the list of GStreamer Bins
*/
uint dsl_gst_element_list_size();
/**
* @brief Gets the GST_OBJECT pointer to the named Element.
* @param[in] name unique name for the Element to query.
* @param[out] element GST_OBJECT point the the name Element.
* @return DSL_RESULT_SUCCESS on success, DSL_RESULT_GST_ELEMENT_RESULT otherwise.
*/
DslReturnType dsl_gst_element_get(const wchar_t* name, void** element);
/**
* @brief Gets a named boolean property from a named Element.
* @param[in] name unique name for the Element to query.
* @param[in] property unique name of the property to query.
* @param[out] value current value for the named property.
* @return DSL_RESULT_SUCCESS on success, DSL_RESULT_GST_ELEMENT_RESULT otherwise.
*/
DslReturnType dsl_gst_element_property_boolean_get(const wchar_t* name,
const wchar_t* property, boolean* value);
/**
* @brief Sets a named boolean property for a named Element.
* @param[in] name unique name for the Element to update.
* @param[in] property unique name of the property to update.
* @param[in] value new value for the named property.
* @return DSL_RESULT_SUCCESS on success, DSL_RESULT_GST_ELEMENT_RESULT otherwise.
*/
DslReturnType dsl_gst_element_property_boolean_set(const wchar_t* name,
const wchar_t* property, boolean value);
/**
* @brief Gets a named float property from a named Element.
* @param[in] name unique name for the Element to query.
* @param[in] property unique name of the property to query.
* @param[out] value current value for the named property.
* @return DSL_RESULT_SUCCESS on success, DSL_RESULT_GST_ELEMENT_RESULT otherwise.
*/
DslReturnType dsl_gst_element_property_float_get(const wchar_t* name,
const wchar_t* property, float* value);
/**
* @brief Sets a named float property for a named Element.
* @param[in] name unique name for the Element to update.
* @param[in] property unique name of the property to update.
* @param[in] value new value for the named property.
* @return DSL_RESULT_SUCCESS on success, DSL_RESULT_GST_ELEMENT_RESULT otherwise.
*/
DslReturnType dsl_gst_element_property_float_set(const wchar_t* name,
const wchar_t* property, float value);
/**
* @brief Gets a named unsigned int property from a named Element.
* @param[in] name unique name for the Element to query.
* @param[in] property unique name of the property to query.
* @param[out] value current value for the named property.
* @return DSL_RESULT_SUCCESS on success, DSL_RESULT_GST_ELEMENT_RESULT otherwise.
*/
DslReturnType dsl_gst_element_property_uint_get(const wchar_t* name,
const wchar_t* property, uint* value);
/**
* @brief Sets a named unsigned int property for a named Element.
* @param[in] name unique name for the Element to update.
* @param[in] property unique name of the property to update.
* @param[in] value new value for the named property.
* @return DSL_RESULT_SUCCESS on success, DSL_RESULT_GST_ELEMENT_RESULT otherwise.
*/
DslReturnType dsl_gst_element_property_uint_set(const wchar_t* name,
const wchar_t* property, uint value);
/**
* @brief Gets a named signed int property from a named Element.
* @param[in] name unique name for the Element to query.
* @param[in] property unique name of the property to query.
* @param[out] value current value for the named property.
* @return DSL_RESULT_SUCCESS on success, DSL_RESULT_GST_ELEMENT_RESULT otherwise.
*/
DslReturnType dsl_gst_element_property_int_get(const wchar_t* name,
const wchar_t* property, int* value);
/**
* @brief Sets a named signed int property for a named Element.
* @param[in] name unique name for the Element to update.
* @param[in] property unique name of the property to update.
* @param[in] value new value for the named property.
* @return DSL_RESULT_SUCCESS on success, DSL_RESULT_GST_ELEMENT_RESULT otherwise.
*/
DslReturnType dsl_gst_element_property_int_set(const wchar_t* name,
const wchar_t* property, int value);
/**
* @brief Gets a named uint64_t property from a named Element.
* @param[in] name unique name for the Element to query.
* @param[in] property unique name of the property to query.
* @param[out] value current value for the named property.
* @return DSL_RESULT_SUCCESS on success, DSL_RESULT_GST_ELEMENT_RESULT otherwise.
*/
DslReturnType dsl_gst_element_property_uint64_get(const wchar_t* name,
const wchar_t* property, uint64_t* value);
/**
* @brief Sets a named uint64_t property for a named Element.
* @param[in] name unique name for the Element to update.
* @param[in] property unique name of the property to update.
* @param[in] value new value for the named property.
* @return DSL_RESULT_SUCCESS on success, DSL_RESULT_GST_ELEMENT_RESULT otherwise.
*/
DslReturnType dsl_gst_element_property_uint64_set(const wchar_t* name,
const wchar_t* property, uint64_t value);
/**
* @brief Gets a named signed int64_t property from a named Element.
* @param[in] name unique name for the Element to query.
* @param[in] property unique name of the property to query.
* @param[out] value current value for the named property.
* @return DSL_RESULT_SUCCESS on success, DSL_RESULT_GST_ELEMENT_RESULT otherwise.
*/
DslReturnType dsl_gst_element_property_int64_get(const wchar_t* name,
const wchar_t* property, int64_t* value);
/**
* @brief Sets a named signed int64_t property for a named Element.
* @param[in] name unique name for the Element to update.
* @param[in] property unique name of the property to update.
* @param[in] value new value for the named property.
* @return DSL_RESULT_SUCCESS on success, DSL_RESULT_GST_ELEMENT_RESULT otherwise.
*/
DslReturnType dsl_gst_element_property_int64_set(const wchar_t* name,
const wchar_t* property, int64_t value);
/**
* @brief Gets a named string property from a named Element.
* @param[in] name unique name for the Element to query.
* @param[in] property unique name of the property to query.
* @param[out] value current value for the named property.
* @return DSL_RESULT_SUCCESS on success, DSL_RESULT_GST_ELEMENT_RESULT otherwise.
*/
DslReturnType dsl_gst_element_property_string_get(const wchar_t* name,
const wchar_t* property, const wchar_t** value);
/**
* @brief Sets a named string property for a named Element.
* @param[in] name unique name for the Element to update.
* @param[in] property unique name of the property to update.
* @param[in] value new value for the named property.
* @return DSL_RESULT_SUCCESS on success, DSL_RESULT_GST_ELEMENT_RESULT otherwise.
*/
DslReturnType dsl_gst_element_property_string_set(const wchar_t* name,
const wchar_t* property, const wchar_t* value);
/**
* @brief Adds a pad-probe-handler to a named GStreamer Element.
* A GStreamer Element can have multiple Sink and Source pad-probe-handlers
* @param[in] name unique name of the GStreamer Element to update
* @param[in] handler callback function to process pad probe data
* @param[in] pad pad to add the handler to; DSL_PAD_SINK | DSL_PAD SRC
* @return DSL_RESULT_SUCCESS on success, DSL_RESULT_GST_BIN_RESULT otherwise.
*/
DslReturnType dsl_gst_element_pph_add(const wchar_t* name,
const wchar_t* handler, uint pad);
/**
* @brief Removes a pad-probe-handler from a named GStreamer Element.
* @param[in] name unique name of the GStreamer Element to update
* @param[in] handler pad-probe-handler to remove
* @param[in] pad pad to remove the handler from; DSL_PAD_SINK | DSL_PAD SRC
* @return DSL_RESULT_SUCCESS on success, DSL_RESULT_GST_BIN_RESULT otherwise.
*/
DslReturnType dsl_gst_element_pph_remove(const wchar_t* name,
const wchar_t* handler, uint pad);
/**
* @brief creates a new, uniquely named GStreamer Bin
* @param[in] name unique name for the new GStreamer Bin
* @return DSL_RESULT_SUCCESS on success, DSL_RESULT_GST_BIN_RESULT otherwise.
*/
DslReturnType dsl_gst_bin_new(const wchar_t* name);
/**
* @brief creates a new GStreamer Bin and adds a list of Elements to it.
* @param[in] name name of the GStreamer Bin to update
* @param[in] elements NULL terminated array of Element names to add
* @return DSL_RESULT_SUCCESS on success, DSL_RESULT_GST_BIN_RESULT otherwise.
*/
DslReturnType dsl_gst_bin_new_element_add_many(const wchar_t* name,
const wchar_t** components);
/**
* @brief adds a single Element to a GStreamer Bin
* @param[in] name name of the GStreamer Bin to update
* @param[in] element Element names to add
* @return DSL_RESULT_SUCCESS on success, DSL_RESULT_GST_BIN_RESULT otherwise.
*/
DslReturnType dsl_gst_bin_element_add(const wchar_t* name,
const wchar_t* component);
/**
* @brief adds a list of Elements to a GStreamer Bin
* @param[in] name name of the GStreamer Bin to update
* @param[in] components NULL terminated array of element names to add
* @return DSL_RESULT_SUCCESS on success, DSL_RESULT_GST_BIN_RESULT otherwise.
*/
DslReturnType dsl_gst_bin_element_add_many(const wchar_t* name,
const wchar_t** components);
/**
* @brief removes an Element from a GStreamer Bin
* @param[in] name name of the GStreamer Bin to update
* @param[in] element name of the Element to remove
* @return DSL_RESULT_SUCCESS on success, DSL_RESULT_GST_BIN_RESULT otherwise.
*/
DslReturnType dsl_gst_bin_element_remove(const wchar_t* name,
const wchar_t* component);
/**
* @brief removes a list of Elements from a GStreamer Bin
* @param[in] name name of the GStreamer Bin to update
* @param[in] components NULL terminated array of Element names to remove
* @return DSL_RESULT_SUCCESS on success, DSL_RESULT_GST_BIN_RESULT otherwise.
*/
DslReturnType dsl_gst_bin_element_remove_many(const wchar_t* name,
const wchar_t** components);
rjhowell44 commented
Merged into the v0.30.alpha
dev branch.