Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
GStreamer
gst-plugins-bad
Commits
4ce8b409
Commit
4ce8b409
authored
Jun 10, 2014
by
Thibault Saunier
🌵
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gl: Port glmixer to the GstVideoAggregator baseclass
https://bugzilla.gnome.org/show_bug.cgi?id=731921
parent
7cf66e7c
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
285 additions
and
1694 deletions
+285
-1694
ext/gl/gstglmosaic.c
ext/gl/gstglmosaic.c
+6
-5
ext/gl/gstglvideomixer.c
ext/gl/gstglvideomixer.c
+13
-34
gst-libs/gst/gl/Makefile.am
gst-libs/gst/gl/Makefile.am
+2
-0
gst-libs/gst/gl/gstglmixer.c
gst-libs/gst/gl/gstglmixer.c
+259
-1598
gst-libs/gst/gl/gstglmixer.h
gst-libs/gst/gl/gstglmixer.h
+2
-37
gst-libs/gst/gl/gstglmixerpad.h
gst-libs/gst/gl/gstglmixerpad.h
+3
-20
No files found.
ext/gl/gstglmosaic.c
View file @
4ce8b409
...
...
@@ -197,9 +197,9 @@ gst_gl_mosaic_process_textures (GstGLMixer * mix, GPtrArray * frames,
//blocking call, use a FBO
gst_gl_context_use_fbo_v2
(
mix
->
context
,
GST_VIDEO_INFO_WIDTH
(
&
mix
->
out_
info
),
GST_VIDEO_INFO_HEIGHT
(
&
mix
->
out_
info
),
mix
->
fbo
,
mix
->
depthbuffer
,
out_tex
,
gst_gl_mosaic_callback
,
(
gpointer
)
mosaic
);
GST_VIDEO_INFO_WIDTH
(
&
GST_VIDEO_AGGREGATOR
(
mix
)
->
info
),
GST_VIDEO_INFO_HEIGHT
(
&
GST_VIDEO_AGGREGATOR
(
mix
)
->
info
),
mix
->
fbo
,
mix
->
depthbuffer
,
out_tex
,
gst_gl_mosaic_callback
,
(
gpointer
)
mosaic
);
return
TRUE
;
}
...
...
@@ -294,8 +294,9 @@ gst_gl_mosaic_callback (gpointer stuff)
continue
;
}
in_tex
=
frame
->
texture
;
width
=
GST_VIDEO_INFO_WIDTH
(
&
frame
->
pad
->
in_info
);
height
=
GST_VIDEO_INFO_HEIGHT
(
&
frame
->
pad
->
in_info
);
width
=
GST_VIDEO_INFO_WIDTH
(
&
GST_VIDEO_AGGREGATOR_PAD
(
frame
->
pad
)
->
info
);
height
=
GST_VIDEO_INFO_HEIGHT
(
&
GST_VIDEO_AGGREGATOR_PAD
(
frame
->
pad
)
->
info
);
if
(
!
in_tex
||
width
<=
0
||
height
<=
0
)
{
GST_DEBUG
(
"skipping texture:%u frame:%p width:%u height %u"
,
...
...
ext/gl/gstglvideomixer.c
View file @
4ce8b409
...
...
@@ -116,7 +116,6 @@ struct _GstGLVideoMixerPad
/* properties */
gint
xpos
,
ypos
;
gint
width
,
height
;
guint
zorder
;
gdouble
alpha
;
};
...
...
@@ -134,7 +133,6 @@ static void gst_gl_video_mixer_pad_set_property (GObject * object,
static
void
gst_gl_video_mixer_pad_get_property
(
GObject
*
object
,
guint
prop_id
,
GValue
*
value
,
GParamSpec
*
pspec
);
#define DEFAULT_PAD_ZORDER 0
#define DEFAULT_PAD_XPOS 0
#define DEFAULT_PAD_YPOS 0
#define DEFAULT_PAD_WIDTH 0
...
...
@@ -143,7 +141,6 @@ static void gst_gl_video_mixer_pad_get_property (GObject * object,
enum
{
PROP_PAD_0
,
PROP_PAD_ZORDER
,
PROP_PAD_XPOS
,
PROP_PAD_YPOS
,
PROP_PAD_WIDTH
,
...
...
@@ -165,10 +162,6 @@ gst_gl_video_mixer_pad_class_init (GstGLVideoMixerPadClass * klass)
gobject_class
->
set_property
=
gst_gl_video_mixer_pad_set_property
;
gobject_class
->
get_property
=
gst_gl_video_mixer_pad_get_property
;
g_object_class_install_property
(
gobject_class
,
PROP_PAD_ZORDER
,
g_param_spec_uint
(
"zorder"
,
"Z-Order"
,
"Z Order of the picture"
,
0
,
10000
,
DEFAULT_PAD_ZORDER
,
G_PARAM_READWRITE
|
GST_PARAM_CONTROLLABLE
|
G_PARAM_STATIC_STRINGS
));
g_object_class_install_property
(
gobject_class
,
PROP_PAD_XPOS
,
g_param_spec_int
(
"xpos"
,
"X Position"
,
"X Position of the picture"
,
G_MININT
,
G_MAXINT
,
DEFAULT_PAD_XPOS
,
...
...
@@ -198,9 +191,6 @@ gst_gl_video_mixer_pad_get_property (GObject * object, guint prop_id,
GstGLVideoMixerPad
*
pad
=
GST_GL_VIDEO_MIXER_PAD
(
object
);
switch
(
prop_id
)
{
case
PROP_PAD_ZORDER
:
g_value_set_uint
(
value
,
pad
->
zorder
);
break
;
case
PROP_PAD_XPOS
:
g_value_set_int
(
value
,
pad
->
xpos
);
break
;
...
...
@@ -222,13 +212,6 @@ gst_gl_video_mixer_pad_get_property (GObject * object, guint prop_id,
}
}
static
int
pad_zorder_compare
(
const
GstGLVideoMixerPad
*
pad1
,
const
GstGLVideoMixerPad
*
pad2
)
{
return
pad1
->
zorder
-
pad2
->
zorder
;
}
static
void
gst_gl_video_mixer_pad_set_property
(
GObject
*
object
,
guint
prop_id
,
const
GValue
*
value
,
GParamSpec
*
pspec
)
...
...
@@ -237,14 +220,6 @@ gst_gl_video_mixer_pad_set_property (GObject * object, guint prop_id,
GstGLMixer
*
mix
=
GST_GL_MIXER
(
gst_pad_get_parent
(
GST_PAD
(
pad
)));
switch
(
prop_id
)
{
case
PROP_PAD_ZORDER
:
GST_GL_MIXER_LOCK
(
mix
);
pad
->
zorder
=
g_value_get_uint
(
value
);
mix
->
sinkpads
=
g_slist_sort
(
mix
->
sinkpads
,
(
GCompareFunc
)
pad_zorder_compare
);
GST_GL_MIXER_UNLOCK
(
mix
);
break
;
case
PROP_PAD_XPOS
:
pad
->
xpos
=
g_value_get_int
(
value
);
break
;
...
...
@@ -273,6 +248,7 @@ gst_gl_video_mixer_class_init (GstGLVideoMixerClass * klass)
{
GObjectClass
*
gobject_class
;
GstElementClass
*
element_class
;
GstAggregatorClass
*
agg_class
=
(
GstAggregatorClass
*
)
klass
;
gobject_class
=
(
GObjectClass
*
)
klass
;
element_class
=
GST_ELEMENT_CLASS
(
klass
);
...
...
@@ -288,6 +264,9 @@ gst_gl_video_mixer_class_init (GstGLVideoMixerClass * klass)
GST_GL_MIXER_CLASS
(
klass
)
->
reset
=
gst_gl_video_mixer_reset
;
GST_GL_MIXER_CLASS
(
klass
)
->
process_textures
=
gst_gl_video_mixer_process_textures
;
agg_class
->
sinkpads_type
=
GST_TYPE_GL_VIDEO_MIXER_PAD
;
}
static
void
...
...
@@ -295,9 +274,6 @@ gst_gl_video_mixer_init (GstGLVideoMixer * video_mixer)
{
video_mixer
->
shader
=
NULL
;
video_mixer
->
input_frames
=
NULL
;
gst_gl_mixer_set_pad_type
(
GST_GL_MIXER
(
video_mixer
),
GST_TYPE_GL_VIDEO_MIXER_PAD
);
}
static
void
...
...
@@ -352,8 +328,9 @@ gst_gl_video_mixer_process_textures (GstGLMixer * mix, GPtrArray * frames,
video_mixer
->
input_frames
=
frames
;
gst_gl_context_use_fbo_v2
(
mix
->
context
,
GST_VIDEO_INFO_WIDTH
(
&
mix
->
out_info
),
GST_VIDEO_INFO_HEIGHT
(
&
mix
->
out_info
),
mix
->
fbo
,
mix
->
depthbuffer
,
GST_VIDEO_INFO_WIDTH
(
&
GST_VIDEO_AGGREGATOR
(
mix
)
->
info
),
GST_VIDEO_INFO_HEIGHT
(
&
GST_VIDEO_AGGREGATOR
(
mix
)
->
info
),
mix
->
fbo
,
mix
->
depthbuffer
,
out_tex
,
gst_gl_video_mixer_callback
,
(
gpointer
)
video_mixer
);
return
TRUE
;
...
...
@@ -378,8 +355,8 @@ gst_gl_video_mixer_callback (gpointer stuff)
guint
count
=
0
;
out_width
=
GST_VIDEO_INFO_WIDTH
(
&
mixer
->
out_
info
);
out_height
=
GST_VIDEO_INFO_HEIGHT
(
&
mixer
->
out_
info
);
out_width
=
GST_VIDEO_INFO_WIDTH
(
&
GST_VIDEO_AGGREGATOR
(
stuff
)
->
info
);
out_height
=
GST_VIDEO_INFO_HEIGHT
(
&
GST_VIDEO_AGGREGATOR
(
stuff
)
->
info
);
gst_gl_context_clear_shader
(
mixer
->
context
);
gl
->
BindTexture
(
GL_TEXTURE_2D
,
0
);
...
...
@@ -424,8 +401,10 @@ gst_gl_video_mixer_callback (gpointer stuff)
continue
;
}
pad
=
(
GstGLVideoMixerPad
*
)
frame
->
pad
;
in_width
=
GST_VIDEO_INFO_WIDTH
(
&
frame
->
pad
->
in_info
);
in_height
=
GST_VIDEO_INFO_HEIGHT
(
&
frame
->
pad
->
in_info
);
in_width
=
GST_VIDEO_INFO_WIDTH
(
&
GST_VIDEO_AGGREGATOR_PAD
(
pad
)
->
info
);
in_height
=
GST_VIDEO_INFO_HEIGHT
(
&
GST_VIDEO_AGGREGATOR_PAD
(
pad
)
->
info
);
if
(
!
frame
->
texture
||
in_width
<=
0
||
in_height
<=
0
)
{
GST_DEBUG
(
"skipping texture:%u frame:%p width:%u height %u"
,
...
...
gst-libs/gst/gl/Makefile.am
View file @
4ce8b409
...
...
@@ -52,6 +52,8 @@ libgstgl_@GST_API_VERSION@include_HEADERS = \
gl.h
libgstgl_@GST_API_VERSION@
_la_LIBADD
=
\
$(top_builddir)
/gst-libs/gst/base/libgstbadbase-
$(GST_API_VERSION)
.la
\
$(top_builddir)
/gst-libs/gst/video/libgstbadvideo-
$(GST_API_VERSION)
.la
\
$(GMODULE_NO_EXPORT_LIBS)
\
$(GST_PLUGINS_BASE_LIBS)
\
-lgstvideo-
$(GST_API_VERSION)
\
...
...
gst-libs/gst/gl/gstglmixer.c
View file @
4ce8b409
This diff is collapsed.
Click to expand it.
gst-libs/gst/gl/gstglmixer.h
View file @
4ce8b409
...
...
@@ -40,10 +40,6 @@ G_BEGIN_DECLS
#define GST_GL_MIXER_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_GL_MIXER,GstGLMixerClass))
#define GST_GL_MIXER_GET_LOCK(mix) (GST_GL_MIXER(mix)->lock)
#define GST_GL_MIXER_LOCK(mix) (g_mutex_lock(&GST_GL_MIXER_GET_LOCK (mix)))
#define GST_GL_MIXER_UNLOCK(mix) (g_mutex_unlock(&GST_GL_MIXER_GET_LOCK (mix)))
typedef
struct
_GstGLMixer
GstGLMixer
;
typedef
struct
_GstGLMixerClass
GstGLMixerClass
;
typedef
struct
_GstGLMixerPrivate
GstGLMixerPrivate
;
...
...
@@ -59,57 +55,28 @@ typedef gboolean (*GstGLMixerProcessTextures) (GstGLMixer *mix,
struct
_GstGLMixer
{
Gst
Element
element
;
Gst
VideoAggregator
vaggregator
;
GstGLMixerPrivate
*
priv
;
/* pad */
GstPad
*
srcpad
;
/* Lock to prevent the state to change while blending */
GMutex
lock
;
/* Sink pads using Collect Pads from core's base library */
GstCollectPads
*
collect
;
/* sinkpads, a GSList of GstGLMixerPads */
GSList
*
sinkpads
;
gint
numpads
;
/* Next available sinkpad index */
gint
next_sinkpad
;
GPtrArray
*
array_buffers
;
GPtrArray
*
frames
;
GstCaps
*
current_caps
;
GstVideoInfo
out_info
;
GLuint
out_tex_id
;
GstGLDownload
*
download
;
gboolean
newseg_pending
;
gboolean
flush_stop_pending
;
gboolean
send_stream_start
;
gboolean
send_caps
;
GstSegment
segment
;
GstClockTime
ts_offset
;
guint64
nframes
;
/* sink event handling */
gdouble
proportion
;
GstClockTime
earliest_time
;
guint64
qos_processed
,
qos_dropped
;
GstGLDisplay
*
display
;
GstGLContext
*
context
;
GLuint
fbo
;
GLuint
depthbuffer
;
GType
pad_type
;
};
struct
_GstGLMixerClass
{
Gst
Element
Class
parent_class
;
Gst
VideoAggregator
Class
parent_class
;
GstGLMixerSetCaps
set_caps
;
GstGLMixerReset
reset
;
...
...
@@ -127,7 +94,5 @@ GType gst_gl_mixer_get_type(void);
gboolean
gst_gl_mixer_process_textures
(
GstGLMixer
*
mix
,
GstBuffer
*
outbuf
);
void
gst_gl_mixer_set_pad_type
(
GstGLMixer
*
mix
,
GType
pad_type
);
G_END_DECLS
#endif
/* __GST_GL_MIXER_H__ */
gst-libs/gst/gl/gstglmixerpad.h
View file @
4ce8b409
...
...
@@ -22,7 +22,7 @@
#define __GST_GL_MIXER_PAD_H__
#include <gst/gst.h>
#include <gst/
base/gstcollectpads
.h>
#include <gst/
video/gstvideoaggregator
.h>
#include <gst/gl/gstgldisplay.h>
#include <gst/gl/gstglupload.h>
...
...
@@ -41,38 +41,21 @@ G_BEGIN_DECLS
typedef
struct
_GstGLMixerPad
GstGLMixerPad
;
typedef
struct
_GstGLMixerPadClass
GstGLMixerPadClass
;
typedef
struct
_GstGLMixerCollect
GstGLMixerCollect
;
struct
_GstGLMixerCollect
{
GstCollectData
collect
;
/* we extend the CollectData */
GstBuffer
*
queued
;
GstBuffer
*
buffer
;
/* the queued buffer for this pad */
GstClockTime
start_time
;
GstClockTime
end_time
;
GstGLMixerPad
*
mixpad
;
};
/* all information needed for one video stream */
struct
_GstGLMixerPad
{
GstPad
parent
;
/* subclass the pad */
Gst
VideoAggregator
Pad
parent
;
/* subclass the pad */
/* <private> */
GstGLUpload
*
upload
;
GstVideoInfo
in_info
;
guint
in_tex_id
;
gboolean
mapped
;
GstGLMixerCollect
*
mixcol
;
};
struct
_GstGLMixerPadClass
{
GstPadClass
parent_class
;
Gst
VideoAggregator
PadClass
parent_class
;
};
GType
gst_gl_mixer_pad_get_type
(
void
);
...
...
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