]> git.sesse.net Git - vlc/blobdiff - modules/video_output/gl.c
flac decoder: supports avformat extradata
[vlc] / modules / video_output / gl.c
index 7997e9fc2140a750ce3c25c485c1ad938e5a6c7b..cf7c624912352452e0aeea0f34036a7c8bbe090e 100644 (file)
@@ -5,20 +5,20 @@
 /*****************************************************************************
  * Copyright © 2010-2011 Rémi Denis-Courmont
  *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1
- * of the License, or (at your option) any later version.
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
  *
- * This library is distributed in the hope that it will be useful,
+ * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- ****************************************************************************/
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
 
 #ifdef HAVE_CONFIG_H
 # include <config.h>
@@ -69,7 +69,7 @@ vlc_module_begin ()
 # define API VLC_OPENGL
 # define MODULE_VARNAME "gl"
     set_shortname (N_("OpenGL"))
-    set_description (N_("Open Graphics Library video output"))
+    set_description (N_("OpenGL video output (experimental)"))
     set_category (CAT_VIDEO)
     set_subcategory (SUBCAT_VIDEO_VOUT)
     set_capability ("vout display", /*170*/0)
@@ -100,7 +100,25 @@ static vout_window_t *MakeWindow (vout_display_t *vd)
     vout_window_cfg_t wnd_cfg;
 
     memset (&wnd_cfg, 0, sizeof (wnd_cfg));
-    wnd_cfg.type = VOUT_WINDOW_TYPE_NATIVE;
+
+    /* Please keep this in sync with egl.c */
+    /* <EGL/eglplatform.h> defines the list and order of platforms */
+#if defined(_WIN32) || defined(__VC32__) \
+ && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
+    wnd_cfg.type = VOUT_WINDOW_TYPE_HWND;
+#elif defined(__WINSCW__) || defined(__SYMBIAN32__)  /* Symbian */
+# warning Symbian not supported.
+#elif defined(WL_EGL_PLATFORM)
+# error Wayland not supported.
+#elif defined(__GBM__)
+# error Glamor not supported.
+#elif defined(ANDROID)
+# error Android not supported.
+#elif defined(__unix__) /* X11 */
+    wnd_cfg.type = VOUT_WINDOW_TYPE_XID;
+#else
+# error Platform not recognized.
+#endif
     wnd_cfg.x = var_InheritInteger (vd, "video-x");
     wnd_cfg.y = var_InheritInteger (vd, "video-y");
     wnd_cfg.width  = vd->cfg->display.width;
@@ -137,13 +155,18 @@ static int Open (vlc_object_t *obj)
         goto error;
 
     /* Initialize video display */
-    sys->vgl = vout_display_opengl_New (&vd->fmt, sys->gl);
+    const vlc_fourcc_t *spu_chromas;
+    sys->vgl = vout_display_opengl_New (&vd->fmt, &spu_chromas, sys->gl);
     if (!sys->vgl)
+    {
+        vlc_gl_ReleaseCurrent (sys->gl);
         goto error;
+    }
 
     vd->sys = sys;
     vd->info.has_pictures_invalid = false;
     vd->info.has_event_thread = false;
+    vd->info.subpicture_chromas = spu_chromas;
     vd->pool = Pool;
     vd->prepare = PictureRender;
     vd->display = PictureDisplay;
@@ -169,6 +192,8 @@ static void Close (vlc_object_t *obj)
     vout_display_sys_t *sys = vd->sys;
 
     vout_display_opengl_Delete (sys->vgl);
+    vlc_gl_ReleaseCurrent (sys->gl);
+
     vlc_gl_Destroy (sys->gl);
     vout_display_DeleteWindow (vd, sys->window);
     free (sys);
@@ -190,8 +215,7 @@ static void PictureRender (vout_display_t *vd, picture_t *pic, subpicture_t *sub
 {
     vout_display_sys_t *sys = vd->sys;
 
-    vout_display_opengl_Prepare (sys->vgl, pic);
-    (void)subpicture;
+    vout_display_opengl_Prepare (sys->vgl, pic, subpicture);
 }
 
 static void PictureDisplay (vout_display_t *vd, picture_t *pic, subpicture_t *subpicture)