mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-28 04:31:06 +00:00
[085/906] fix regressions about glvideomaker.
git-svn-id: svn://svn.wobow.com/GStreamer_playground/gst-plugins-gl@497 93df14bb-0f41-7a43-8087-d3e2a2f0e464
This commit is contained in:
parent
f7b69d5233
commit
6c3eb8de43
6 changed files with 168 additions and 151 deletions
|
@ -170,6 +170,10 @@ gst_gl_display_init (GstGLDisplay *display, GstGLDisplayClass *klass)
|
|||
display->outputVideo_format = 0;
|
||||
display->outputData = NULL;
|
||||
|
||||
display->recordedTexture = 0;
|
||||
display->recordedTextureWidth = 0;
|
||||
display->recordedTextureHeight = 0;
|
||||
|
||||
display->glutWinId = -1;
|
||||
display->winId = 0;
|
||||
display->win_xpos = 0;
|
||||
|
@ -1216,12 +1220,15 @@ gst_gl_display_clearTexture (GstGLDisplay* display, guint texture,
|
|||
/* Called by gst_gl elements */
|
||||
void
|
||||
gst_gl_display_videoChanged (GstGLDisplay* display, GstVideoFormat video_format,
|
||||
gpointer data)
|
||||
gint width, gint height, GLuint recordedTexture, gpointer data)
|
||||
{
|
||||
gst_gl_display_lock (display);
|
||||
//data size is aocciated to the glcontext size
|
||||
display->outputVideo_format = video_format;
|
||||
display->outputData = data;
|
||||
display->recordedTexture = recordedTexture;
|
||||
display->recordedTextureWidth = width;
|
||||
display->recordedTextureHeight = height;
|
||||
gst_gl_display_postMessage (GST_GL_DISPLAY_ACTION_VIDEO, display);
|
||||
g_cond_wait (display->cond_video, display->mutex);
|
||||
gst_gl_display_unlock (display);
|
||||
|
@ -1890,25 +1897,25 @@ gst_gl_display_draw_graphic (GstGLDisplay* display)
|
|||
//check if a client draw callback is registered
|
||||
if (display->clientDrawCallback)
|
||||
{
|
||||
display->clientDrawCallback(display->textureFBO,
|
||||
display->textureFBOWidth, display->textureFBOHeight);
|
||||
display->clientDrawCallback(display->recordedTexture,
|
||||
display->recordedTextureWidth, display->recordedTextureHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
glMatrixMode (GL_PROJECTION);
|
||||
glLoadIdentity ();
|
||||
|
||||
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, display->textureFBO);
|
||||
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, display->recordedTexture);
|
||||
glEnable (GL_TEXTURE_RECTANGLE_ARB);
|
||||
|
||||
glBegin (GL_QUADS);
|
||||
glTexCoord2i (display->textureFBOWidth, 0);
|
||||
glTexCoord2i (display->recordedTextureWidth, 0);
|
||||
glVertex2f (1.0f, 1.0f);
|
||||
glTexCoord2i (0, 0);
|
||||
glVertex2f (-1.0f, 1.0f);
|
||||
glTexCoord2i (0, display->textureFBOHeight);
|
||||
glTexCoord2i (0, display->recordedTextureHeight);
|
||||
glVertex2f (-1.0f, -1.0f);
|
||||
glTexCoord2i (display->textureFBOWidth, display->textureFBOHeight);
|
||||
glTexCoord2i (display->recordedTextureWidth, display->recordedTextureHeight);
|
||||
glVertex2f (1.0f, -1.0f);
|
||||
glEnd ();
|
||||
}
|
||||
|
|
|
@ -182,6 +182,11 @@ struct _GstGLDisplay {
|
|||
gpointer outputData;
|
||||
GLenum multipleRT[3];
|
||||
|
||||
//recorded texture
|
||||
GLuint recordedTexture;
|
||||
GLuint recordedTextureWidth;
|
||||
GLuint recordedTextureHeight;
|
||||
|
||||
//from video to texture
|
||||
|
||||
gchar* textFProgram_YUY2_UYVY;
|
||||
|
@ -242,7 +247,7 @@ void gst_gl_display_clearTexture (GstGLDisplay* display, guint texture,
|
|||
guint texture_u, guint texture_v);
|
||||
|
||||
void gst_gl_display_videoChanged (GstGLDisplay* display, GstVideoFormat video_format,
|
||||
gpointer data);
|
||||
gint width, gint height, GLuint recordedTexture, gpointer data);
|
||||
gboolean gst_gl_display_postRedisplay (GstGLDisplay* display, GLuint texture, gint width, gint height);
|
||||
void gst_gl_display_requestFBO (GstGLDisplay* display, gint width, gint height,
|
||||
guint* fbo, guint* depthbuffer, guint* texture);
|
||||
|
|
|
@ -122,7 +122,8 @@ gst_gl_filter_set_property (GObject * object, guint prop_id,
|
|||
{
|
||||
//GstGLFilter *filter = GST_GL_FILTER (object);
|
||||
|
||||
switch (prop_id) {
|
||||
switch (prop_id)
|
||||
{
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -135,7 +136,8 @@ gst_gl_filter_get_property (GObject * object, guint prop_id,
|
|||
{
|
||||
//GstGLFilter *filter = GST_GL_FILTER (object);
|
||||
|
||||
switch (prop_id) {
|
||||
switch (prop_id)
|
||||
{
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
|
|
@ -198,6 +198,7 @@ gst_gl_filter_app_setClientCallbacks (GstGLFilter* filter)
|
|||
gst_gl_display_setClientDrawCallback (filter->display,
|
||||
app_filter->clientDrawCallback);
|
||||
|
||||
if (app_filter->glcontext_width != 0 && app_filter->glcontext_height != 0)
|
||||
gst_gl_display_resetGLcontext (filter->display,
|
||||
app_filter->glcontext_width, app_filter->glcontext_height);
|
||||
}
|
||||
|
|
|
@ -31,13 +31,13 @@ G_BEGIN_DECLS
|
|||
#define GST_GL_FILTER_CUBE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_GL_FILTER_CUBE,GstGLFilterCubeClass))
|
||||
#define GST_IS_GL_FILTER_CUBE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_GL_FILTER_CUBE))
|
||||
#define GST_GL_FILTER_CUBE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_GL_FILTER_CUBE,GstGLFilterCubeClass))
|
||||
|
||||
typedef struct _GstGLFilterCube GstGLFilterCube;
|
||||
typedef struct _GstGLFilterCubeClass GstGLFilterCubeClass;
|
||||
|
||||
struct _GstGLFilterCube
|
||||
{
|
||||
GstGLFilter filter;
|
||||
|
||||
};
|
||||
|
||||
struct _GstGLFilterCubeClass
|
||||
|
|
|
@ -76,15 +76,14 @@ static gboolean gst_gl_videomaker_start (GstBaseTransform* bt);
|
|||
static gboolean gst_gl_videomaker_stop (GstBaseTransform* bt);
|
||||
static GstFlowReturn gst_gl_videomaker_transform (GstBaseTransform* trans,
|
||||
GstBuffer* inbuf, GstBuffer* outbuf);
|
||||
static gboolean
|
||||
gst_gl_videomaker_get_unit_size (GstBaseTransform* trans, GstCaps* caps,
|
||||
static gboolean gst_gl_videomaker_get_unit_size (GstBaseTransform* trans, GstCaps* caps,
|
||||
guint* size);
|
||||
|
||||
|
||||
static void
|
||||
gst_gl_videomaker_base_init (gpointer klass)
|
||||
{
|
||||
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
||||
GstElementClass* element_class = GST_ELEMENT_CLASS (klass);
|
||||
|
||||
gst_element_class_set_details (element_class, &element_details);
|
||||
|
||||
|
@ -96,9 +95,9 @@ gst_gl_videomaker_base_init (gpointer klass)
|
|||
|
||||
|
||||
static void
|
||||
gst_gl_videomaker_class_init (GstGLVideomakerClass * klass)
|
||||
gst_gl_videomaker_class_init (GstGLVideomakerClass* klass)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GObjectClass* gobject_class;
|
||||
|
||||
gobject_class = (GObjectClass *) klass;
|
||||
gobject_class->set_property = gst_gl_videomaker_set_property;
|
||||
|
@ -128,7 +127,8 @@ gst_gl_videomaker_set_property (GObject* object, guint prop_id,
|
|||
{
|
||||
//GstGLVideomaker *videomaker = GST_GL_VIDEOMAKER (object);
|
||||
|
||||
switch (prop_id) {
|
||||
switch (prop_id)
|
||||
{
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -137,8 +137,8 @@ gst_gl_videomaker_set_property (GObject* object, guint prop_id,
|
|||
|
||||
|
||||
static void
|
||||
gst_gl_videomaker_get_property (GObject * object, guint prop_id,
|
||||
GValue * value, GParamSpec * pspec)
|
||||
gst_gl_videomaker_get_property (GObject* object, guint prop_id,
|
||||
GValue* value, GParamSpec* pspec)
|
||||
{
|
||||
//GstGLVideomaker *videomaker = GST_GL_VIDEOMAKER (object);
|
||||
|
||||
|
@ -153,7 +153,8 @@ gst_gl_videomaker_get_property (GObject * object, guint prop_id,
|
|||
static void
|
||||
gst_gl_videomaker_reset (GstGLVideomaker* videomaker)
|
||||
{
|
||||
if (videomaker->display) {
|
||||
if (videomaker->display)
|
||||
{
|
||||
g_object_unref (videomaker->display);
|
||||
videomaker->display = NULL;
|
||||
}
|
||||
|
@ -178,9 +179,9 @@ gst_gl_videomaker_stop (GstBaseTransform* bt)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static GstCaps *
|
||||
static GstCaps*
|
||||
gst_gl_videomaker_transform_caps (GstBaseTransform * bt,
|
||||
GstPadDirection direction, GstCaps * caps)
|
||||
GstPadDirection direction, GstCaps* caps)
|
||||
{
|
||||
GstGLVideomaker* videomaker;
|
||||
GstStructure* structure;
|
||||
|
@ -236,7 +237,7 @@ gst_gl_videomaker_transform_caps (GstBaseTransform * bt,
|
|||
|
||||
static gboolean
|
||||
gst_gl_videomaker_set_caps (GstBaseTransform* bt, GstCaps* incaps,
|
||||
GstCaps * outcaps)
|
||||
GstCaps* outcaps)
|
||||
{
|
||||
GstGLVideomaker* videomaker;
|
||||
gboolean ret;
|
||||
|
@ -248,7 +249,8 @@ gst_gl_videomaker_set_caps (GstBaseTransform* bt, GstCaps* incaps,
|
|||
ret = gst_video_format_parse_caps (outcaps, &videomaker->video_format,
|
||||
&videomaker->width, &videomaker->height);
|
||||
|
||||
if (!ret) {
|
||||
if (!ret)
|
||||
{
|
||||
GST_ERROR ("bad caps");
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -290,7 +292,7 @@ gst_gl_videomaker_transform (GstBaseTransform* trans, GstBuffer* inbuf,
|
|||
GstBuffer* outbuf)
|
||||
{
|
||||
GstGLVideomaker* videomaker = NULL;
|
||||
GstGLBuffer *gl_inbuf = GST_GL_BUFFER (inbuf);
|
||||
GstGLBuffer* gl_inbuf = GST_GL_BUFFER (inbuf);
|
||||
|
||||
videomaker = GST_GL_VIDEOMAKER (trans);
|
||||
|
||||
|
@ -303,8 +305,8 @@ gst_gl_videomaker_transform (GstBaseTransform* trans, GstBuffer* inbuf,
|
|||
GST_BUFFER_DATA (outbuf), GST_BUFFER_SIZE (outbuf));
|
||||
|
||||
//blocking call
|
||||
gst_gl_display_videoChanged(videomaker->display,
|
||||
videomaker->video_format, GST_BUFFER_DATA (outbuf));
|
||||
gst_gl_display_videoChanged(videomaker->display, videomaker->video_format,
|
||||
gl_inbuf->width, gl_inbuf->height, gl_inbuf->textureGL, GST_BUFFER_DATA (outbuf));
|
||||
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue