Switch from dual to single: Pipeline continues from the same instant at which switchi...
authorMrinmayee Hingolikar <mrinmayee@ti.com>
Sat, 12 Jan 2013 11:32:41 +0000 (17:02 +0530)
committerMrinmayee <mrinmayee@ubuntu.(none)>
Sat, 12 Jan 2013 11:32:41 +0000 (17:02 +0530)
src/gst-controller.c

index 90e4dcec81056551749d6f86424e331127b3f158..d6016e927b830760a9d474c4aec780b52635b9c3 100644 (file)
@@ -340,12 +340,17 @@ gboolean DualDecode_singleToDual (Pipeline **pipes,GstElement * otherWindowSink,
     GstElement *otherbin  = NULL;
     GstElement *fsink     = NULL;
     GstElement *queue0    = NULL;                                                  
-    GstElement *queue1    = NULL;                                                  
-    GstState state0       = GST_STATE_NULL; 
-   
+    GstElement *queue1    = NULL;                                                 
+    GstState state0       = GST_STATE_NULL;
+    GstFormat format = GST_FORMAT_TIME; 
+    gint64 position       = 0; 
+    
     gst_element_get_state (pipes[thisWindow]->pipe, &state0, NULL,                                                        
                            GST_CLOCK_TIME_NONE);  
 
+    
+    
     /*Remove  otherWindowsink from this pipeline*/
     g_object_get (G_OBJECT (pipes[thisWindow]->pipe),"video-sink", &thisbin,NULL);
     queue1 = gst_bin_get_by_name (GST_BIN (thisbin), "q1");                   
@@ -366,12 +371,16 @@ gboolean DualDecode_singleToDual (Pipeline **pipes,GstElement * otherWindowSink,
     gst_element_sync_state_with_parent (fsink);                          
     gst_element_link (queue1, fsink);                                    
     
+    
+    /* Get position of the media */
+    gst_element_query_position (otherWindowSink, &format, &position);    
+    
     /* Add otherWindowSink to other pipeline */                                                                            
     gst_element_set_state (otherWindowSink, GST_STATE_READY);
     gst_bin_add (GST_BIN (otherbin), otherWindowSink);        
     gst_element_link (queue0, otherWindowSink);           
                                                                                 
-    DualDecode_playMedia (pipes[otherWindow], filename, 0);
+    DualDecode_playMedia (pipes[otherWindow], filename, position);
     gst_element_set_state (pipes[thisWindow]->pipe, state0); 
 
     return ret;