]> git.sesse.net Git - vlc/blobdiff - modules/gui/qnx/vout.c
Used VLC_CODEC_* and vlc_fourcc_GetCodec when suitable.
[vlc] / modules / gui / qnx / vout.c
index 67a410fcd75d40b414c51fc072b0677d10026389..ef775d1c285a8c9792beb78672a3365804994b0c 100644 (file)
  * Preamble
  *****************************************************************************/
 #include <errno.h>                                                 /* ENOMEM */
-#include <stdlib.h>                                                /* free() */
-#include <string.h>                                            /* strerror() */
 
 #include <photon/PtWidget.h>
 #include <photon/PtWindow.h>
 #include <photon/PtLabel.h>
 #include <photon/PdDirect.h>
 
-#include <vlc/vlc.h>
-#include <vlc/intf.h>
-#include <vlc/vout.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include <vlc_interface.h>
+#include <vlc_vout.h>
 
 /*****************************************************************************
  * vout_sys_t: video output QNX method descriptor
@@ -128,7 +130,7 @@ static void SetPalette     ( vout_thread_t *, uint16_t *, uint16_t *, uint16_t *
  * vout properties to choose the window size, and change them according to the
  * actual properties of the display.
  *****************************************************************************/
-int E_(OpenVideo) ( vlc_object_t *p_this )
+int OpenVideo ( vlc_object_t *p_this )
 {
     vout_thread_t * p_vout = (vout_thread_t *)p_this;
 
@@ -142,10 +144,7 @@ int E_(OpenVideo) ( vlc_object_t *p_this )
     /* allocate structure */
     p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
     if( p_vout->p_sys == NULL )
-    {
-        msg_Err( p_vout, "out of memory" );
         return( 1 );
-    }
 
     memset( p_vout->p_sys, 0, sizeof( vout_sys_t ) );
 
@@ -276,7 +275,7 @@ static void QNXEnd( vout_thread_t *p_vout )
  *****************************************************************************
  * Terminate an output method created by QNXCreate
  *****************************************************************************/
-void E_(CloseVideo) ( vlc_object_t *p_this )
+void CloseVideo ( vlc_object_t *p_this )
 {
     vout_thread_t * p_vout = (vout_thread_t *)p_this;
 
@@ -297,9 +296,9 @@ static int QNXManage( vout_thread_t *p_vout )
 {
     int i_ev,  i_buflen;
     PhEvent_t *p_event;
-    vlc_bool_t b_repos = 0;
+    bool b_repos = 0;
 
-    if (p_vout->b_die == 1)
+    if (!vlc_object_alive (p_vout))
     {
         return ( 0 );
     }
@@ -307,10 +306,7 @@ static int QNXManage( vout_thread_t *p_vout )
     /* allocate buffer for event */
     i_buflen = sizeof( PhEvent_t ) * 4;
     if( ( p_event = malloc( i_buflen ) ) == NULL )
-    {
-        msg_Err( p_vout, "out of memory" );
         return( 1 );
-    }
 
     /* event loop */
     do
@@ -320,12 +316,16 @@ static int QNXManage( vout_thread_t *p_vout )
 
         if( i_ev == Ph_RESIZE_MSG )
         {
+            PhEvent_t *buf;
+
             i_buflen = PhGetMsgSize( p_event );
-            if( ( p_event = realloc( p_event, i_buflen ) ) == NULL )
+            buf = realloc( p_event, i_buflen );
+            if( buf == NULL )
             {
-                msg_Err( p_vout, "out of memory" );
+                free( p_event );
                 return( 1 );
             }
+            p_event = buf;
         }
         else if( i_ev == Ph_EVENT_MSG )
         {
@@ -338,7 +338,7 @@ static int QNXManage( vout_thread_t *p_vout )
                 switch( p_ev->event_f )
                 {
                 case Ph_WM_CLOSE:
-                    p_vout->p_libvlc->b_die = 1;
+                    p_vout->p_libvlc->b_die = true;
                     break;
 
                 case Ph_WM_MOVE:
@@ -368,7 +368,7 @@ static int QNXManage( vout_thread_t *p_vout )
                     {
                     case Pk_q:
                     case Pk_Q:
-                        p_vout->p_libvlc->b_die = 1;
+                        p_vout->p_libvlc->b_die = true;
                         break;
 
                     case Pk_f:
@@ -376,12 +376,6 @@ static int QNXManage( vout_thread_t *p_vout )
                         p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
                         break;
 
-                    case Pk_c:
-                    case Pk_C:
-                        p_vout->b_grayscale = ! p_vout->b_grayscale;
-                        p_vout->i_changes |= VOUT_GRAYSCALE_CHANGE;
-                        break;
-
                     default:
                         break;
                     }
@@ -598,13 +592,13 @@ static int QNXInitDisplay( vout_thread_t * p_vout )
     switch( p_vout->p_sys->i_screen_depth )
     {
         case 8:
-            p_vout->output.i_chroma = VLC_FOURCC('R','G','B','2');
+            p_vout->output.i_chroma = VLC_CODEC_RGB8;
             p_vout->p_sys->i_bytes_per_pixel = 1;
             p_vout->output.pf_setpalette = SetPalette;
             break;
 
         case 15:
-            p_vout->output.i_chroma = VLC_FOURCC('R','V','1','5');
+            p_vout->output.i_chroma = VLC_CODEC_RGB15;
             p_vout->p_sys->i_bytes_per_pixel = 2;
             p_vout->output.i_rmask = 0x7c00;
             p_vout->output.i_gmask = 0x03e0;
@@ -612,7 +606,7 @@ static int QNXInitDisplay( vout_thread_t * p_vout )
             break;
 
         case 16:
-            p_vout->output.i_chroma = VLC_FOURCC('R','V','1','6');
+            p_vout->output.i_chroma = VLC_CODEC_RGB16;
             p_vout->p_sys->i_bytes_per_pixel = 2;
             p_vout->output.i_rmask = 0xf800;
             p_vout->output.i_gmask = 0x07e0;
@@ -620,7 +614,7 @@ static int QNXInitDisplay( vout_thread_t * p_vout )
             break;
 
         case 24:
-            p_vout->output.i_chroma = VLC_FOURCC('R','V','2','4');
+            p_vout->output.i_chroma = VLC_CODEC_RGB24;
             p_vout->p_sys->i_bytes_per_pixel = 3;
             p_vout->output.i_rmask = 0xff0000;
             p_vout->output.i_gmask = 0x00ff00;
@@ -629,7 +623,7 @@ static int QNXInitDisplay( vout_thread_t * p_vout )
 
         case 32:
         default:
-            p_vout->output.i_chroma = VLC_FOURCC('R','V','3','2');
+            p_vout->output.i_chroma = VLC_CODEC_RGB32;
             p_vout->p_sys->i_bytes_per_pixel = 4;
             p_vout->output.i_rmask = 0xff0000;
             p_vout->output.i_gmask = 0x00ff00;
@@ -825,7 +819,7 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic, int index )
         switch (p_vout->p_sys->i_vc_format)
         {
             case Pg_VIDEO_FORMAT_YUV420:
-                p_vout->output.i_chroma = VLC_FOURCC('I','4','2','0');
+                p_vout->output.i_chroma = VLC_CODEC_I420;
 
                 p_pic->p_sys->p_buf[U_PLANE] = PdGetOffscreenContextPtr( p_pic->p_sys->p_ctx[U_PLANE] );
                 p_pic->p_sys->p_buf[V_PLANE] = PdGetOffscreenContextPtr( p_pic->p_sys->p_ctx[V_PLANE] );
@@ -862,7 +856,7 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic, int index )
                 break;
 
             case Pg_VIDEO_FORMAT_YV12:
-                p_vout->output.i_chroma = VLC_FOURCC('Y','V','1','2');
+                p_vout->output.i_chroma = VLC_CODEC_YV12;
 
                 p_pic->p_sys->p_buf[U_PLANE] = PdGetOffscreenContextPtr( p_pic->p_sys->p_ctx[U_PLANE] );
                 p_pic->p_sys->p_buf[V_PLANE] = PdGetOffscreenContextPtr( p_pic->p_sys->p_ctx[V_PLANE] );
@@ -902,11 +896,11 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic, int index )
             case Pg_VIDEO_FORMAT_YUY2:
                 if (p_vout->p_sys->i_vc_format == Pg_VIDEO_FORMAT_UYVY)
                 {
-                    p_vout->output.i_chroma = VLC_FOURCC('U','Y','V','Y');
+                    p_vout->output.i_chroma = VLC_CODEC_UYVY;
                 }
                 else
                 {
-                    p_vout->output.i_chroma = VLC_FOURCC('Y','U','Y','2');
+                    p_vout->output.i_chroma = VLC_CODEC_YUYV;
                 }
 
                 p_pic->p->p_pixels = p_pic->p_sys->p_buf[Y_PLANE];
@@ -920,7 +914,7 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic, int index )
                 break;
 
             case Pg_VIDEO_FORMAT_RGB555:
-                p_vout->output.i_chroma = VLC_FOURCC('R','V','1','5');
+                p_vout->output.i_chroma = VLC_CODEC_RGB15;
                 p_vout->output.i_rmask = 0x001f;
                 p_vout->output.i_gmask = 0x03e0;
                 p_vout->output.i_bmask = 0x7c00;
@@ -936,7 +930,7 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic, int index )
                 break;
 
             case Pg_VIDEO_FORMAT_RGB565:
-                p_vout->output.i_chroma = VLC_FOURCC('R','V','1','6');
+                p_vout->output.i_chroma = VLC_CODEC_RGB16;
                 p_vout->output.i_rmask = 0x001f;
                 p_vout->output.i_gmask = 0x07e0;
                 p_vout->output.i_bmask = 0xf800;
@@ -952,7 +946,7 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic, int index )
                 break;
 
             case Pg_VIDEO_FORMAT_RGB8888:
-                p_vout->output.i_chroma = VLC_FOURCC('R','V','3','2');
+                p_vout->output.i_chroma = VLC_CODEC_RGB32;
                 p_vout->output.i_rmask = 0x000000ff;
                 p_vout->output.i_gmask = 0x0000ff00;
                 p_vout->output.i_bmask = 0x00ff0000;
@@ -972,7 +966,7 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic, int index )
     switch( p_vout->output.i_chroma )
     {
 #ifdef MODULE_NAME_IS_xvideo
-        case VLC_FOURCC('Y','2','1','1'):
+        case VLC_CODEC_Y211:
 
             p_pic->p->p_pixels = p_pic->p_sys->p_image->data
                                   + p_pic->p_sys->p_image->offsets[0];