1. <tfoot id='gd642'></tfoot><legend id='gd642'><style id='gd642'><dir id='gd642'><q id='gd642'></q></dir></style></legend>

      <bdo id='gd642'></bdo><ul id='gd642'></ul>
  2. <small id='gd642'></small><noframes id='gd642'>

      <i id='gd642'><tr id='gd642'><dt id='gd642'><q id='gd642'><span id='gd642'><b id='gd642'><form id='gd642'><ins id='gd642'></ins><ul id='gd642'></ul><sub id='gd642'></sub></form><legend id='gd642'></legend><bdo id='gd642'><pre id='gd642'><center id='gd642'></center></pre></bdo></b><th id='gd642'></th></span></q></dt></tr></i><div id='gd642'><tfoot id='gd642'></tfoot><dl id='gd642'><fieldset id='gd642'></fieldset></dl></div>
    1. 使用gstreamer暂停后如何继续播放?

      时间:2023-06-05

      <i id='DKqib'><tr id='DKqib'><dt id='DKqib'><q id='DKqib'><span id='DKqib'><b id='DKqib'><form id='DKqib'><ins id='DKqib'></ins><ul id='DKqib'></ul><sub id='DKqib'></sub></form><legend id='DKqib'></legend><bdo id='DKqib'><pre id='DKqib'><center id='DKqib'></center></pre></bdo></b><th id='DKqib'></th></span></q></dt></tr></i><div id='DKqib'><tfoot id='DKqib'></tfoot><dl id='DKqib'><fieldset id='DKqib'></fieldset></dl></div>

      <small id='DKqib'></small><noframes id='DKqib'>

      • <legend id='DKqib'><style id='DKqib'><dir id='DKqib'><q id='DKqib'></q></dir></style></legend>

          <tfoot id='DKqib'></tfoot>

              • <bdo id='DKqib'></bdo><ul id='DKqib'></ul>
                  <tbody id='DKqib'></tbody>
                本文介绍了使用gstreamer暂停后如何继续播放?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我为每个 Gstreamer 类型编写了 C++ 包装器.它们简单直观,因此我认为不需要在此处发布它们的实现(尽管我可以在需要时发布它们(也许在 github 上)).

                I've written C++ wrapper for each Gstreamer types. They're simple and intuitive, so I don't think their implementation needs to be posted here (though I could post them (maybe at github) if need arises).

                我面临的问题是我开始播放视频(并使用 gst tee 元素同时将其保存到文件中)......在播放时,我暂停(来自不同的线程),效果很好.但是,当我想恢复它时,它不起作用:

                The problem I'm facing is that I start playing a video (and simulteneously saving it to a file using gst tee element)....and while it is playing, I pause (from different thread) which is working great. However, when I want to resume it, it doesn't work:

                void pause()
                {
                    _pipeline.state(GST_STATE_PAUSED)
                }
                
                void resume()
                {
                    _pipeline.state(GST_STATE_PLAYING);
                }
                

                这是我创建管道并将其状态设置为 GST_STATE_PLAYING 的 play() 函数.

                And here is the play() function where I create the pipeline and set it state to GST_STATE_PLAYING.

                int play(std::string const & source_path, std::string const & save_as_file)
                {
                    gst::element source(source_path.substr(0,4) == "http" ? "souphttpsrc" : "filesrc", "media-source");
                    gst::element demuxer("decodebin", "decoder");
                    gst::element vconv("videoconvert",  "vconverter");
                    gst::element vsink("autovideosink", "video-output");
                    gst::element aconv("audioconvert",  "aconverter");
                    gst::element asink("autoaudiosink", "audio-output");
                    gst::element filesink("filesink", "file-sink");
                    gst::element fq("queue", "file-queqe");
                    gst::element tee("tee", "media-tee");
                    gst::element aq("queue", "audio-queue");
                    gst::element vq("queue", "video-queue");
                
                    source.set("location", source_path.c_str());
                
                    gst::bus bus = _pipeline.bus();
                    guint bus_watch_id = _session.add_watch(bus);
                
                
                    _pipeline.add(source, demuxer, vconv, vsink, aconv, asink, filesink, tee,fq, aq, vq);
                
                    gst::element::link(source, tee); 
                
                    gst::element::link(vq, vconv, vsink);
                    gst::element::link(aq, aconv, asink);
                
                    gst::pad tee_src_pad = tee.request_pad("src_%u");
                    gst::pad demuxer_sink_pad = demuxer.static_pad("sink");
                
                    gst::pad::link(tee_src_pad, demuxer_sink_pad);
                
                    filesink.set("location",  save_as_file.c_str());
                
                    gst::element::link(fq, filesink);
                
                    gst::pad tee_src_pad2 = tee.request_pad("src_%u");
                    gst::pad fq_pad = fq.static_pad ("sink");
                    gst::pad::link(tee_src_pad2, fq_pad);
                
                    gst::element::dynamic_link(demuxer, aq);
                    gst::element::dynamic_link(demuxer, vq);
                
                    g_print ("Now playing: %s
                ", source_path.c_str());
                    _pipeline.state(GST_STATE_PLAYING);
                
                    //code
                    _session.run()
                
                    //cleanup
                }
                

                如果有人能帮我找出这个问题的解决方案,我将不胜感激.

                I'd appreciate if anybody could help me figuring out the solution to this problem.

                我正在使用 Qt 小部件的句柄在 Qt 小部件上播放视频并将其传递给 gstreamer 视频叠加层.

                I'm playing the video on Qt widget using its handle and passing it to gstreamer video overlay.

                推荐答案

                您是否在每个从发球台出来的分支上都有队列元素?一个用于文件,一个用于解码?您还可以尝试处理文件接收器上的同步"属性.也许将其设置为 true.

                Do you have queue elements on each branch that comes off the tee? One for the file and one for the decode? You could also try messing around with the "sync" property on the filesink. Maybe set it to true.

                由 Nawaz 编辑.

                因为这个答案首先给了我几个方向,而且几乎是一个非常接近解决方案的方向,所以它值得我为这个问题设置的赏金.但在此之前,这是解决方案(解释在我的回答中 - Nawaz).

                Since this answer first gave me few directions and almost a very-near-to-the-solution direction, it deserves the bounty I've set for this question. But before that, here is the solution (explanation is in my answer - Nawaz).

                gst::element filesink("filesink", "file-sink");
                filesink.set("async", gboolean(FALSE));
                

                希望对其他人也有帮助.

                Hope that helps other as well.

                这篇关于使用gstreamer暂停后如何继续播放?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:从 C++ 中的像素值数组创建视频 下一篇:FFmpeg C++ H264 解码错误

                相关文章

                <i id='wHvxL'><tr id='wHvxL'><dt id='wHvxL'><q id='wHvxL'><span id='wHvxL'><b id='wHvxL'><form id='wHvxL'><ins id='wHvxL'></ins><ul id='wHvxL'></ul><sub id='wHvxL'></sub></form><legend id='wHvxL'></legend><bdo id='wHvxL'><pre id='wHvxL'><center id='wHvxL'></center></pre></bdo></b><th id='wHvxL'></th></span></q></dt></tr></i><div id='wHvxL'><tfoot id='wHvxL'></tfoot><dl id='wHvxL'><fieldset id='wHvxL'></fieldset></dl></div>

              • <legend id='wHvxL'><style id='wHvxL'><dir id='wHvxL'><q id='wHvxL'></q></dir></style></legend>
                1. <tfoot id='wHvxL'></tfoot>
                  • <bdo id='wHvxL'></bdo><ul id='wHvxL'></ul>

                    <small id='wHvxL'></small><noframes id='wHvxL'>