OSDN Git Service

[COMMON][Qt] Fix BYTEORDER of PIXEL@RGB888.Updated SOVERSION.
authorK.Ohta <whatisthis.sowhat@gmail.com>
Tue, 17 Jul 2018 07:04:32 +0000 (16:04 +0900)
committerK.Ohta <whatisthis.sowhat@gmail.com>
Tue, 17 Jul 2018 07:04:32 +0000 (16:04 +0900)
21 files changed:
source/src/common.h
source/src/qt/CMakeLists.txt
source/src/qt/avio/CMakeLists.txt
source/src/qt/avio/movie_loader.cpp
source/src/qt/avio/movie_saver_video.cpp
source/src/qt/emuutils/CMakeLists.txt
source/src/qt/gui/CMakeLists.txt
source/src/qt/gui/gl2/qt_glutil_gl2_0.cpp
source/src/qt/gui/gl2/vertex_shader.glsl
source/src/qt/gui/gl3/grids_vertex_shader.glsl
source/src/qt/gui/gl3/led_vertex_shader.glsl
source/src/qt/gui/gl3/qt_glutil_gl3_0.cpp
source/src/qt/gui/gl3/vertex_shader.glsl
source/src/qt/gui/gles2/chromakey_fragment_shader2.glsl
source/src/qt/gui/gles2/fragment_shader.glsl
source/src/qt/gui/gles2/grids_vertex_shader.glsl
source/src/qt/gui/gles2/qt_glutil_gles_2.cpp
source/src/qt/gui/gles2/qt_glutil_gles_2.h
source/src/qt/gui/gles2/vertex_shader.glsl
source/src/qt/osd_video.cpp
source/src/vm/common_vm/CMakeLists.txt

index 58be3df..7e9e8df 100644 (file)
@@ -976,6 +976,14 @@ uint16_t DLL_PREFIX EndianFromBig_WORD(uint16_t x);
        uint8_t DLL_PREFIX A_OF_COLOR(scrntype_t c);
 #elif defined(_RGB888)
        typedef uint32_t scrntype_t;
+#if defined(__LITTLE_ENDIAN__)
+       #define RGB_COLOR(r, g, b)      (((uint32_t)(b) << 16) | ((uint32_t)(g) << 8) | ((uint32_t)(r) << 0) | (0xff << 24))
+       #define RGBA_COLOR(r, g, b, a)  (((uint32_t)(b) << 16) | ((uint32_t)(g) << 8) | ((uint32_t)(r) << 0) | ((uint32_t)(a) << 24))
+       #define R_OF_COLOR(c)           (((c)      ) & 0xff)
+       #define G_OF_COLOR(c)           (((c) >>  8) & 0xff)
+       #define B_OF_COLOR(c)           (((c) >> 16) & 0xff)
+       #define A_OF_COLOR(c)           (((c) >> 24) & 0xff)
+#else
        #define RGB_COLOR(r, g, b)      (((uint32_t)(r) << 16) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 0) | (0xff << 24))
        #define RGBA_COLOR(r, g, b, a)  (((uint32_t)(r) << 16) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 0) | ((uint32_t)(a) << 24))
        #define R_OF_COLOR(c)           (((c) >> 16) & 0xff)
@@ -983,6 +991,7 @@ uint16_t DLL_PREFIX EndianFromBig_WORD(uint16_t x);
        #define B_OF_COLOR(c)           (((c)      ) & 0xff)
        #define A_OF_COLOR(c)           (((c) >> 24) & 0xff)
 #endif
+#endif
 
 inline uint64_t ExchangeEndianU64(uint64_t __in)
 {
index b160435..0054597 100644 (file)
@@ -1,5 +1,5 @@
 message("* qt/osd")
-SET(THIS_LIB_VERSION 2.12.3) 
+SET(THIS_LIB_VERSION 2.13.0)
 
 set(s_qt_osd_headers
        osd_base.h
@@ -14,7 +14,7 @@ endif()
 
 SET(s_qt_osd_srcs
 #        pch.cpp
-         osd_base.cpp
+      osd_base.cpp
          osd_screen.cpp
          osd_console.cpp
          osd_input.cpp
index 9d58c1b..aafc68e 100644 (file)
@@ -1,6 +1,6 @@
 message("* qt/avio")
 
-SET(THIS_LIB_VERSION 2.8.2)
+SET(THIS_LIB_VERSION 2.9.1)
 set(s_qt_avio_headers
          movie_saver.h
          movie_loader.h
index 7cebdc6..471f413 100644 (file)
@@ -111,7 +111,7 @@ int MOVIE_LOADER::decode_packet(int *got_frame, int cached)
                                //video_mutex->lock();
                                for(int i = 0; i < 4; i++) av_free(video_dst_data[i]);
                                ret = av_image_alloc(video_dst_data, video_dst_linesize,
-                                                                        dst_width, dst_height, AV_PIX_FMT_BGRA, 1);
+                                                                        dst_width, dst_height, AV_PIX_FMT_RGBA, 1);
                                
                                if(ret < 0) {
                                        p_logger->debug_log(CSP_LOG_INFO, CSP_LOG_TYPE_MOVIE_LOADER, "MOVIE_LOADER: Could not re-allocate output buffer\n");
@@ -141,7 +141,7 @@ int MOVIE_LOADER::decode_packet(int *got_frame, int cached)
                                sws_context = sws_getContext(frame->width, frame->height,
                                                                                         (enum AVPixelFormat) frame->format,
                                                                                         dst_width, dst_height,
-                                                                                        AV_PIX_FMT_BGRA,
+                                                                                        AV_PIX_FMT_RGBA,
                                                                                         SCALE_FLAGS, NULL, NULL, NULL);
                                //p_logger->debug_log(CSP_LOG_DEBUG, CSP_LOG_TYPE_MOVIE_LOADER, "Src frame=%dx%d Allocate frame: %dx%d", frame->width, frame->height, dst_width, dst_height);
 
@@ -397,7 +397,7 @@ bool MOVIE_LOADER::open(QString filename)
        // Re-allocate buffer;
        video_mutex->lock();
        ret = av_image_alloc(video_dst_data, video_dst_linesize,
-                             dst_width, dst_height, AV_PIX_FMT_BGRA, 1);
+                             dst_width, dst_height, AV_PIX_FMT_RGBA, 1);
        old_dst_width = dst_width;
        old_dst_height = dst_height;
        video_mutex->unlock();
index 3c89642..194a00b 100644 (file)
@@ -237,7 +237,7 @@ void *MOVIE_SAVER::get_video_frame(void)
                }
                if(ost->tmp_frame != NULL) {
                        av_frame_free(&ost->tmp_frame);
-                       ost->tmp_frame = (AVFrame *)alloc_picture(AV_PIX_FMT_BGRA, _width, _height);
+                       ost->tmp_frame = (AVFrame *)alloc_picture(AV_PIX_FMT_RGBA, _width, _height);
                        if (ost->tmp_frame == NULL) {
                                p_logger->debug_log(CSP_LOG_INFO, CSP_LOG_TYPE_MOVIE_SAVER, "Could not re-allocate video frame\n");
                                return (void *)NULL;
@@ -250,7 +250,7 @@ void *MOVIE_SAVER::get_video_frame(void)
        
        if (!ost->sws_ctx) {
                ost->sws_ctx = sws_getContext(ost->tmp_frame->width, ost->tmp_frame->height,
-                                                                         AV_PIX_FMT_BGRA,
+                                                                         AV_PIX_FMT_RGBA,
                                                                          c->width, c->height,
                                                                          c->pix_fmt,
                                                                          SCALE_FLAGS, NULL, NULL, NULL);
index d46c14d..30527c8 100644 (file)
@@ -15,7 +15,7 @@ set(s_qt_emuutils_srcs
 
 QT5_WRAP_CPP(s_qt_emuutils_headers_MOC ${s_qt_emuutils_headers})
        
-SET(THIS_LIB_VERSION 2.11.8
+SET(THIS_LIB_VERSION 2.12.0
 
 if(WIN32)
 include (GenerateExportHeader)
index c52bf70..3ba73ff 100644 (file)
@@ -1,6 +1,6 @@
 message("* qt/gui")
 
-set(THIS_LIB_VERSION 2.13.3)
+set(THIS_LIB_VERSION 2.14.0)
 #include(cotire)
 #include(PrecompiledHeader)
 
index b1ef35d..7a94fa5 100644 (file)
@@ -1111,7 +1111,7 @@ void GLDraw_2_0::uploadMainTexture(QImage *p, bool use_chromakey)
                extfunc_2->glTexSubImage2D(GL_TEXTURE_2D, 0,
                                                                 0, 0,
                                                                 p->width(), p->height(),
-                                                                GL_BGRA, GL_UNSIGNED_BYTE, p->constBits());
+                                                                GL_RGBA, GL_UNSIGNED_BYTE, p->constBits());
                extfunc_2->glBindTexture(GL_TEXTURE_2D, 0);
        }
        crt_flag = true;
index c20f7c3..521fee8 100644 (file)
@@ -5,12 +5,9 @@ varying vec2 v_texcoord;
 uniform mat2 rotate_mat;
 void main ()
 {
-       vec4 xyzw = vec4(vertex, 1.0);
-       xyzw.xy = rotate_mat * xyzw.xy;
-#if 0
-       xyzw = mat4(0.0, -1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0) * xyzw;
-#endif            
-       gl_Position = xyzw;
+       vec2 xy = vertex.xy;
+       xy = rotate_mat * xy;
+       gl_Position = vec4(xy, vertex.z, 1.0);
     v_texcoord = texcoord;
 }
 
index 26e2070..5b3a0b9 100644 (file)
@@ -2,11 +2,8 @@ attribute vec3 vertex;
 uniform mat2 rotate_mat;
 void main ()
 {
-       vec4 xyzw = vec4(vertex, 1.0);
-       xyzw.xy = rotate_mat * xyzw.xy;
-#if 0
-       xyzw = mat4(0.0, -1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0) * xyzw;
-#endif            
-       gl_Position = xyzw;
+       vec2 xy = vertex.xy;
+       xy = rotate_mat * xy;
+       gl_Position = vec4(xy, vertex.z, 1.0);
 }
 
index 30c5acd..c6d37d3 100644 (file)
@@ -3,11 +3,8 @@ uniform mat2 rotate_mat;
 
 void main ()
 {
-       vec4 xyzw = vec4(vertex, 1.0);
-       xyzw.xy = rotate_mat * xyzw.xy;
-#if 0
-       xyzw = mat4(0.0, -1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0) * xyzw;
-#endif            
-       gl_Position = xyzw;
+       vec2 xy = vertex.xy;
+       xy = rotate_mat * xy;
+       gl_Position = vec4(xy, vertex.z, 1.0);
 }
 
index 759f084..d690345 100644 (file)
@@ -770,7 +770,7 @@ void GLDraw_3_0::uploadMainTexture(QImage *p, bool use_chromakey)
                                                                 //screen_texture_width * 2,
                                                                 //screen_texture_height * 2,
                                                                 p->width(), p->height(),
-                                                                GL_BGRA, GL_UNSIGNED_BYTE, p->constBits());
+                                                                GL_RGBA, GL_UNSIGNED_BYTE, p->constBits());
                extfunc->glBindTexture(GL_TEXTURE_2D, 0);
        }
        if(using_flags->is_support_tv_render() && (p_config->rendering_type == CONFIG_RENDER_TYPE_TV)) {
index 8eb1829..7ad9725 100644 (file)
@@ -10,12 +10,9 @@ varying vec2 v_texcoord;
 uniform mat2 rotate_mat;
 void main ()
 {
-       vec4 xyzw = vec4(vertex, 1.0);
-       xyzw.xy = rotate_mat * xyzw.xy;
-#if 0
-       xyzw = mat4(0.0, -1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0) * xyzw;
-#endif            
-       gl_Position = xyzw;
+       vec2 xy = vertex.xy;
+       xy = rotate_mat * xy;
+       gl_Position = vec4(xy, vertex.z, 1.0);
     v_texcoord = texcoord;
 }
 
index f2dbcbf..001c8d5 100644 (file)
@@ -29,9 +29,9 @@ void main ()
        vec4 pixel;
        
        pixel_r_1 = texture2D(a_texture, v_texcoord);
-#ifdef HOST_ENDIAN_IS_LITTLE
-       pixel_r_1.rgb = pixel_r_1.bgr;
-#endif
+//#ifdef HOST_ENDIAN_IS_LITTLE
+//     pixel_r_1.rgb = pixel_r_1.bgr;
+//#endif
        bvec3 _match;
        _match = equal(pixel_r_1.rgb, chromakey.rgb);
        pixel = (all(_match) == true) ? vec4(0.0, 0.0, 0.0, 0.0) : vec4(pixel_r_1.rgb, 1.0);
index ce1d4a9..b82cc56 100644 (file)
@@ -15,7 +15,11 @@ out vec4 opixel;
 varying mediump vec2 v_texcoord;
 #endif
 
+#if __VERSION__ >= 300
+uniform sampler2D a_texture;
+#else
 uniform sampler2D a_texture;
+#endif
 
 void main ()
 {
@@ -24,9 +28,9 @@ void main ()
 #else
        vec4 pixel = texture2D(a_texture, v_texcoord);
 #endif    
-#ifdef HOST_ENDIAN_IS_LITTLE
-       pixel.rgb = pixel.bgr;
-#endif
+//#ifdef HOST_ENDIAN_IS_LITTLE
+//     pixel.rgb = pixel.bgr;
+//#endif
 #if __VERSION__ >= 300
        opixel = pixel;
 #else
index 89e10d3..ca62ef9 100644 (file)
@@ -5,26 +5,12 @@ attribute mediump vec3 vertex;
 #endif
 
 uniform mat2 rotate_mat;
-//uniform bool rotate;
+
 void main ()
 {
-#if 0
-  if (!(rotate)) {
-    mediump vec4 tmpvar_1;
-    tmpvar_1.w = 1.0;
-    tmpvar_1.xyz = vertex;
-    gl_Position = tmpvar_1;
-  } else {
-    mediump vec4 tmpvar_2;
-    tmpvar_2.w = 1.0;
-    tmpvar_2.xyz = vertex;
-    gl_Position = (mat4(0.0, -1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0) * tmpvar_2);
-  };
-#else
        vec2 xy = vertex.xy;
        xy = rotate_mat * xy;
        
        gl_Position = vec4(xy, vertex.z, 1.0);
-#endif         
 }
 
index 00b1ea3..4b07204 100644 (file)
@@ -27,6 +27,7 @@
 #include <QOpenGLContext>
 #include <QOpenGLFramebufferObject>
 #include <QOpenGLFramebufferObjectFormat>
+#include <QOpenGLPixelTransferOptions>
 
 #include <QMatrix4x2>
 #include <QMatrix4x4>
@@ -66,6 +67,8 @@ GLDraw_ES_2::GLDraw_ES_2(GLDrawClass *parent, USING_FLAGS *p, CSP_Logger *logger
 #else
        swap_byteorder = false;
 #endif
+
+       TextureTransferParam = new QOpenGLPixelTransferOptions();
 }
 
 GLDraw_ES_2::~GLDraw_ES_2()
@@ -95,9 +98,27 @@ GLDraw_ES_2::~GLDraw_ES_2()
        if(grids_horizonal_vertex != NULL) {
                if(grids_vertical_vertex->isCreated()) grids_vertical_vertex->destroy();
        }
-
+       if(TextureTransferParam != NULL) delete TextureTransferParam;
 }
 
+QOpenGLTexture *GLDraw_ES_2::createMainTexture(QImage *img)
+{
+       QOpenGLTexture *tx;
+       if(img == NULL) {
+               QImage nImg(using_flags->get_real_screen_width(), using_flags->get_real_screen_height(), QImage::Format_RGBA8888);
+               tx = new QOpenGLTexture(nImg, QOpenGLTexture::DontGenerateMipMaps);
+               TextureTransferParam->setImageHeight(using_flags->get_real_screen_height());
+               TextureTransferParam->setRowLength(using_flags->get_real_screen_width());
+       } else {
+               tx = new QOpenGLTexture(*img, QOpenGLTexture::DontGenerateMipMaps);
+               TextureTransferParam->setImageHeight(img->height());
+               TextureTransferParam->setRowLength(img->width());
+       }
+       tx->setFormat(QOpenGLTexture::RGBA8_UNorm);
+       tx->setMinMagFilters(QOpenGLTexture::Linear, QOpenGLTexture::Nearest);
+       tx->setWrapMode(QOpenGLTexture::ClampToEdge);
+       return tx;
+}
 void GLDraw_ES_2::initBitmapVertex(void)
 {
        if(using_flags->is_use_one_board_computer()) {
@@ -682,16 +703,12 @@ void GLDraw_ES_2::uploadMainTexture(QImage *p, bool use_chromakey)
        //redraw_required = true;
        imgptr = p;
        if(uVramTextureID == NULL) {
-               uVramTextureID = new QOpenGLTexture(*p, QOpenGLTexture::DontGenerateMipMaps);
-       } else {
+               uVramTextureID = createMainTexture(p);
+       } else  {
                // Upload to main texture
-               extfunc->glBindTexture(GL_TEXTURE_2D, uVramTextureID->textureId());
-               extfunc->glTexSubImage2D(GL_TEXTURE_2D, 0,
-                                                                0, 0, p->width(), p->height(),
-                                                                GL_RGBA, GL_UNSIGNED_BYTE,
-                                                                //GL_BGRA, GL_UNSIGNED_BYTE,
-                                                                p->bits());
-               extfunc->glBindTexture(GL_TEXTURE_2D, 0);
+               TextureTransferParam->setImageHeight(p->height());
+               TextureTransferParam->setRowLength(p->width());
+               uVramTextureID->setData(QOpenGLTexture::RGBA, QOpenGLTexture::UInt8, p->constBits(), TextureTransferParam);
        }
 #if 1
        if(using_flags->is_support_tv_render() && (p_config->rendering_type == CONFIG_RENDER_TYPE_TV)) {
@@ -712,21 +729,7 @@ void GLDraw_ES_2::uploadMainTexture(QImage *p, bool use_chromakey)
        } else
 #endif
        {
-#if 0
-               renderToTmpFrameBuffer_nPass(uVramTextureID->textureId(),
-                                                                        screen_texture_width,
-                                                                        screen_texture_height,
-                                                                        std_pass,
-                                                                        std_pass->getViewportWidth(),
-                                                                        std_pass->getViewportHeight(),
-                                                                        use_chromakey);
-
-               std_pass->bind();
-               uTmpTextureID = std_pass->getTexture();
-               std_pass->release();
-#else
                uTmpTextureID = uVramTextureID->textureId();
-#endif
        }
        crt_flag = true;
 }
@@ -1210,7 +1213,7 @@ void GLDraw_ES_2::setBrightness(GLfloat r, GLfloat g, GLfloat b)
        if(imgptr != NULL) {
                p_wid->makeCurrent();
                if(uVramTextureID == NULL) {
-                       uVramTextureID = new QOpenGLTexture(*imgptr, QOpenGLTexture::DontGenerateMipMaps);
+                       uVramTextureID = createMainTexture(imgptr);
                }
                if(using_flags->is_use_one_board_computer() || (using_flags->get_max_button() > 0)) {
                        uploadMainTexture(imgptr, true);
@@ -1381,12 +1384,6 @@ void GLDraw_ES_2::do_set_texture_size(QImage *p, int w, int h)
 
                p_wid->makeCurrent();
                {
-#if 0
-                       set_texture_vertex((float)w / iw, (float)h / ih);
-                       setNormalVAO(std_pass->getShader(), std_pass->getVAO(),
-                                                std_pass->getVertexBuffer(),
-                                                vertexTmpTexture, 4);
-#endif
                        //set_texture_vertex(p, p_wid->width(), p_wid->height(), w, h);
                        set_texture_vertex((float)w / iw, (float)h / ih);
                        setNormalVAO(ntsc_pass1->getShader(), ntsc_pass1->getVAO(),
@@ -1401,9 +1398,18 @@ void GLDraw_ES_2::do_set_texture_size(QImage *p, int w, int h)
                }
                if(p != NULL) {
                        if(uVramTextureID != NULL) {
-                               delete uVramTextureID;
+                               if(((int)iw != uVramTextureID->width()) || ((int)ih != uVramTextureID->height())) {
+                                       p_wid->makeCurrent();
+                                       uVramTextureID->destroy();
+                                       delete uVramTextureID;
+                                       uVramTextureID = createMainTexture(p);
+                                       p_wid->doneCurrent();
+                               }
+                       } else {
+                               p_wid->makeCurrent();
+                               uVramTextureID = createMainTexture(p);
+                               p_wid->doneCurrent();
                        }
-                       uVramTextureID = new QOpenGLTexture(*p, QOpenGLTexture::DontGenerateMipMaps);
                }
                vertexFormat[0].x = -1.0f;
                vertexFormat[0].y = -1.0f;
index 64a8578..97f3785 100644 (file)
@@ -11,6 +11,7 @@
 #define _QT_COMMON_GLUTIL_ES_2_H
 
 #include <QString>
+
 #include "../gl2/qt_glutil_gl2_0.h"
 
 QT_BEGIN_NAMESPACE
@@ -20,6 +21,7 @@ class QOpenGLFunctions;
 class QOpenGLBuffer;
 class QOpenGLVertexArrayObject;
 class QOpenGLShaderProgram;
+class QOpenGLPixelTransferOptions;
 
 class DLL_PREFIX GLDraw_ES_2 : public GLDraw_2_0
 {
@@ -111,6 +113,7 @@ protected:
 
        GLuint uTmpTextureID;
        bool swap_byteorder;
+       QOpenGLPixelTransferOptions *TextureTransferParam;
        
        virtual void setNormalVAO(QOpenGLShaderProgram *prg, QOpenGLVertexArrayObject *vp,
                                                          QOpenGLBuffer *bp, VertexTexCoord_t *tp, int size = 4);
@@ -165,6 +168,7 @@ protected:
        virtual void set_led_vertex(int bit);
        virtual void set_osd_vertex(int bit);
        virtual void initBitmapVertex(void);
+       virtual QOpenGLTexture *createMainTexture(QImage *img);
 
 public:
        GLDraw_ES_2(GLDrawClass *parent, USING_FLAGS *p, CSP_Logger *logger, EMU *emu = 0);
index 0a6776c..500cd90 100644 (file)
@@ -1,7 +1,9 @@
 #if __VERSION__ >= 300
+//in mediump vec3 vertex;
 in mediump vec3 vertex;
 in mediump vec2 texcoord;
 out mediump vec2 v_texcoord;
+precision  mediump float;
 #else
 attribute mediump vec3 vertex;
 attribute mediump vec2 texcoord;
@@ -10,33 +12,12 @@ varying mediump vec2 v_texcoord;
 
 uniform mat2 rotate_mat;
 uniform bool rotate;
-uniform mediump mat4 v_ortho;
+uniform mediump mat3 v_ortho;
 void main ()
 {
-#if 0
-  if (!(rotate)) {
-    mediump vec4 tmpvar_1;
-    tmpvar_1.w = 1.0;
-    tmpvar_1.xyz = vertex;
-    gl_Position = tmpvar_1 * v_ortho;
+       vec2 xy = vertex.xy;
+       xy = rotate_mat * xy;
+       gl_Position = vec4(xy, vertex.z, 1.0);
     v_texcoord = texcoord;
-  } else {
-    mediump vec4 tmpvar_2;
-    tmpvar_2.w = 1.0;
-    tmpvar_2.xyz = vertex;
-    gl_Position = (mat4(0.0, -1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0) * tmpvar_2 * v_ortho);
-    v_texcoord = texcoord;
-  };
-#else
-       vec4 xyzw = vec4(vertex, 1.0);
-       xyzw.xy = rotate_mat * xyzw.xy;
-       
-#if 0
-       xyzw = mat4(0.0, -1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0) * xyzw;
-#endif            
-       xyzw = xyzw * v_ortho;  
-       gl_Position = xyzw;
-    v_texcoord = texcoord;
-#endif
 }
 
index 4f327f0..a568cbc 100644 (file)
@@ -125,119 +125,6 @@ bool OSD_BASE::connect_capture_dev(int index, bool pin)
                //release_video();
                cur_capture_dev_index = -1;
        }
-#if 0  
-       AM_MEDIA_TYPE mt;
-       ZeroMemory(&mt, sizeof(AM_MEDIA_TYPE));
-       mt.majortype = MEDIATYPE_Video;
-#if defined(_RGB555)
-       mt.subtype = MEDIASUBTYPE_RGB555;
-#elif defined(_RGB565)
-       mt.subtype = MEDIASUBTYPE_RGB565;
-#elif defined(_RGB888)
-       mt.subtype = MEDIASUBTYPE_RGB32;
-#endif
-       mt.formattype = FORMAT_VideoInfo;
-       
-       if(FAILED(CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC, IID_IGraphBuilder, (void **)&pGraphBuilder))) {
-               return false;
-       }
-       
-       ICreateDevEnum *pDevEnum = NULL;
-       IEnumMoniker *pClassEnum = NULL;
-       
-       if(SUCCEEDED(CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC, IID_ICreateDevEnum, (void **)&pDevEnum))) {
-               if(SUCCEEDED(pDevEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory, &pClassEnum, 0)) && pClassEnum != NULL) {
-                       for(int i = 0; i <= index; i++) {
-                               IMoniker *pMoniker = NULL;
-                               ULONG cFetched;
-                               
-                               if(SUCCEEDED(pClassEnum->Next(1, &pMoniker, &cFetched)) && pMoniker != NULL) {
-                                       if(i == index) {
-                                               pMoniker->BindToObject(0, 0, IID_IBaseFilter, (void **)&pCaptureBaseFilter);
-                                       }
-                                       SAFE_RELEASE(pMoniker);
-                               } else {
-                                       break;
-                               }
-                       }
-               }
-       }
-       SAFE_RELEASE(pClassEnum);
-       SAFE_RELEASE(pDevEnum);
-       
-       if(&pCaptureBaseFilter == NULL) {
-               return false;
-       }
-       if(FAILED(pGraphBuilder->AddFilter(pCaptureBaseFilter, L"Video Capture"))) {
-               return false;
-       }
-       if(FAILED(CoCreateInstance(CLSID_CaptureGraphBuilder2, NULL, CLSCTX_INPROC, IID_ICaptureGraphBuilder2, (void **)&pCaptureGraphBuilder2))) {
-               return false;
-       }
-       if(FAILED(pCaptureGraphBuilder2->SetFiltergraph(pGraphBuilder))) {
-               return false;
-       }
-       
-       IAMStreamConfig *pSC = NULL;
-       ISpecifyPropertyPages *pSpec = NULL;
-       
-       if(FAILED(pCaptureGraphBuilder2->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Interleaved, pCaptureBaseFilter, IID_IAMStreamConfig, (void **)&pSC))) {
-               if(FAILED(pCaptureGraphBuilder2->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, pCaptureBaseFilter, IID_IAMStreamConfig, (void **)&pSC))) {
-                       return false;
-               }
-       }
-       if(SUCCEEDED(pSC->QueryInterface(IID_ISpecifyPropertyPages, (void **)&pSpec))) {
-               CAUUID cauuid;
-               pSpec->GetPages(&cauuid);
-               if(pin) {
-                       OleCreatePropertyFrame(NULL, 30, 30, NULL, 1, (IUnknown **)&pSC, cauuid.cElems, (GUID *)cauuid.pElems, 0, 0, NULL);
-                       CoTaskMemFree(cauuid.pElems);
-               }
-               SAFE_RELEASE(pSpec);
-       }
-       SAFE_RELEASE(pSC);
-       
-       if(FAILED(CoCreateInstance(CLSID_SampleGrabber, NULL, CLSCTX_INPROC, IID_IBaseFilter, (void **)&pVideoBaseFilter))) {
-               return false;
-       }
-       if(FAILED(pVideoBaseFilter->QueryInterface(IID_ISampleGrabber, (void **)&pVideoSampleGrabber))) {
-               return false;
-       }
-       if(FAILED(pVideoSampleGrabber->SetMediaType(&mt))) {
-               return false;
-       }
-       if(FAILED(pGraphBuilder->AddFilter(pVideoBaseFilter, L"Video Sample Grabber"))) {
-               return false;
-       }
-       if(FAILED(pGraphBuilder->Connect(get_pin(pCaptureBaseFilter, PINDIR_OUTPUT), get_pin(pVideoBaseFilter, PINDIR_INPUT)))) {
-               return false;
-       }
-       if(FAILED(pVideoSampleGrabber->SetBufferSamples(TRUE))) {
-               return false;
-       }
-       if(FAILED(pVideoSampleGrabber->SetOneShot(FALSE))) {
-               return false;
-       }
-       if(FAILED(pGraphBuilder->QueryInterface(IID_IMediaControl, (void **)&pMediaControl))) {
-               return false;
-       }
-       if(FAILED(pGraphBuilder->QueryInterface(IID_IBasicAudio, (void **)&pBasicAudio))) {
-               //return false;
-       }
-       if(FAILED(pMediaControl->Run())) {
-               return false;
-       }
-       
-       // get the capture size
-       pVideoSampleGrabber->GetConnectedMediaType(&mt);
-       VIDEOINFOHEADER *pVideoHeader = (VIDEOINFOHEADER*)mt.pbFormat;
-       direct_show_width = pVideoHeader->bmiHeader.biWidth;
-       direct_show_height = pVideoHeader->bmiHeader.biHeight;
-       
-       if(dshow_screen_buffer.width != direct_show_width || dshow_screen_buffer.height != direct_show_height) {
-               initialize_screen_buffer(&dshow_screen_buffer, direct_show_width, direct_show_height, COLORONCOLOR);
-       }
-#endif 
        cur_capture_dev_index = index;
        return true;
 }
@@ -257,18 +144,6 @@ void OSD_BASE::close_capture_dev()
 
 void OSD_BASE::show_capture_dev_filter()
 {
-#if 0  
-       if(pCaptureBaseFilter != NULL) {
-               ISpecifyPropertyPages *pSpec = NULL;
-               CAUUID cauuid;
-               if(SUCCEEDED(pCaptureBaseFilter->QueryInterface(IID_ISpecifyPropertyPages, (void **)&pSpec))) {
-                       pSpec->GetPages(&cauuid);
-                       OleCreatePropertyFrame(NULL, 30, 30, NULL, 1, (IUnknown **)&pCaptureBaseFilter, cauuid.cElems, (GUID *)cauuid.pElems, 0, 0, NULL);
-                       CoTaskMemFree(cauuid.pElems);
-                       SAFE_RELEASE(pSpec);
-               }
-       }
-#endif 
 }
 
 void OSD_BASE::show_capture_dev_pin()
index fa4109d..890143a 100644 (file)
@@ -1,6 +1,6 @@
 message("* vm/common_vm")
 
-SET(THIS_LIB_VERSION 1.4.6)
+SET(THIS_LIB_VERSION 1.5.0)
 
 #include(cotire)
 set(s_vm_common_vm_srcs