Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gst-plugins-good
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
George Kiagiadakis
gst-plugins-good
Commits
5d98c9d5
Commit
5d98c9d5
authored
Jun 21, 2013
by
Kishore Arepalli
Committed by
Sebastian Dröge
Jul 01, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdkpixbufoverlay: Allow negative offsets to specify offset from bottom/right
https://bugzilla.gnome.org/show_bug.cgi?id=702826
parent
4053e1d6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
14 deletions
+17
-14
ext/gdk_pixbuf/gstgdkpixbufoverlay.c
ext/gdk_pixbuf/gstgdkpixbufoverlay.c
+17
-14
No files found.
ext/gdk_pixbuf/gstgdkpixbufoverlay.c
View file @
5d98c9d5
...
...
@@ -138,14 +138,16 @@ gst_gdk_pixbuf_overlay_class_init (GstGdkPixbufOverlayClass * klass)
G_PARAM_READWRITE
|
G_PARAM_STATIC_STRINGS
));
g_object_class_install_property
(
gobject_class
,
PROP_OFFSET_X
,
g_param_spec_int
(
"offset-x"
,
"X Offset"
,
"Horizontal offset of overlay image in pixels from top-left corner "
"of video image"
,
G_MININT
,
G_MAXINT
,
0
,
"For positive value, horizontal offset of overlay image in pixels from"
" left of video image. For negative value, horizontal offset of overlay"
" image in pixels from right of video image"
,
G_MININT
,
G_MAXINT
,
0
,
GST_PARAM_CONTROLLABLE
|
GST_PARAM_MUTABLE_PLAYING
|
G_PARAM_READWRITE
|
G_PARAM_STATIC_STRINGS
));
g_object_class_install_property
(
gobject_class
,
PROP_OFFSET_Y
,
g_param_spec_int
(
"offset-y"
,
"Y Offset"
,
"Vertical offset of overlay image in pixels from top-left corner "
"of video image"
,
G_MININT
,
G_MAXINT
,
0
,
"For positive value, vertical offset of overlay image in pixels from"
" top of video image. For negative value, vertical offset of overlay"
" image in pixels from bottom of video image"
,
G_MININT
,
G_MAXINT
,
0
,
GST_PARAM_CONTROLLABLE
|
GST_PARAM_MUTABLE_PLAYING
|
G_PARAM_READWRITE
|
G_PARAM_STATIC_STRINGS
));
g_object_class_install_property
(
gobject_class
,
PROP_RELATIVE_X
,
...
...
@@ -436,6 +438,8 @@ gst_gdk_pixbuf_overlay_update_composition (GstGdkPixbufOverlay * overlay)
GstVideoOverlayRectangle
*
rect
;
GstVideoMeta
*
overlay_meta
;
gint
x
,
y
,
width
,
height
;
gint
video_width
=
GST_VIDEO_INFO_WIDTH
(
&
GST_VIDEO_FILTER
(
overlay
)
->
in_info
);
gint
video_height
=
GST_VIDEO_INFO_HEIGHT
(
&
GST_VIDEO_FILTER
(
overlay
)
->
in_info
);
if
(
overlay
->
comp
)
{
gst_video_overlay_composition_unref
(
overlay
->
comp
);
...
...
@@ -447,14 +451,14 @@ gst_gdk_pixbuf_overlay_update_composition (GstGdkPixbufOverlay * overlay)
overlay_meta
=
gst_buffer_get_video_meta
(
overlay
->
pixels
);
x
=
overlay
->
offset_x
+
(
overlay
->
relative_x
*
overlay_meta
->
width
);
y
=
overlay
->
offset_y
+
(
overlay
->
relative_y
*
overlay_meta
->
height
);
/* FIXME: this should work, but seems to crash */
if
(
x
<
0
)
x
=
0
;
if
(
y
<
0
)
y
=
0
;
x
=
overlay
->
offset_x
<
0
?
video_width
+
overlay
->
offset_x
-
overlay_meta
->
width
+
(
overlay
->
relative_x
*
overlay_meta
->
width
)
:
overlay
->
offset_x
+
(
overlay
->
relative_x
*
overlay_meta
->
width
);
y
=
overlay
->
offset_y
<
0
?
video_height
+
overlay
->
offset_y
-
overlay_meta
->
height
+
(
overlay
->
relative_y
*
overlay_meta
->
height
)
:
overlay
->
offset_y
+
(
overlay
->
relative_y
*
overlay_meta
->
height
)
;
width
=
overlay
->
overlay_width
;
if
(
width
==
0
)
...
...
@@ -472,8 +476,7 @@ gst_gdk_pixbuf_overlay_update_composition (GstGdkPixbufOverlay * overlay)
overlay
->
overlay_height
,
overlay
->
overlay_width
);
GST_DEBUG_OBJECT
(
overlay
,
"overlay rendered: %d x %d @ %d,%d (onto %d x %d)"
,
width
,
height
,
x
,
y
,
GST_VIDEO_INFO_WIDTH
(
&
GST_VIDEO_FILTER
(
overlay
)
->
in_info
),
GST_VIDEO_INFO_HEIGHT
(
&
GST_VIDEO_FILTER
(
overlay
)
->
in_info
));
video_width
,
video_height
);
rect
=
gst_video_overlay_rectangle_new_raw
(
overlay
->
pixels
,
x
,
y
,
width
,
height
,
GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE
);
...
...
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