Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
ec759079
Commit
ec759079
authored
Jan 30, 2024
by
Rémi Bernon
Committed by
Alexandre Julliard
Feb 05, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winegstreamer: Handle allocation query in a separate helper.
parent
6dae92cf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
55 deletions
+59
-55
wg_transform.c
dlls/winegstreamer/wg_transform.c
+59
-55
No files found.
dlls/winegstreamer/wg_transform.c
View file @
ec759079
...
@@ -125,74 +125,78 @@ static gboolean transform_src_query_cb(GstPad *pad, GstObject *parent, GstQuery
...
@@ -125,74 +125,78 @@ static gboolean transform_src_query_cb(GstPad *pad, GstObject *parent, GstQuery
}
}
}
}
static
gboolean
transform_sink_query_
cb
(
GstPad
*
pad
,
GstObject
*
parent
,
GstQuery
*
query
)
static
gboolean
transform_sink_query_
allocation
(
struct
wg_transform
*
transform
,
GstQuery
*
query
)
{
{
struct
wg_transform
*
transform
=
gst_pad_get_element_private
(
pad
);
gsize
plane_align
=
transform
->
attrs
.
output_plane_align
;
GstStructure
*
config
,
*
params
;
GstVideoAlignment
align
;
gboolean
needs_pool
;
GstBufferPool
*
pool
;
GstVideoInfo
info
;
GstCaps
*
caps
;
GST_LOG
(
"transform %p, type
\"
%s
\"
."
,
transform
,
gst_query_type_get_name
(
query
->
type
));
gst_query_parse_allocation
(
query
,
&
caps
,
&
needs_pool
);
if
(
stream_type_from_caps
(
caps
)
!=
GST_STREAM_TYPE_VIDEO
||
!
needs_pool
)
return
false
;
switch
(
query
->
type
)
if
(
!
gst_video_info_from_caps
(
&
info
,
caps
)
{
||
!
(
pool
=
gst_video_buffer_pool_new
()))
case
GST_QUERY_ALLOCATION
:
return
false
;
{
gsize
plane_align
=
transform
->
attrs
.
output_plane_align
;
GstStructure
*
config
,
*
params
;
GstVideoAlignment
align
;
gboolean
needs_pool
;
GstBufferPool
*
pool
;
GstVideoInfo
info
;
GstCaps
*
caps
;
gst_query_parse_allocation
(
query
,
&
caps
,
&
needs_pool
);
align_video_info_planes
(
plane_align
,
&
info
,
&
align
);
if
(
stream_type_from_caps
(
caps
)
!=
GST_STREAM_TYPE_VIDEO
||
!
needs_pool
)
break
;
if
(
!
gst_video_info_from_caps
(
&
info
,
caps
)
if
((
params
=
gst_structure_new
(
"video-meta"
,
||
!
(
pool
=
gst_video_buffer_pool_new
()))
"padding-top"
,
G_TYPE_UINT
,
align
.
padding_top
,
break
;
"padding-bottom"
,
G_TYPE_UINT
,
align
.
padding_bottom
,
"padding-left"
,
G_TYPE_UINT
,
align
.
padding_left
,
"padding-right"
,
G_TYPE_UINT
,
align
.
padding_right
,
NULL
)))
{
gst_query_add_allocation_meta
(
query
,
GST_VIDEO_META_API_TYPE
,
params
);
gst_structure_free
(
params
);
}
if
(
!
(
config
=
gst_buffer_pool_get_config
(
pool
)))
GST_ERROR
(
"Failed to get pool %p config."
,
pool
);
else
{
gst_buffer_pool_config_add_option
(
config
,
GST_BUFFER_POOL_OPTION_VIDEO_META
);
gst_buffer_pool_config_add_option
(
config
,
GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT
);
gst_buffer_pool_config_set_video_alignment
(
config
,
&
align
);
align_video_info_planes
(
plane_align
,
&
info
,
&
align
);
gst_buffer_pool_config_set_params
(
config
,
caps
,
info
.
size
,
0
,
0
);
gst_buffer_pool_config_set_allocator
(
config
,
transform
->
allocator
,
NULL
);
if
(
!
gst_buffer_pool_set_config
(
pool
,
config
))
GST_ERROR
(
"Failed to set pool %p config."
,
pool
);
}
if
((
params
=
gst_structure_new
(
"video-meta"
,
/* Prevent pool reconfiguration, we don't want another alignment. */
"padding-top"
,
G_TYPE_UINT
,
align
.
padding_top
,
if
(
!
gst_buffer_pool_set_active
(
pool
,
true
))
"padding-bottom"
,
G_TYPE_UINT
,
align
.
padding_bottom
,
GST_ERROR
(
"Pool %p failed to activate."
,
pool
);
"padding-left"
,
G_TYPE_UINT
,
align
.
padding_left
,
"padding-right"
,
G_TYPE_UINT
,
align
.
padding_right
,
NULL
)))
{
gst_query_add_allocation_meta
(
query
,
GST_VIDEO_META_API_TYPE
,
params
);
gst_structure_free
(
params
);
}
if
(
!
(
config
=
gst_buffer_pool_get_config
(
pool
)))
gst_query_add_allocation_pool
(
query
,
pool
,
info
.
size
,
0
,
0
);
GST_ERROR
(
"Failed to get pool %p config."
,
pool
);
gst_query_add_allocation_param
(
query
,
transform
->
allocator
,
NULL
);
else
{
gst_buffer_pool_config_add_option
(
config
,
GST_BUFFER_POOL_OPTION_VIDEO_META
);
gst_buffer_pool_config_add_option
(
config
,
GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT
);
gst_buffer_pool_config_set_video_alignment
(
config
,
&
align
);
gst_buffer_pool_config_set_params
(
config
,
caps
,
info
.
size
,
0
,
0
);
gst_buffer_pool_config_set_allocator
(
config
,
transform
->
allocator
,
NULL
);
if
(
!
gst_buffer_pool_set_config
(
pool
,
config
))
GST_ERROR
(
"Failed to set pool %p config."
,
pool
);
}
/* Prevent pool reconfiguration, we don't want another alignment. */
GST_INFO
(
"Proposing pool %p, buffer size %#zx, allocator %p, for query %p."
,
if
(
!
gst_buffer_pool_set_active
(
pool
,
true
))
pool
,
info
.
size
,
transform
->
allocator
,
query
);
GST_ERROR
(
"Pool %p failed to activate."
,
pool
);
gst_query_add_allocation_pool
(
query
,
pool
,
info
.
size
,
0
,
0
);
g_object_unref
(
pool
);
gst_query_add_allocation_param
(
query
,
transform
->
allocator
,
NULL
);
return
true
;
}
GST_INFO
(
"Proposing pool %p, buffer size %#zx, allocator %p, for query %p."
,
static
gboolean
transform_sink_query_cb
(
GstPad
*
pad
,
GstObject
*
parent
,
GstQuery
*
query
)
pool
,
info
.
size
,
transform
->
allocator
,
query
);
{
struct
wg_transform
*
transform
=
gst_pad_get_element_private
(
pad
);
g_object_unref
(
pool
);
GST_LOG
(
"transform %p, type
\"
%s
\"
."
,
transform
,
gst_query_type_get_name
(
query
->
type
));
return
true
;
}
switch
(
query
->
type
)
{
case
GST_QUERY_ALLOCATION
:
if
(
transform_sink_query_allocation
(
transform
,
query
))
return
true
;
break
;
case
GST_QUERY_CAPS
:
case
GST_QUERY_CAPS
:
{
{
GstCaps
*
caps
,
*
filter
,
*
temp
;
GstCaps
*
caps
,
*
filter
,
*
temp
;
...
...
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