Allow application to set segment time 84/86684/1
authorYounghwan <younghwan_.an@samsung.com>
Fri, 2 Sep 2016 09:03:54 +0000 (18:03 +0900)
committerYounghwan <younghwan_.an@samsung.com>
Fri, 2 Sep 2016 09:25:38 +0000 (18:25 +0900)
Change-Id: I481d79b2f5a9628151dfb6ceb113c68b3d4e4883

libs/gst/base/gstbasesrc.c
libs/gst/base/gstbasesrc.h

index 6ab4816045806e55e97d2ba16823b1fc67e6eef6..5303736dc550af1db28bd029c0a30b8e3ac2d131 100644 (file)
@@ -204,6 +204,9 @@ enum
 #define DEFAULT_NUM_BUFFERS     -1
 #define DEFAULT_TYPEFIND        FALSE
 #define DEFAULT_DO_TIMESTAMP    FALSE
+#ifdef GST_TIZEN_TV
+#define DEFAULT_SEGMENT_TIME   -1
+#endif
 
 enum
 {
@@ -212,6 +215,9 @@ enum
   PROP_NUM_BUFFERS,
   PROP_TYPEFIND,
   PROP_DO_TIMESTAMP
+#ifdef GST_TIZEN_TV
+  ,PROP_UPDATE_SEGMENT
+#endif
 };
 
 #define GST_BASE_SRC_GET_PRIVATE(obj)  \
@@ -395,6 +401,13 @@ gst_base_src_class_init (GstBaseSrcClass * klass)
       g_param_spec_boolean ("do-timestamp", "Do timestamp",
           "Apply current stream time to buffers", DEFAULT_DO_TIMESTAMP,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+#ifdef GST_TIZEN_TV
+  g_object_class_install_property (gobject_class, PROP_UPDATE_SEGMENT,
+      g_param_spec_int64 ("update-segment", "Update Segment",
+          "Timestamp that application want to set (-1 unlimited)",
+         -1, G_MAXINT64, DEFAULT_SEGMENT_TIME,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+#endif
 
   gstelement_class->change_state =
       GST_DEBUG_FUNCPTR (gst_base_src_change_state);
@@ -798,6 +811,31 @@ gst_base_src_set_do_timestamp (GstBaseSrc * src, gboolean timestamp)
   GST_OBJECT_UNLOCK (src);
 }
 
+#ifdef GST_TIZEN_TV
+/**
+*gst_base_src_update_segment:
+*@src: the source
+*@timestamp: timestamp to set
+*/
+void
+gst_base_src_update_segment (GstBaseSrc * src, gint64 timestamp)
+{
+  g_return_if_fail (GST_IS_BASE_SRC (src));
+
+  GST_OBJECT_LOCK (src);
+  if (timestamp != -1) {
+    GST_DEBUG_OBJECT (src,
+        "udpate the segment parameter for es player resume playback,%lld",
+        timestamp);
+    src->segment.start = timestamp;
+    src->segment.time = timestamp;
+    src->segment.position = timestamp;
+  }
+  GST_OBJECT_UNLOCK (src);
+  GST_DEBUG_OBJECT (src, "udpate the segment end");
+}
+#endif
+
 /**
  * gst_base_src_get_do_timestamp:
  * @src: the source
index 4ddfda9052d4cb5c1cbb25d7ae62168c3dc3ee96..f5ecb09aae1b546a881b7425981bb630fbca0f0f 100644 (file)
@@ -271,6 +271,9 @@ void            gst_base_src_get_allocator    (GstBaseSrc *src,
                                                GstAllocator **allocator,
                                                GstAllocationParams *params);
 
+#ifdef GST_TIZEN_TV
+void           gst_base_src_update_segment (GstBaseSrc * src, gint64 timestamp);
+#endif
 
 G_END_DECLS