Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
George Kiagiadakis
gst-plugins-good
Commits
0488984f
Commit
0488984f
authored
Mar 27, 2014
by
Nicolas Dufresne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v4l2: Move propose allocation to v4l2object
parent
f810196b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
55 deletions
+64
-55
sys/v4l2/gstv4l2object.c
sys/v4l2/gstv4l2object.c
+60
-0
sys/v4l2/gstv4l2object.h
sys/v4l2/gstv4l2object.h
+3
-0
sys/v4l2/gstv4l2sink.c
sys/v4l2/gstv4l2sink.c
+1
-55
No files found.
sys/v4l2/gstv4l2object.c
View file @
0488984f
...
...
@@ -3169,3 +3169,63 @@ pool_failed:
return
FALSE
;
}
}
gboolean
gst_v4l2_object_propose_allocation
(
GstV4l2Object
*
obj
,
GstQuery
*
query
)
{
GstBufferPool
*
pool
;
guint
size
=
0
;
GstCaps
*
caps
;
gboolean
need_pool
;
gst_query_parse_allocation
(
query
,
&
caps
,
&
need_pool
);
if
(
caps
==
NULL
)
goto
no_caps
;
if
((
pool
=
obj
->
pool
))
gst_object_ref
(
pool
);
if
(
pool
!=
NULL
)
{
GstCaps
*
pcaps
;
GstStructure
*
config
;
/* we had a pool, check caps */
config
=
gst_buffer_pool_get_config
(
pool
);
gst_buffer_pool_config_get_params
(
config
,
&
pcaps
,
&
size
,
NULL
,
NULL
);
GST_DEBUG_OBJECT
(
obj
->
element
,
"we had a pool with caps %"
GST_PTR_FORMAT
,
pcaps
);
if
(
!
gst_caps_is_equal
(
caps
,
pcaps
))
{
gst_structure_free
(
config
);
gst_object_unref
(
pool
);
goto
different_caps
;
}
gst_structure_free
(
config
);
}
/* we need at least 2 buffers to operate */
gst_query_add_allocation_pool
(
query
,
pool
,
size
,
2
,
0
);
/* we also support various metadata */
/* FIXME should it be set per class ? */
gst_query_add_allocation_meta
(
query
,
GST_VIDEO_META_API_TYPE
,
NULL
);
gst_query_add_allocation_meta
(
query
,
GST_VIDEO_CROP_META_API_TYPE
,
NULL
);
if
(
pool
)
gst_object_unref
(
pool
);
return
TRUE
;
/* ERRORS */
no_caps:
{
GST_DEBUG_OBJECT
(
obj
->
element
,
"no caps specified"
);
return
FALSE
;
}
different_caps:
{
/* different caps, we can't use this pool */
GST_DEBUG_OBJECT
(
obj
->
element
,
"pool has different caps"
);
return
FALSE
;
}
}
sys/v4l2/gstv4l2object.h
View file @
0488984f
...
...
@@ -268,6 +268,9 @@ gboolean gst_v4l2_object_set_crop (GstV4l2Object * obj);
gboolean
gst_v4l2_object_decide_allocation
(
GstV4l2Object
*
v4l2object
,
GstQuery
*
query
);
gboolean
gst_v4l2_object_propose_allocation
(
GstV4l2Object
*
obj
,
GstQuery
*
query
);
GstStructure
*
gst_v4l2_object_v4l2fourcc_to_structure
(
guint32
fourcc
);
...
...
sys/v4l2/gstv4l2sink.c
View file @
0488984f
...
...
@@ -536,61 +536,7 @@ static gboolean
gst_v4l2sink_propose_allocation
(
GstBaseSink
*
bsink
,
GstQuery
*
query
)
{
GstV4l2Sink
*
v4l2sink
=
GST_V4L2SINK
(
bsink
);
GstV4l2Object
*
obj
=
v4l2sink
->
v4l2object
;
GstBufferPool
*
pool
;
guint
size
=
0
;
GstCaps
*
caps
;
gboolean
need_pool
;
gst_query_parse_allocation
(
query
,
&
caps
,
&
need_pool
);
if
(
caps
==
NULL
)
goto
no_caps
;
if
((
pool
=
obj
->
pool
))
gst_object_ref
(
pool
);
if
(
pool
!=
NULL
)
{
GstCaps
*
pcaps
;
GstStructure
*
config
;
/* we had a pool, check caps */
config
=
gst_buffer_pool_get_config
(
pool
);
gst_buffer_pool_config_get_params
(
config
,
&
pcaps
,
&
size
,
NULL
,
NULL
);
GST_DEBUG_OBJECT
(
v4l2sink
,
"we had a pool with caps %"
GST_PTR_FORMAT
,
pcaps
);
if
(
!
gst_caps_is_equal
(
caps
,
pcaps
))
{
gst_structure_free
(
config
);
gst_object_unref
(
pool
);
goto
different_caps
;
}
gst_structure_free
(
config
);
}
/* we need at least 2 buffers to operate */
gst_query_add_allocation_pool
(
query
,
pool
,
size
,
2
,
0
);
/* we also support various metadata */
gst_query_add_allocation_meta
(
query
,
GST_VIDEO_META_API_TYPE
,
NULL
);
gst_query_add_allocation_meta
(
query
,
GST_VIDEO_CROP_META_API_TYPE
,
NULL
);
if
(
pool
)
gst_object_unref
(
pool
);
return
TRUE
;
/* ERRORS */
no_caps:
{
GST_DEBUG_OBJECT
(
v4l2sink
,
"no caps specified"
);
return
FALSE
;
}
different_caps:
{
/* different caps, we can't use this pool */
GST_DEBUG_OBJECT
(
v4l2sink
,
"pool has different caps"
);
return
FALSE
;
}
return
gst_v4l2_object_propose_allocation
(
v4l2sink
->
v4l2object
,
query
);
}
/* called after A/V sync to render frame */
...
...
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