struggling with appsrc and callback

leon dudi.reuveni at comm-it.co.il
Tue Apr 8 07:13:26 PDT 2014


cheers! 

Im using appsrc in my code (visual studio) and I have two pipelines-
transmitter and receiver. 
the transmitter loads file with RTP stream, push the RTP packet into udpsink
with appsrc and udpsink transmit is. 
the transmission works great. 

*pipeline 1* (transmitter): 

   app->src = (GstAppSrc*)gst_element_factory_make("appsrc", "mysrc"); 
   app->sink = gst_element_factory_make ("udpsink", "sink"); 

   g_object_set(G_OBJECT(app->sink),"port",5000,NULL); 
   gst_util_set_object_arg (G_OBJECT (app->src), "stream-type",
"random-access"); 
   

*pipeline 2* (receiver):

    app->pipeline2 = gst_parse_launch( " udpsrc uri=udp://localhost:5000 !
application/x-rtp, media=(string)video, clock-rate=(int)90000,
encoding-name=(string)H264, payload=(int)96 ! rtpjitterbuffer latency=1000
do-lost=TRUE ! decodebin ! autovideosink", NULL); 


*connect to signal:*

 g_signal_connect(app->src, "need-data", G_CALLBACK(start_feed), app);
 g_signal_connect(app->src, "enough-data", G_CALLBACK(stop_feed), app);
 g_signal_connect(app->src, "seek-data", G_CALLBACK (seek_data), app);


 *Start playing:* 
 ret1= gst_element_set_state (app->pipeline2, GST_STATE_PLAYING);
 ret2= gst_element_set_state (app->pipeline1, GST_STATE_PLAYING);






my goal is making fast forward with seek event with:

 1. gst_element_query_position ( app->pipeline1, app->format ,
&(app->position) )
 2. seek_event = gst_event_new_seek (app->rate, GST_FORMAT_BYTES,
GST_SEEK_FLAG_ACCURATE,
		GST_SEEK_TYPE_SET, app->position , GST_SEEK_TYPE_SET, -1)
 3. gst_element_send_event (app->pipeline1, seek_event)



when I press on the keyboard (S key), I change the rate and need to create
seek event:

static gboolean handle_keyboard (GIOChannel *source, GIOCondition cond,
gst_app_t * app) 
{

    if (g_io_channel_read_line (source, &str, NULL, NULL, NULL) !=
G_IO_STATUS_NORMAL)     
          return TRUE;
  

    switch (g_ascii_tolower (str[0])) 
     {

       case: ...

       *case: 's'*
       app->rate *= 2.0;
       /// I don't know what to do from here...
       
       case: ...
     }

}



my question is where should I copy those three commands of seek events?

when I copied it to the implementation of "need-data" callback  and  hit the
's' button, nothing happened 

I also tried to copy those three command to regular function- not callback
and the video stuck when I hit the 's' button.

how should I control the sending of seek event to pipeline 1? where should I
implement the send of seek event? and when the "seek-data" is called?

as you can see Im a little bit confused with that matter
and I will be very happy for some help..

Thanks a lot,
Leon.






--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/struggling-with-appsrc-and-callback-tp4666358.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list