second pad on request.
authorMarko Ollonen <marko.ollonen@ixonos.com>
Sun, 7 Apr 2013 11:19:37 +0000 (14:19 +0300)
committerMarko Ollonen <marko.ollonen@ixonos.com>
Mon, 8 Apr 2013 05:43:32 +0000 (08:43 +0300)
Change-Id: Ie8fee6542b1a06bceef3b138b2f0f47fa1abd229

gst-libs/gst/camera/gstmfldcamerasrc.c
gst/mfldv4l2cam/gstv4l2camsrc.c
packaging/gst-plugins-atomisp.changes

index 7215d18..241338f 100644 (file)
@@ -873,8 +873,6 @@ gst_camerasrc_class_init (GstCameraSrcClass * klass)
 static void
 gst_camerasrc_init (GstCameraSrc * camerasrc, GstCameraSrcClass * klass)
 {
-  GstPad *second_pad;
-  GstPadTemplate *pad_template;
 
   /* number of buffers requested */
   camerasrc->always_copy = DEFAULT_PROP_ALWAYS_COPY;
@@ -924,23 +922,6 @@ gst_camerasrc_init (GstCameraSrc * camerasrc, GstCameraSrcClass * klass)
   camerasrc->maker_note = FALSE;
 
   /* second pad init */
-  pad_template =
-    gst_element_class_get_pad_template (GST_ELEMENT_CLASS (klass), "second");
-  second_pad = gst_pad_new_from_template (pad_template, "second");
-  gst_pad_set_activatepush_function (second_pad, gst_camerasrc_second_pad_activate_push);
-  gst_pad_set_activatepull_function (second_pad, gst_camerasrc_second_pad_activate_pull);
-  //gst_pad_set_event_function (second_pad, gst_camerasrc_second_pad_event_handler);
-  //gst_pad_set_query_function (second_pad, gst_camerasrc_second_pad_query);
-  gst_pad_set_checkgetrange_function (second_pad, gst_camerasrc_second_pad_check_get_range);
-  //gst_pad_set_getrange_function (second_pad, gst_camerasrc_second_pad_get_range);
-  gst_pad_set_getcaps_function (second_pad, gst_camerasrc_second_pad_getcaps);
-  gst_pad_set_setcaps_function (second_pad, gst_camerasrc_second_pad_setcaps);
-  gst_pad_set_fixatecaps_function (second_pad, gst_camerasrc_second_pad_fixate);
-  //gst_pad_set_link_function (second_pad, gst_camerasrc_second_pad_link);
-
-  GST_CAMERA_SRC_SECOND_PAD(camerasrc) = second_pad;
-  gst_element_add_pad(GST_ELEMENT(camerasrc), second_pad);
-
   camerasrc->second_w = 0;
   camerasrc->second_h = 0;
   camerasrc->second_fps_n = 0;
@@ -956,6 +937,50 @@ gst_camerasrc_init (GstCameraSrc * camerasrc, GstCameraSrcClass * klass)
   camerasrc->second_eos_sent = FALSE;
 }
 
+GstPad *
+gst_request_second_pad (GstElement     *element,
+                        GstPadTemplate *templ,
+                        const gchar    *name,
+                        const GstCaps  *caps)
+{
+
+  GstPad *second_pad;
+  GstCameraSrc *camerasrc = GST_CAMERA_SRC_CAST (element);
+
+  GST_DEBUG("second pad request \n");
+  second_pad = gst_pad_new_from_template (templ, name);
+
+  gst_pad_set_activatepush_function (second_pad, gst_camerasrc_second_pad_activate_push);
+  gst_pad_set_activatepull_function (second_pad, gst_camerasrc_second_pad_activate_pull);
+  //gst_pad_set_event_function (second_pad, gst_camerasrc_second_pad_event_handler);
+  //gst_pad_set_query_function (second_pad, gst_camerasrc_second_pad_query);
+  gst_pad_set_checkgetrange_function (second_pad, gst_camerasrc_second_pad_check_get_range);
+  //gst_pad_set_getrange_function (second_pad, gst_camerasrc_second_pad_get_range);
+  gst_pad_set_getcaps_function (second_pad, gst_camerasrc_second_pad_getcaps);
+  gst_pad_set_setcaps_function (second_pad, gst_camerasrc_second_pad_setcaps);
+  gst_pad_set_fixatecaps_function (second_pad, gst_camerasrc_second_pad_fixate);
+  //gst_pad_set_link_function (second_pad, gst_camerasrc_second_pad_link);
+
+
+  gst_element_add_pad (element, second_pad);
+  GST_DEBUG("second pad init \n");
+  GST_CAMERA_SRC_SECOND_PAD(camerasrc) = second_pad;
+
+
+  return second_pad;
+}
+
+void
+gst_release_second_pad (GstElement *element,
+                           GstPad *pad)
+{
+
+  gst_element_remove_pad (element, pad);
+  //GST_CAMERA_SRC_SECOND_PAD(camerasrc) = NULL;
+
+}
+
+
 /*
  */
 static void
index 9ecff13..b71399b 100644 (file)
 GST_DEBUG_CATEGORY (gst_v4l2camsrc_debug);
 #define GST_CAT_DEFAULT gst_v4l2camsrc_debug
 
+
+
+GstPad gst_request_second_pad (GstElement     *element,
+                               GstPadTemplate *templ,
+                               const gchar    *name,
+                               const GstCaps  *caps);
+
+void gst_release_second_pad (GstElement *element, GstPad *pad);
+
+
 static gboolean gst_v4l2camsrc_is_open (GstCameraSrc * camsrc);
 static void gst_v4l2camsrc_finalize (GObject * object);
 static void gst_v4l2camsrc_dispose (GObject * object);
@@ -90,6 +100,9 @@ static gboolean gst_v4l2camsrc_makernote_deal(GstCameraSrc * camsrc,
 static gboolean gst_v4l2camsrc_makernote_uninit(GstCameraSrc * camsrc,
                                                         int handle);
 
+
+
+
 typedef enum
 {
   PROP_0,
@@ -131,10 +144,10 @@ typedef enum
   PROP_SECOND_QUEUE_SIZE,
 } GstV4L2CamSrcProperties;
 
-#define GST_V4L2_CAMSRC_PAD_TEMPLATE(padname)    \
+#define GST_V4L2_CAMSRC_PAD_TEMPLATE(padname,present)    \
   GST_STATIC_PAD_TEMPLATE (padname,              \
   GST_PAD_SRC,                                   \
-  GST_PAD_ALWAYS,                                \
+  present,                                \
   GST_STATIC_CAPS ("video/x-raw-yuv, "           \
     "format = (fourcc) NV12, "                   \
     "framerate = (fraction) [ 0, 200 ], "        \
@@ -157,10 +170,10 @@ typedef enum
     "framerate = (fraction) [ 0, MAX ]"))
 
 static GstStaticPadTemplate gst_v4l2camsrc_src_template =
-    GST_V4L2_CAMSRC_PAD_TEMPLATE("src");
+    GST_V4L2_CAMSRC_PAD_TEMPLATE("src",GST_PAD_ALWAYS);
 
 static GstStaticPadTemplate gst_v4l2camsrc_second_template =
-    GST_V4L2_CAMSRC_PAD_TEMPLATE("second");
+    GST_V4L2_CAMSRC_PAD_TEMPLATE("second", GST_PAD_REQUEST);
 
 #define DEFAULT_PROP_DEVICE_NAME  NULL
 #define DEFAULT_PROP_DEVICE       "/dev/video0"
@@ -724,6 +737,9 @@ gst_v4l2camsrc_base_init (gpointer klass)
        gst_static_pad_template_get (&gst_v4l2camsrc_src_template));
   gst_element_class_add_pad_template (element_class,
        gst_static_pad_template_get (&gst_v4l2camsrc_second_template));
+
+  element_class->request_new_pad = gst_request_second_pad;
+  element_class->release_pad = gst_release_second_pad;
 }
 
 gboolean gst_v4l2camsrc_set_autofocus (GstCameraSrc * camsrc, gboolean on);
index 9d4373a..b96c27c 100644 (file)
@@ -1,3 +1,6 @@
+* Mon Apr 08 2013 Marko Ollonen <marko.ollonen@ixonos.com> accepted/tizen_2.0/20130307.195130@de1d55e
+- second pad on request.
+
 * Sun Apr 07 2013 Marko Ollonen <marko.ollonen@ixonos.com> accepted/tizen_2.0/20130307.195130@64cd4fb
 - [Author: Yuan, Feng] second stream: add property second-queue-size,TZSP-5411.
 - [Author: Yuan, Feng] dual-stream: handle all eos events,TZSP-5411.