Add the debug-flags property for performance tuning and maker note Signed-off-by...
authorHu Gang <gang.a.hu@intel.com>
Mon, 31 Jan 2011 03:35:55 +0000 (11:35 +0800)
committerHu Gang <gang.a.hu@intel.com>
Thu, 10 Feb 2011 02:13:58 +0000 (10:13 +0800)
gst/mfldv4l2cam/gstv4l2camsrc.c
gst/mfldv4l2cam/gstv4l2camsrc.h

index 086d49e..fb7528c 100644 (file)
@@ -122,6 +122,7 @@ typedef enum
   PROP_CAPTURE_CORRECTION_BRIGHTNESS,
   PROP_DUMP_RAW,
   PROP_DUMP_IMAGE,
+  PROP_DEBUG_FLAGS,
 } GstV4L2CamSrcProperties;
 
 
@@ -132,6 +133,8 @@ typedef enum
 #define DEFAULT_PROP_DEVICE_FD    -1
 #define DEFAULT_PROP_AE_WINDOW  "x_left=0,x_right=0,y_bottom=0,y_top=0"
 #define DEFAULT_PROP_AF_WINDOW  "x_left=0,x_right=0,y_bottom=0,y_top=0"
+#define DEFAULT_DEBUG_FLAGS    0
+#define C_FLAGS(v) ((guint) v)
 
 GType
 gst_camera_input_sensor_get_type (void)
@@ -191,6 +194,25 @@ gst_camera_af_metering_mode_get_type(void)
   return  gst_camera_af_metering_mode_type;
 }
 
+GType
+gst_camerasrc_debug_flags_get_type (void)
+{
+  static GType gst_camerasrc_debug_flags = 0;
+  static const GFlagsValue values [] = {
+    {C_FLAGS (GST_CAMERASRC_DEBUG_FLAGS_PERFORMANCE), "Debug flags for performance tuning",
+      "performance"},
+    {C_FLAGS (GST_CAMERASRC_DEBUG_FLAGS_MAKER_NOTE), "Debug flags for maker note",
+      "maker-note"},
+    {0, NULL, NULL},
+  };
+
+  if (G_UNLIKELY (!gst_camerasrc_debug_flags)) {
+    gst_camerasrc_debug_flags =
+        g_flags_register_static ("GstCameraSrcDebugFlags", values);
+  }
+  return  gst_camerasrc_debug_flags;
+}
+
 
 
 GST_IMPLEMENT_V4L2CAMSRC_VIDORIENT_METHODS (GstMFLDV4l2CamSrc, gst_v4l2camsrc);
@@ -865,10 +887,16 @@ gst_v4l2camsrc_class_init (GstMFLDV4l2CamSrcClass * klass)
 
   g_object_class_install_property (gobject_class, PROP_DUMP_IMAGE,
       g_param_spec_boolean ("dump-image", "Dump images simultanious in pipeline",
-          "Whether dump the  images as output when pipeline, debug only,"
+          "Whether dump the  images as output in pipeline, debug only,"
          "output the image in current directory",
           FALSE, G_PARAM_READWRITE));
 
+  g_object_class_install_property (gobject_class, PROP_DEBUG_FLAGS,
+      g_param_spec_flags ("debug-flags", "debug flags",
+          "debug flags for development and performance tuning usage",
+         GST_TYPE_CAMERASRC_DEBUG_FLAGS, DEFAULT_DEBUG_FLAGS,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
   camera_class->is_open = GST_DEBUG_FUNCPTR (gst_v4l2camsrc_is_open);
   camera_class->open = GST_DEBUG_FUNCPTR (gst_v4l2camsrc_open);
   camera_class->close = GST_DEBUG_FUNCPTR (gst_v4l2camsrc_close);
@@ -1057,6 +1085,7 @@ gst_v4l2camsrc_init (GstMFLDV4l2CamSrc * v4l2camsrc,
   v4l2camsrc->dump_raw = FALSE;
   v4l2camsrc->dump_image = FALSE;
   v4l2camsrc->raw_output_size = 0;
+  v4l2camsrc->debug_flags = DEFAULT_DEBUG_FLAGS;
 
   v4l2camsrc->device_mutex = g_mutex_new ();
 
@@ -1446,6 +1475,9 @@ gst_v4l2camsrc_set_property (GObject * object,
     case PROP_DUMP_IMAGE:
       v4l2camsrc->dump_image = g_value_get_boolean (value);
       break;
+    case PROP_DEBUG_FLAGS:
+      v4l2camsrc->debug_flags = g_value_get_flags (value);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -1610,6 +1642,9 @@ gst_v4l2camsrc_get_property (GObject * object,
     case PROP_DUMP_IMAGE:
       g_value_set_boolean (value, v4l2camsrc->dump_image);
       break;
+    case PROP_DEBUG_FLAGS:
+      g_value_set_flags (value, v4l2camsrc->debug_flags);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
index ae44e8a..55b6574 100644 (file)
@@ -103,6 +103,12 @@ typedef enum {
   GST_CAMERA_AF_METERING_CUSTOMIZED
 } GstCameraAFMeteringMode;
 
+typedef enum {
+  GST_CAMERASRC_DEBUG_FLAGS_PERFORMANCE                = (1 << 0),
+  GST_CAMERASRC_DEBUG_FLAGS_MAKER_NOTE         = (1 << 1)
+} GstCameraSrcDebugFlags;
+#define GST_TYPE_CAMERASRC_DEBUG_FLAGS (gst_camerasrc_debug_flags_get_type())
+GType gst_camerasrc_debug_flags_get_type (void);
 
 /**
  * GstVideoMode:
@@ -267,6 +273,7 @@ struct _GstMFLDV4l2CamSrc {
   GstV4l2MFLDAdvCI *mfldadvci;
   GstCameraInputSensor input_sensor;
   gboolean dump_image;
+  GstCameraSrcDebugFlags debug_flags;
 };