Why stream of GStreamer not paused?

Sasha1987 topilski at mail.ru
Wed Apr 24 23:21:16 PDT 2013


Good day i start develop Video player application, my task is playing video
frame by frame(some frames i must to skip) i use GStreamer library and Qt
framework.I created my own pipeline code here:
if(!path.isEmpty())
        {
if (pipeline_)
            {
                destroy_pipe_line();
            }
            //create pipe_line
            pipeline_ = gst_pipeline_new("pipeline");
            if(pipeline_)
            {
                  GstBus *bus = gst_pipeline_get_bus (GST_PIPELINE
(pipeline_));ximagesink
                  //gst_bus_add_watch( bus, pipeline_bus_callback, this );
                 
gst_bus_set_sync_handler(bus,gst_sync_bus_callback,this,NULL);
                  gst_object_unref(bus);
                  GstElement *src = gst_element_factory_make ("filesrc",
"source");
                  if (src)
                  {
                      g_object_set (src, "location",
path.toStdString().c_str(), NULL);
                      audio_queue_ = gst_element_factory_make ("queue",
NULL);
                      video_queue_ = gst_element_factory_make ("queue",
NULL);
                      GstElement *demuxer = gst_element_factory_make
("decodebin", "decoder");
                      GstElement *videosink = gst_element_factory_make
(DEFAULT_VIDEOSINK, "videosink");
                      if(demuxer&&videosink)
                      {
                          gst_bin_add_many (GST_BIN (pipeline_), src,
demuxer, NULL);
                          gst_element_link_many (src, demuxer, NULL);
                          gst_video_overlay_set_window_handle(
GST_VIDEO_OVERLAY(videosink), m_winId );



                      video_bin_ = gst_bin_new ("videobin");
                      if(video_bin_)
                      {
                          GstElement* csp = gst_element_factory_make
("videoconvert", "csp");
                          GstElement *vs =
gst_element_factory_make("videoscale","videoscale");
                          gst_bin_add_many (GST_BIN (video_bin_),
video_queue_, csp,vs,videosink, NULL);
                          gst_element_link_many (video_queue_,csp,vs,
videosink, NULL);
                          GstPad *sink_pad = gst_element_get_static_pad
(video_queue_, "sink");
                          gst_element_add_pad (video_bin_, gst_ghost_pad_new
("sink", sink_pad));
                          gst_object_unref (sink_pad);
                          gst_bin_add (GST_BIN (pipeline_), video_bin_);

                          g_signal_connect (demuxer, "pad-added",
(GCallback) cb_pad_added, this);
                          g_signal_connect (src, "no-more-pads", (GCallback)
cb_no_more_pads, this);

                          // setup audio
                          audio_bin_ = gst_bin_new ("audiobin");
                          if(audio_bin_)
                          {
                              GstElement* audiosink =
gst_element_factory_make (DEFAULT_AUDIOSINK, "sink");
                              GstElement* audioconvert =
gst_element_factory_make ("audioconvert", "aconv");
                              GstElement* d_volume =
gst_element_factory_make ("volume", "volume");
                              gst_bin_add_many (GST_BIN (audio_bin_),
audio_queue_, audioconvert, d_volume, audiosink, NULL);
                              gst_element_link_many(audio_queue_,
audioconvert, d_volume, audiosink, NULL);

                              GstPad *audio_pad = gst_element_get_static_pad
(audio_queue_, "sink");
                              gst_element_add_pad (audio_bin_,
gst_ghost_pad_new ("sink", audio_pad));
                              gst_object_unref (audio_pad);
                              gst_bin_add (GST_BIN (pipeline_), audio_bin_);
                          }

                          set_state(GST_STATE_PAUSED);
                          QEventLoop loop;
                          connect(this, SIGNAL(frame_info_ready()), &loop,
SLOT(quit()));
                          loop.exec();
                      }
                  }
              }
        }
    }

after that i try to pause my video( gst_element_set_state(pipeline_,
GST_STATE_PAUSE)), but video not paused in general. How can i pause my
video? and advance question How can i play my video frame by frame? May be
needed create new file and write date to it, but i don't understand how can
i catch signal of framechanged.



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Why-stream-of-GStreamer-not-paused-tp4659666.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list