mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
capabilities -> formats
This commit is contained in:
parent
31cc37b6a5
commit
d531634061
6 changed files with 40 additions and 29 deletions
|
|
@ -53,6 +53,7 @@ typedef enum {
|
|||
* @name: the name of the source
|
||||
* @properties: the properties of the source
|
||||
* @state: the current state of the source
|
||||
* @formats: the supported formats
|
||||
*
|
||||
* The source information
|
||||
*/
|
||||
|
|
@ -60,19 +61,19 @@ typedef struct {
|
|||
const char *name;
|
||||
GVariant *properties;
|
||||
PvSourceState state;
|
||||
GVariant *capabilities;
|
||||
GBytes *formats;
|
||||
} PvSourceInfo;
|
||||
|
||||
/**
|
||||
* PvSourceInfoFlags:
|
||||
* @PV_SOURCE_INFO_FLAGS_NONE: no flags
|
||||
* @PV_SOURCE_INFO_FLAGS_CAPABILITIES: include capabilities
|
||||
* @PV_SOURCE_INFO_FLAGS_FORMATS: include formats
|
||||
*
|
||||
* Extra flags to pass to pv_context_get_source_info_list.
|
||||
*/
|
||||
typedef enum {
|
||||
PV_SOURCE_INFO_FLAGS_NONE = 0,
|
||||
PV_SOURCE_INFO_FLAGS_CAPABILITIES = (1 << 0)
|
||||
PV_SOURCE_INFO_FLAGS_FORMATS = (1 << 0)
|
||||
} PvSourceInfoFlags;
|
||||
|
||||
typedef gboolean (*PvSourceInfoCallback) (PvContext *c, const PvSourceInfo *info, gpointer userdata);
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@
|
|||
<method name='Disconnect'/>
|
||||
<!-- CreateSourceOutput:
|
||||
@source: the Source1 object path or / for default
|
||||
@incaps: input capabilities
|
||||
@accepted_formats: the formats that can be accepted
|
||||
@output: the SourceOutput1 object path
|
||||
|
||||
Create a new output for @source with given @incaps
|
||||
|
|
@ -64,7 +64,7 @@
|
|||
<arg type='o' name='output' direction='out'/>
|
||||
</method>
|
||||
<!-- CreateSourceInput:
|
||||
@incaps: input capabilities
|
||||
@possible_formats: the formats that can be provided
|
||||
@input: the SourceInput1 object path
|
||||
|
||||
Create a new source and input object with given @incaps
|
||||
|
|
@ -121,10 +121,9 @@
|
|||
4 = the source is running
|
||||
-->
|
||||
<property name='State' type='u' access='read' />
|
||||
<!-- Capabilities:
|
||||
<!-- PossibleFormats:
|
||||
|
||||
The capabilities of this source. This includes
|
||||
supported data formats and transports.
|
||||
The all possible formats of this source.
|
||||
-->
|
||||
<property name='PossibleFormats' type='s' access='read' />
|
||||
</interface>
|
||||
|
|
@ -141,18 +140,21 @@
|
|||
<property name='Client' type='o' access='read' />
|
||||
<!-- Source: the source of this source output -->
|
||||
<property name='Source' type='o' access='read' />
|
||||
<!-- Capabilities: capabilities of the source output -->
|
||||
<!-- PossibleFormats:
|
||||
|
||||
all possible formats of the source output. This is filtered
|
||||
against the accepted_formats when creating the source output.
|
||||
-->
|
||||
<property name='PossibleFormats' type='s' access='read' />
|
||||
<!-- Start:
|
||||
@incaps: input capabilities
|
||||
@requested_format: requested formats
|
||||
@fd: output file descriptor
|
||||
@outcaps: output capabilities
|
||||
@format: output format
|
||||
|
||||
Start the datatransfer of the source with @incaps.
|
||||
Start the datatransfer of the source with @requested_format.
|
||||
|
||||
The result is a file descriptor that can be used to get metadata
|
||||
and media. @outcaps contains the final media format and transport
|
||||
properties.
|
||||
and media. @format contains the final media format.
|
||||
-->
|
||||
<method name='Start'>
|
||||
<arg type='s' name='requested_format' direction='in'/>
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ v4l2_set_state (PvSource *source, PvSourceState state)
|
|||
}
|
||||
|
||||
static GBytes *
|
||||
v4l2_get_capabilities (PvSource *source, GBytes *filter)
|
||||
v4l2_get_formats (PvSource *source, GBytes *filter)
|
||||
{
|
||||
GstCaps *caps, *cfilter;
|
||||
gchar *str;
|
||||
|
|
@ -301,7 +301,7 @@ pv_v4l2_source_class_init (PvV4l2SourceClass * klass)
|
|||
|
||||
gobject_class->finalize = v4l2_source_finalize;
|
||||
|
||||
source_class->get_capabilities = v4l2_get_capabilities;
|
||||
source_class->get_formats = v4l2_get_formats;
|
||||
source_class->set_state = v4l2_set_state;
|
||||
source_class->create_source_output = v4l2_create_source_output;
|
||||
source_class->release_source_output = v4l2_release_source_output;
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ client_set_state (PvSource *source, PvSourceState state)
|
|||
}
|
||||
|
||||
static GBytes *
|
||||
client_get_capabilities (PvSource *source, GBytes *filter)
|
||||
client_get_formats (PvSource *source, GBytes *filter)
|
||||
{
|
||||
GstCaps *caps, *cfilter;
|
||||
gchar *str;
|
||||
|
|
@ -311,7 +311,7 @@ pv_client_source_class_init (PvClientSourceClass * klass)
|
|||
|
||||
gobject_class->finalize = client_source_finalize;
|
||||
|
||||
source_class->get_capabilities = client_get_capabilities;
|
||||
source_class->get_formats = client_get_formats;
|
||||
source_class->set_state = client_set_state;
|
||||
source_class->create_source_output = client_create_source_output;
|
||||
source_class->release_source_output = client_release_source_output;
|
||||
|
|
|
|||
|
|
@ -187,11 +187,19 @@ pv_source_finalize (GObject * object)
|
|||
G_OBJECT_CLASS (pv_source_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
default_set_state (PvSource *source, PvSourceState state)
|
||||
{
|
||||
pv_source_update_state (source, state);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static PvSourceOutput *
|
||||
default_create_source_output (PvSource *source,
|
||||
default_create_source_output (PvSource *source,
|
||||
const gchar *client_path,
|
||||
GBytes *format_filter,
|
||||
const gchar *prefix)
|
||||
GBytes *format_filter,
|
||||
const gchar *prefix,
|
||||
GError **error)
|
||||
{
|
||||
PvSourcePrivate *priv = source->priv;
|
||||
|
||||
|
|
@ -272,6 +280,7 @@ pv_source_class_init (PvSourceClass * klass)
|
|||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
|
||||
klass->set_state = default_set_state;
|
||||
klass->create_source_output = default_create_source_output;
|
||||
klass->release_source_output = default_release_source_output;
|
||||
}
|
||||
|
|
@ -283,7 +292,7 @@ pv_source_init (PvSource * source)
|
|||
}
|
||||
|
||||
GBytes *
|
||||
pv_source_get_capabilities (PvSource *source, GBytes *filter)
|
||||
pv_source_get_formats (PvSource *source, GBytes *filter)
|
||||
{
|
||||
PvSourceClass *klass;
|
||||
GBytes *res;
|
||||
|
|
@ -292,8 +301,8 @@ pv_source_get_capabilities (PvSource *source, GBytes *filter)
|
|||
|
||||
klass = PV_SOURCE_GET_CLASS (source);
|
||||
|
||||
if (klass->get_capabilities)
|
||||
res = klass->get_capabilities (source, filter);
|
||||
if (klass->get_formats)
|
||||
res = klass->get_formats (source, filter);
|
||||
else
|
||||
res = NULL;
|
||||
|
||||
|
|
@ -329,8 +338,7 @@ pv_source_update_state (PvSource *source, PvSourceState state)
|
|||
if (priv->state != state) {
|
||||
priv->state = state;
|
||||
g_print ("source changed state %d\n", state);
|
||||
if (priv->iface)
|
||||
pv_source1_set_state (priv->iface, state);
|
||||
pv_source1_set_state (priv->iface, state);
|
||||
g_object_notify (G_OBJECT (source), "state");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ struct _PvSource {
|
|||
|
||||
/**
|
||||
* PvSourceClass:
|
||||
* @get_capabilities: called to get a list of supported formats from the source
|
||||
* @get_formats: called to get a list of supported formats from the source
|
||||
* @set_state: called to change the current state of the source
|
||||
* @create_source_output: called to create a new source-output object
|
||||
* @release_source_output: called to release a source-output object
|
||||
|
|
@ -64,7 +64,7 @@ struct _PvSource {
|
|||
struct _PvSourceClass {
|
||||
GObjectClass parent_class;
|
||||
|
||||
GBytes * (*get_capabilities) (PvSource *source, GBytes *filter);
|
||||
GBytes * (*get_formats) (PvSource *source, GBytes *filter);
|
||||
|
||||
gboolean (*set_state) (PvSource *source, PvSourceState);
|
||||
|
||||
|
|
@ -82,7 +82,7 @@ GType pv_source_get_type (void);
|
|||
|
||||
const gchar * pv_source_get_object_path (PvSource *source);
|
||||
|
||||
GBytes * pv_source_get_capabilities (PvSource *source, GBytes *filter);
|
||||
GBytes * pv_source_get_formats (PvSource *source, GBytes *filter);
|
||||
|
||||
gboolean pv_source_set_state (PvSource *source, PvSourceState state);
|
||||
void pv_source_update_state (PvSource *source, PvSourceState state);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue