Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
gstreamer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
luzpaz
gstreamer
Commits
f746174c
Commit
f746174c
authored
Nov 15, 2011
by
Wim Taymans
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pad: move query convenience functions together
Move the caps convenience functions to the other query functions.
parent
e85198bc
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
162 additions
and
161 deletions
+162
-161
docs/gst/gstreamer-sections.txt
docs/gst/gstreamer-sections.txt
+8
-6
gst/gstpad.c
gst/gstpad.c
+0
-150
gst/gstpad.h
gst/gstpad.h
+0
-5
gst/gstutils.c
gst/gstutils.c
+149
-0
gst/gstutils.h
gst/gstutils.h
+5
-0
No files found.
docs/gst/gstreamer-sections.txt
View file @
f746174c
...
...
@@ -1589,14 +1589,12 @@ gst_pad_unlink
gst_pad_is_linked
gst_pad_can_link
gst_pad_query_caps
gst_pad_get_allowed_caps
gst_pad_get_current_caps
gst_pad_get_pad_template_caps
gst_pad_set_caps
gst_pad_get_peer
gst_pad_peer_query_caps
gst_pad_use_fixed_caps
gst_pad_has_current_caps
...
...
@@ -1638,13 +1636,9 @@ GstPadLinkFunction
gst_pad_set_unlink_function
GstPadUnlinkFunction
gst_pad_query_accept_caps
gst_pad_proxy_query_caps
gst_pad_proxy_query_accept_caps
gst_pad_peer_query_accept_caps
gst_pad_set_activate_function
GstPadActivateFunction
...
...
@@ -1666,13 +1660,21 @@ gst_pad_event_default
gst_pad_query
gst_pad_peer_query
gst_pad_query_default
gst_pad_query_position
gst_pad_query_duration
gst_pad_query_convert
gst_pad_query_accept_caps
gst_pad_query_caps
gst_pad_peer_query_position
gst_pad_peer_query_duration
gst_pad_peer_query_convert
gst_pad_peer_query_accept_caps
gst_pad_peer_query_caps
gst_pad_set_query_function
GstPadQueryFunction
gst_pad_set_iterate_internal_links_function
...
...
gst/gstpad.c
View file @
f746174c
...
...
@@ -2106,156 +2106,6 @@ gst_pad_get_current_caps (GstPad * pad)
return
result
;
}
/**
* gst_pad_query_caps:
* @pad: a #GstPad to get the capabilities of.
* @filter: suggested #GstCaps.
*
* Gets the capabilities this pad can produce or consume.
* Note that this method doesn't necessarily return the caps set by
* gst_pad_set_caps() - use gst_pad_get_current_caps() for that instead.
* gst_pad_query_caps returns all possible caps a pad can operate with, using
* the pad's CAPS query function, If the query fails, this function will return
* @filter, if not #NULL, otherwise ANY.
*
* When called on sinkpads @filter contains the caps that
* upstream could produce in the order preferred by upstream. When
* called on srcpads @filter contains the caps accepted by
* downstream in the preffered order. @filter might be %NULL but
* if it is not %NULL the returned caps will be a subset of @filter.
*
* Note that this function does not return writable #GstCaps, use
* gst_caps_make_writable() before modifying the caps.
*
* Returns: (transfer full): the caps of the pad with incremented ref-count.
*/
GstCaps
*
gst_pad_query_caps
(
GstPad
*
pad
,
GstCaps
*
filter
)
{
GstCaps
*
result
=
NULL
;
GstQuery
*
query
;
g_return_val_if_fail
(
GST_IS_PAD
(
pad
),
NULL
);
g_return_val_if_fail
(
filter
==
NULL
||
GST_IS_CAPS
(
filter
),
NULL
);
GST_CAT_DEBUG_OBJECT
(
GST_CAT_CAPS
,
pad
,
"get pad caps"
);
query
=
gst_query_new_caps
(
filter
);
if
(
gst_pad_query
(
pad
,
query
))
{
gst_query_parse_caps_result
(
query
,
&
result
);
gst_caps_ref
(
result
);
GST_DEBUG_OBJECT
(
pad
,
"query returned %"
GST_PTR_FORMAT
,
result
);
}
else
if
(
filter
)
{
result
=
gst_caps_ref
(
filter
);
}
else
{
result
=
gst_caps_new_any
();
}
gst_query_unref
(
query
);
return
result
;
}
/**
* gst_pad_peer_query_caps:
* @pad: a #GstPad to get the capabilities of.
* @filter: a #GstCaps filter.
*
* Gets the capabilities of the peer connected to this pad. Similar to
* gst_pad_query_caps().
*
* When called on srcpads @filter contains the caps that
* upstream could produce in the order preferred by upstream. When
* called on sinkpads @filter contains the caps accepted by
* downstream in the preffered order. @filter might be %NULL but
* if it is not %NULL the returned caps will be a subset of @filter.
*
* Returns: the caps of the peer pad with incremented ref-count. This function
* returns %NULL when there is no peer pad.
*/
GstCaps
*
gst_pad_peer_query_caps
(
GstPad
*
pad
,
GstCaps
*
filter
)
{
GstCaps
*
result
=
NULL
;
GstQuery
*
query
;
g_return_val_if_fail
(
GST_IS_PAD
(
pad
),
NULL
);
g_return_val_if_fail
(
filter
==
NULL
||
GST_IS_CAPS
(
filter
),
NULL
);
query
=
gst_query_new_caps
(
filter
);
if
(
gst_pad_peer_query
(
pad
,
query
))
{
gst_query_parse_caps_result
(
query
,
&
result
);
gst_caps_ref
(
result
);
GST_DEBUG_OBJECT
(
pad
,
"peer query returned %d"
,
result
);
}
else
if
(
filter
)
{
result
=
gst_caps_ref
(
filter
);
}
else
{
result
=
gst_caps_new_any
();
}
gst_query_unref
(
query
);
return
result
;
}
/**
* gst_pad_query_accept_caps:
* @pad: a #GstPad to check
* @caps: a #GstCaps to check on the pad
*
* Check if the given pad accepts the caps.
*
* Returns: TRUE if the pad can accept the caps.
*/
gboolean
gst_pad_query_accept_caps
(
GstPad
*
pad
,
GstCaps
*
caps
)
{
gboolean
res
=
TRUE
;
GstQuery
*
query
;
g_return_val_if_fail
(
GST_IS_PAD
(
pad
),
FALSE
);
g_return_val_if_fail
(
GST_IS_CAPS
(
caps
),
FALSE
);
GST_CAT_DEBUG_OBJECT
(
GST_CAT_CAPS
,
pad
,
"accept caps of %p"
,
caps
);
query
=
gst_query_new_accept_caps
(
caps
);
if
(
gst_pad_query
(
pad
,
query
))
{
GST_DEBUG_OBJECT
(
pad
,
"query returned %d"
,
res
);
gst_query_parse_accept_caps_result
(
query
,
&
res
);
}
gst_query_unref
(
query
);
return
res
;
}
/**
* gst_pad_peer_query_accept_caps:
* @pad: a #GstPad to check the peer of
* @caps: a #GstCaps to check on the pad
*
* Check if the peer of @pad accepts @caps. If @pad has no peer, this function
* returns TRUE.
*
* Returns: TRUE if the peer of @pad can accept the caps or @pad has no peer.
*/
gboolean
gst_pad_peer_query_accept_caps
(
GstPad
*
pad
,
GstCaps
*
caps
)
{
gboolean
res
=
TRUE
;
GstQuery
*
query
;
g_return_val_if_fail
(
GST_IS_PAD
(
pad
),
FALSE
);
g_return_val_if_fail
(
GST_IS_CAPS
(
caps
),
FALSE
);
query
=
gst_query_new_accept_caps
(
caps
);
if
(
gst_pad_peer_query
(
pad
,
query
))
{
GST_DEBUG_OBJECT
(
pad
,
"query returned %d"
,
res
);
gst_query_parse_accept_caps_result
(
query
,
&
res
);
}
gst_query_unref
(
query
);
return
res
;
}
/**
* gst_pad_set_caps:
* @pad: a #GstPad to set the capabilities of.
...
...
gst/gstpad.h
View file @
f746174c
...
...
@@ -834,13 +834,8 @@ GstCaps* gst_pad_get_pad_template_caps (GstPad *pad);
/* capsnego function for linked/unlinked pads */
GstCaps
*
gst_pad_get_current_caps
(
GstPad
*
pad
);
gboolean
gst_pad_has_current_caps
(
GstPad
*
pad
);
GstCaps
*
gst_pad_query_caps
(
GstPad
*
pad
,
GstCaps
*
filter
);
gboolean
gst_pad_query_accept_caps
(
GstPad
*
pad
,
GstCaps
*
caps
);
gboolean
gst_pad_set_caps
(
GstPad
*
pad
,
GstCaps
*
caps
);
GstCaps
*
gst_pad_peer_query_caps
(
GstPad
*
pad
,
GstCaps
*
filter
);
gboolean
gst_pad_peer_query_accept_caps
(
GstPad
*
pad
,
GstCaps
*
caps
);
/* capsnego for linked pads */
GstCaps
*
gst_pad_get_allowed_caps
(
GstPad
*
pad
);
...
...
gst/gstutils.c
View file @
f746174c
...
...
@@ -3038,6 +3038,155 @@ gst_pad_peer_query_convert (GstPad * pad, GstFormat src_format, gint64 src_val,
return
ret
;
}
/**
* gst_pad_query_caps:
* @pad: a #GstPad to get the capabilities of.
* @filter: suggested #GstCaps.
*
* Gets the capabilities this pad can produce or consume.
* Note that this method doesn't necessarily return the caps set by
* gst_pad_set_caps() - use gst_pad_get_current_caps() for that instead.
* gst_pad_query_caps returns all possible caps a pad can operate with, using
* the pad's CAPS query function, If the query fails, this function will return
* @filter, if not #NULL, otherwise ANY.
*
* When called on sinkpads @filter contains the caps that
* upstream could produce in the order preferred by upstream. When
* called on srcpads @filter contains the caps accepted by
* downstream in the preffered order. @filter might be %NULL but
* if it is not %NULL the returned caps will be a subset of @filter.
*
* Note that this function does not return writable #GstCaps, use
* gst_caps_make_writable() before modifying the caps.
*
* Returns: (transfer full): the caps of the pad with incremented ref-count.
*/
GstCaps
*
gst_pad_query_caps
(
GstPad
*
pad
,
GstCaps
*
filter
)
{
GstCaps
*
result
=
NULL
;
GstQuery
*
query
;
g_return_val_if_fail
(
GST_IS_PAD
(
pad
),
NULL
);
g_return_val_if_fail
(
filter
==
NULL
||
GST_IS_CAPS
(
filter
),
NULL
);
GST_CAT_DEBUG_OBJECT
(
GST_CAT_CAPS
,
pad
,
"get pad caps"
);
query
=
gst_query_new_caps
(
filter
);
if
(
gst_pad_query
(
pad
,
query
))
{
gst_query_parse_caps_result
(
query
,
&
result
);
gst_caps_ref
(
result
);
GST_DEBUG_OBJECT
(
pad
,
"query returned %"
GST_PTR_FORMAT
,
result
);
}
else
if
(
filter
)
{
result
=
gst_caps_ref
(
filter
);
}
else
{
result
=
gst_caps_new_any
();
}
gst_query_unref
(
query
);
return
result
;
}
/**
* gst_pad_peer_query_caps:
* @pad: a #GstPad to get the capabilities of.
* @filter: a #GstCaps filter.
*
* Gets the capabilities of the peer connected to this pad. Similar to
* gst_pad_query_caps().
*
* When called on srcpads @filter contains the caps that
* upstream could produce in the order preferred by upstream. When
* called on sinkpads @filter contains the caps accepted by
* downstream in the preffered order. @filter might be %NULL but
* if it is not %NULL the returned caps will be a subset of @filter.
*
* Returns: the caps of the peer pad with incremented ref-count. This function
* returns %NULL when there is no peer pad.
*/
GstCaps
*
gst_pad_peer_query_caps
(
GstPad
*
pad
,
GstCaps
*
filter
)
{
GstCaps
*
result
=
NULL
;
GstQuery
*
query
;
g_return_val_if_fail
(
GST_IS_PAD
(
pad
),
NULL
);
g_return_val_if_fail
(
filter
==
NULL
||
GST_IS_CAPS
(
filter
),
NULL
);
query
=
gst_query_new_caps
(
filter
);
if
(
gst_pad_peer_query
(
pad
,
query
))
{
gst_query_parse_caps_result
(
query
,
&
result
);
gst_caps_ref
(
result
);
GST_DEBUG_OBJECT
(
pad
,
"peer query returned %d"
,
result
);
}
else
if
(
filter
)
{
result
=
gst_caps_ref
(
filter
);
}
else
{
result
=
gst_caps_new_any
();
}
gst_query_unref
(
query
);
return
result
;
}
/**
* gst_pad_query_accept_caps:
* @pad: a #GstPad to check
* @caps: a #GstCaps to check on the pad
*
* Check if the given pad accepts the caps.
*
* Returns: TRUE if the pad can accept the caps.
*/
gboolean
gst_pad_query_accept_caps
(
GstPad
*
pad
,
GstCaps
*
caps
)
{
gboolean
res
=
TRUE
;
GstQuery
*
query
;
g_return_val_if_fail
(
GST_IS_PAD
(
pad
),
FALSE
);
g_return_val_if_fail
(
GST_IS_CAPS
(
caps
),
FALSE
);
GST_CAT_DEBUG_OBJECT
(
GST_CAT_CAPS
,
pad
,
"accept caps of %p"
,
caps
);
query
=
gst_query_new_accept_caps
(
caps
);
if
(
gst_pad_query
(
pad
,
query
))
{
GST_DEBUG_OBJECT
(
pad
,
"query returned %d"
,
res
);
gst_query_parse_accept_caps_result
(
query
,
&
res
);
}
gst_query_unref
(
query
);
return
res
;
}
/**
* gst_pad_peer_query_accept_caps:
* @pad: a #GstPad to check the peer of
* @caps: a #GstCaps to check on the pad
*
* Check if the peer of @pad accepts @caps. If @pad has no peer, this function
* returns TRUE.
*
* Returns: TRUE if the peer of @pad can accept the caps or @pad has no peer.
*/
gboolean
gst_pad_peer_query_accept_caps
(
GstPad
*
pad
,
GstCaps
*
caps
)
{
gboolean
res
=
TRUE
;
GstQuery
*
query
;
g_return_val_if_fail
(
GST_IS_PAD
(
pad
),
FALSE
);
g_return_val_if_fail
(
GST_IS_CAPS
(
caps
),
FALSE
);
query
=
gst_query_new_accept_caps
(
caps
);
if
(
gst_pad_peer_query
(
pad
,
query
))
{
GST_DEBUG_OBJECT
(
pad
,
"query returned %d"
,
res
);
gst_query_parse_accept_caps_result
(
query
,
&
res
);
}
gst_query_unref
(
query
);
return
res
;
}
static
GstPad
*
element_find_unlinked_pad
(
GstElement
*
element
,
GstPadDirection
direction
)
{
...
...
gst/gstutils.h
View file @
f746174c
...
...
@@ -901,11 +901,16 @@ gboolean gst_pad_query_position (GstPad *pad, GstFormat
gboolean
gst_pad_query_duration
(
GstPad
*
pad
,
GstFormat
format
,
gint64
*
duration
);
gboolean
gst_pad_query_convert
(
GstPad
*
pad
,
GstFormat
src_format
,
gint64
src_val
,
GstFormat
dest_format
,
gint64
*
dest_val
);
GstCaps
*
gst_pad_query_caps
(
GstPad
*
pad
,
GstCaps
*
filter
);
gboolean
gst_pad_query_accept_caps
(
GstPad
*
pad
,
GstCaps
*
caps
);
gboolean
gst_pad_peer_query_position
(
GstPad
*
pad
,
GstFormat
format
,
gint64
*
cur
);
gboolean
gst_pad_peer_query_duration
(
GstPad
*
pad
,
GstFormat
format
,
gint64
*
duration
);
gboolean
gst_pad_peer_query_convert
(
GstPad
*
pad
,
GstFormat
src_format
,
gint64
src_val
,
GstFormat
dest_format
,
gint64
*
dest_val
);
GstCaps
*
gst_pad_peer_query_caps
(
GstPad
*
pad
,
GstCaps
*
filter
);
gboolean
gst_pad_peer_query_accept_caps
(
GstPad
*
pad
,
GstCaps
*
caps
);
/* bin functions */
void
gst_bin_add_many
(
GstBin
*
bin
,
GstElement
*
element_1
,
...)
G_GNUC_NULL_TERMINATED
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment