[115/906] git-svn-id: svn://svn.wobow.com/GStreamer_playground/gst-plugins-gl@556 93df14bb-0f41-7a43-8087-d3e2a2f0e464

This commit is contained in:
Julien Isorce 2008-06-30 00:38:39 +00:00 committed by Matthew Waters
parent 5acf54ccf9
commit 90f411fe53
6 changed files with 414 additions and 394 deletions

File diff suppressed because it is too large Load diff

View file

@ -97,8 +97,17 @@ typedef void (* GLCB2) ( gpointer* p1, gpointer* p2, gint w, gint h);
struct _GstGLDisplay {
GObject object;
//thread safe
GMutex* mutex;
//gl context
gint glutWinId;
gulong winId;
GString* title;
gint win_xpos;
gint win_ypos;
gboolean visible;
gboolean isAlive;
GQueue* texturePool;
//conditions
@ -117,98 +126,92 @@ struct _GstGLDisplay {
GCond* cond_gen_shader;
GCond* cond_del_shader;
gint glutWinId;
gulong winId;
GString* title;
gint win_xpos;
gint win_ypos;
gboolean visible;
gboolean isAlive;
//intput frame buffer object (video -> GL)
GLuint fbo;
GLuint depthBuffer;
GLuint textureFBO;
GLuint textureFBOWidth;
GLuint textureFBOHeight;
GstVideoFormat upload_video_format;
//filter frame buffer object (GL -> GL)
GLuint requestedFBO;
GLuint requestedDepthBuffer;
GLuint requestedTextureFBOWidth;
GLuint requestedTextureFBOHeight;
GLuint usedFBO;
GLuint usedDepthBuffer;
GLuint usedTextureFBO;
GLuint usedTextureFBOWidth;
GLuint usedTextureFBOHeight;
GLCB glsceneFBO_cb;
GLCB2 glsceneFBO_cb2;
gpointer* p1;
gpointer* p2;
GLuint inputTextureWidth;
GLuint inputTextureHeight;
GLuint inputTexture;
GLuint rejectedFBO;
GLuint rejectedDepthBuffer;
//displayed texture
GLuint displayedTexture;
GLuint displayedTextureWidth;
GLuint displayedTextureHeight;
//action redisplay
GLuint redisplay_texture;
GLuint redisplay_texture_width;
GLuint redisplay_texture_height;
//action resize
gint resize_width;
gint resize_height;
GLuint preparedTexture;
GLuint currentTexture;
GLuint currentTexture_u;
GLuint currentTexture_v;
GLuint currentTextureWidth;
GLuint currentTextureHeight;
GstVideoFormat currentVideo_format;
gpointer currentData;
//action gen and del texture
GLuint gen_texture;
GLuint del_texture;
GLuint textureTrash;
//client callbacks
CRCB clientReshapeCallback;
CDCB clientDrawCallback;
//output frame buffer object (GL -> video)
GLuint videoFBO;
GLuint videoDepthBuffer;
GLuint videoTexture;
GLuint videoTexture_u;
GLuint videoTexture_v;
gint outputWidth;
gint outputHeight;
GstVideoFormat outputVideo_format;
gpointer outputData;
GLenum multipleRT[3];
//recorded texture
GLuint recordedTexture;
GLuint recordedTextureWidth;
GLuint recordedTextureHeight;
//colorspace conversion method
//upload
GLuint upload_fbo;
GLuint upload_depth_buffer;
GLuint upload_texture;
GLuint upload_width;
GLuint upload_height;
GstVideoFormat upload_video_format;
GstGLDisplayConversion colorspace_conversion;
gint upload_data_with;
gint upload_data_height;
gpointer upload_data;
//from video to texture
//filter gen fbo
GLuint gen_fbo_width;
GLuint gen_fbo_height;
GLuint generated_fbo;
GLuint generated_depth_buffer;
//filter use fbo
GLuint use_fbo;
GLuint use_depth_buffer;
GLuint use_fbo_texture;
GLuint use_fbo_width;
GLuint use_fbo_height;
GLCB use_fbo_scene_cb;
GLhandleARB use_shader;
GLCB2 use_fbo_scene_cb_2;
gpointer* p1;
gpointer* p2;
GLuint input_texture_width;
GLuint input_texture_height;
GLuint input_texture;
//filter del fbo
GLuint del_fbo;
GLuint del_depth_buffer;
//download
GLuint download_fbo;
GLuint download_depth_buffer;
GLuint download_texture;
GLuint download_texture_u;
GLuint download_texture_v;
gint download_width;
gint download_height;
GstVideoFormat download_video_format;
gpointer download_data;
GLenum multipleRT[3];
GLuint ouput_texture;
GLuint ouput_texture_width;
GLuint ouput_texture_height;
//action gen and del shader
gchar* gen_text_shader;
GLhandleARB gen_handle_shader;
GLhandleARB del_handle_shader;
//fragement shader upload
gchar* textFProgram_YUY2_UYVY;
GLhandleARB GLSLProgram_YUY2;
GLhandleARB GLSLProgram_UYVY;
gchar* textFProgram_I420_YV12;
GLhandleARB GLSLProgram_I420_YV12;
gchar* textFProgram_AYUV;
GLhandleARB GLSLProgram_AYUV;
//from texture to video
//fragement shader download
gchar* textFProgram_to_YUY2_UYVY;
GLhandleARB GLSLProgram_to_YUY2;
GLhandleARB GLSLProgram_to_UYVY;
@ -218,16 +221,6 @@ struct _GstGLDisplay {
gchar* textFProgram_to_AYUV;
GLhandleARB GLSLProgram_to_AYUV;
//requested shader
gchar* requestedTextShader;
GLhandleARB requestedHandleShader;
GLhandleARB usedHandleShader;
GLhandleARB rejectedHandleShader;
//client callbacks
CRCB clientReshapeCallback;
CDCB clientDrawCallback;
};
@ -257,27 +250,26 @@ void gst_gl_display_del_texture (GstGLDisplay* display, guint texture);
void gst_gl_display_init_upload (GstGLDisplay* display, GstVideoFormat video_format,
guint gl_width, guint gl_height);
void gst_gl_display_do_upload (GstGLDisplay* display, GstVideoFormat video_format,
gint video_width, gint video_height, gpointer data,
guint gl_width, guint gl_height, guint pTexture);
void gst_gl_display_do_upload (GstGLDisplay* display, guint texture,
gint data_width, gint data_height,
gpointer data);
void gst_gl_display_init_download (GstGLDisplay* display, GstVideoFormat video_format,
gint width, gint height);
void gst_gl_display_do_download (GstGLDisplay* display, GstVideoFormat video_format,
gint width, gint height, GLuint recordedTexture, gpointer data);
void gst_gl_display_do_download (GstGLDisplay* display, GLuint texture,
gint width, gint height,
gpointer data);
void gst_gl_display_gen_fbo (GstGLDisplay* display, gint width, gint height,
guint* fbo, guint* depthbuffer);
void gst_gl_display_use_fbo (GstGLDisplay* display, gint textureFBOWidth, gint textureFBOheight,
guint fbo, guint depthbuffer, guint textureFBO, GLCB cb,
guint inputTextureWidth, guint inputTextureHeight, guint inputTexture,
GLhandleARB handleShader);
void gst_gl_display_use_fbo_2 (GstGLDisplay* display, gint textureFBOWidth, gint textureFBOheight,
guint fbo, guint depthbuffer, guint textureFBO, GLCB2 cb,
void gst_gl_display_use_fbo (GstGLDisplay* display, gint texture_fbo_width, gint texture_fbo_height,
guint fbo, guint depth_buffer, guint texture_fbo, GLCB cb,
guint input_texture_width, guint input_texture_height, guint input_texture,
GLhandleARB shader);
void gst_gl_display_use_fbo_2 (GstGLDisplay* display, gint texture_fbo_width, gint texture_fbo_height,
guint fbo, guint depth_buffer, guint texture_fbo, GLCB2 cb2,
gpointer* p1, gpointer* p2);
void gst_gl_display_del_fbo (GstGLDisplay* display, guint fbo,
guint depthbuffer);
guint depth_buffer);
void gst_gl_display_gen_shader (GstGLDisplay* display, gchar* textShader, GLhandleARB* handleShader);
void gst_gl_display_del_shader (GstGLDisplay* display, GLhandleARB shader);

View file

@ -447,16 +447,16 @@ gst_gl_colorscale_transform (GstBaseTransform* trans, GstBuffer* inbuf,
GST_BUFFER_DATA (inbuf), GST_BUFFER_SIZE (inbuf));
//blocking call
gst_gl_display_do_upload (colorscale->display, colorscale->input_video_format,
colorscale->input_video_width, colorscale->input_video_height, GST_BUFFER_DATA (inbuf),
gl_temp_buffer->width, gl_temp_buffer->height, gl_temp_buffer->texture);
gst_gl_display_do_upload (colorscale->display, gl_temp_buffer->texture,
colorscale->input_video_width, colorscale->input_video_height,
GST_BUFFER_DATA (inbuf));
GST_DEBUG ("output size %p size %d",
GST_BUFFER_DATA (outbuf), GST_BUFFER_SIZE (outbuf));
//blocking call
gst_gl_display_do_download(colorscale->display, colorscale->output_video_format,
gl_temp_buffer->width, gl_temp_buffer->height, gl_temp_buffer->texture,
gst_gl_display_do_download(colorscale->display, gl_temp_buffer->texture,
gl_temp_buffer->width, gl_temp_buffer->height,
GST_BUFFER_DATA (outbuf));
gst_buffer_unref (gl_temp_buffer);

View file

@ -307,8 +307,8 @@ gst_gl_download_transform (GstBaseTransform* trans, GstBuffer* inbuf,
GST_BUFFER_DATA (outbuf), GST_BUFFER_SIZE (outbuf));
//blocking call
gst_gl_display_do_download(download->display, download->video_format,
gl_inbuf->width, gl_inbuf->height, gl_inbuf->texture, GST_BUFFER_DATA (outbuf));
gst_gl_display_do_download(download->display, gl_inbuf->texture,
gl_inbuf->width, gl_inbuf->height, GST_BUFFER_DATA (outbuf));
return GST_FLOW_OK;
}

View file

@ -488,9 +488,8 @@ gst_glimage_sink_render (GstBaseSink* bsink, GstBuffer* buf)
glimage_sink->width, glimage_sink->height);
//blocking call
gst_gl_display_do_upload(glimage_sink->display, glimage_sink->format,
glimage_sink->width, glimage_sink->height, GST_BUFFER_DATA (buf),
gl_buffer->width, gl_buffer->height, gl_buffer->texture);
gst_gl_display_do_upload(glimage_sink->display, gl_buffer->texture,
glimage_sink->width, glimage_sink->height, GST_BUFFER_DATA (buf));
//gl_buffer is created in this block, so the gl buffer is already referenced
}

View file

@ -467,9 +467,8 @@ gst_gl_upload_transform (GstBaseTransform* trans, GstBuffer* inbuf,
//Depending on the colorspace, video is upload into several textures.
//However, there is only one output texture. The one attached
//to the upload FBO.
gst_gl_display_do_upload (upload->display, upload->video_format,
upload->video_width, upload->video_height, GST_BUFFER_DATA (inbuf),
gl_outbuf->width, gl_outbuf->height, gl_outbuf->texture);
gst_gl_display_do_upload (upload->display, gl_outbuf->texture,
upload->video_width, upload->video_height, GST_BUFFER_DATA (inbuf));
return GST_FLOW_OK;
}