rework android-rmt display, add a few buttons
[goodguy/history.git] / cinelerra-5.0 / cinelerra / devicev4l2base.C
index 32772b162a034d29a43a2b7496de9927650fb0c2..baa52f455ae3391b07faeda90bb182e4620e7a4f 100644 (file)
@@ -31,7 +31,6 @@
 #include "mutex.h"
 #include "picture.h"
 #include "preferences.h"
-#include "quicktime.h"
 #include "recordconfig.h"
 #include "videodevice.h"
 
@@ -304,7 +303,7 @@ int DeviceV4L2Base::v4l2_open(int color_model)
        int best_height = config_height;
        unsigned int best_format = 0;
        int best_merit = 0;
-       //int best_color_model = -1;
+       int best_color_model = -1;
        int best_area = 1;
        int driver = video_device->in_config->driver;
 
@@ -322,6 +321,7 @@ int DeviceV4L2Base::v4l2_open(int color_model)
                int cmodel = -1;
                switch(fmt.pixelformat)
                {
+               case V4L2_PIX_FMT_UYVY:    cmodel = BC_UVY422;  merit = 4;  break;
                case V4L2_PIX_FMT_YUYV:    cmodel = BC_YUV422;  merit = 4;  break;
                case V4L2_PIX_FMT_Y41P:    cmodel = BC_YUV411P; merit = 1;  break;
                case V4L2_PIX_FMT_YVU420:  cmodel = BC_YUV420P; merit = 3;  break;
@@ -340,7 +340,7 @@ int DeviceV4L2Base::v4l2_open(int color_model)
                {
                        best_merit = merit;
                        best_format = fmt.pixelformat;
-                       //best_color_model = cmodel;
+                       best_color_model = cmodel;
                }
 
                for( int n=0; n<20; ++n ) {
@@ -379,27 +379,28 @@ int DeviceV4L2Base::v4l2_open(int color_model)
                        best_format = V4L2_PIX_FMT_MPEG;
                        break;
                default:
+                       best_color_model = color_model;
                        best_format = cmodel_to_device(color_model);
                        break;
                }
-               printf("DeviceV4L2Base::v4l2_open "
-                       " attempting format %4.4s\n", (char *)&best_format);
+               printf(_("DeviceV4L2Base::v4l2_open "
+                       " attempting format %4.4s\n"), (char *)&best_format);
        }
        if(driver == VIDEO4LINUX2JPEG && best_format != V4L2_PIX_FMT_MJPEG)
        {
-               printf("DeviceV4L2Base::v4l2_open jpeg driver"
-                       " and best_format not mjpeg (%4.4s)\n", (char *)&best_format);
+               printf(_("DeviceV4L2Base::v4l2_open jpeg driver"
+                       " and best_format not mjpeg (%4.4s)\n"), (char *)&best_format);
                return 1;
        }
        if(driver == VIDEO4LINUX2MPEG && best_format != V4L2_PIX_FMT_MPEG)
        {
-               printf("DeviceV4L2Base::v4l2_open mpeg driver"
-                       " and best_format not mpeg (%4.4s)\n",(char *)&best_format);
+               printf(_("DeviceV4L2Base::v4l2_open mpeg driver"
+                       " and best_format not mpeg (%4.4s)\n"),(char *)&best_format);
                return 1;
        }
        if(config_width != best_width || config_height != best_height)
        {
-               printf("DeviceV4L2Base::v4l2_open  config geom %dx%d != %dx%d best_geom\n",
+               printf(_("DeviceV4L2Base::v4l2_open  config geom %dx%d != %dx%d best_geom\n"),
                        config_width, config_height, best_width, best_height);
        }
 
@@ -549,7 +550,7 @@ int DeviceV4L2Base::v4l2_open(int color_model)
                struct v4l2_tuner tuner;
                memset(&tuner, 0, sizeof(tuner));
                tuner.index = dev_tuner;
-               if(!vioctl(VIDIOC_G_TUNER, &tuner) < 0)
+               if(!vioctl(VIDIOC_G_TUNER, &tuner))
                {
 // printf("DeviceV4L2Base::v4l2_open audmode=%d rxsubchans=%d\n",
 //   tuner.audmode, tuner.rxsubchans);
@@ -588,7 +589,7 @@ int DeviceV4L2Base::v4l2_open(int color_model)
                        perror("DeviceV4L2Base::v4l2_open VIDIOC_S_JPEGCOMP");
        }
 
-       this->color_model = color_model;
+       this->color_model = best_color_model;
        return 0;
 }
 
@@ -739,6 +740,7 @@ unsigned int DeviceV4L2Base::cmodel_to_device(int color_model)
        {
        case BC_COMPRESSED:     return V4L2_PIX_FMT_MJPEG;
        case BC_YUV422:         return V4L2_PIX_FMT_YUYV;
+       case BC_UVY422:         return V4L2_PIX_FMT_UYVY;
        case BC_YUV411P:        return V4L2_PIX_FMT_Y41P;
        case BC_YUV420P:        return V4L2_PIX_FMT_YVU420;
        case BC_YUV422P:        return V4L2_PIX_FMT_YUV422P;