How hard can it be to change filesrc location runtime

marc lievens mark.lievens at gmail.com
Wed Aug 11 06:24:45 UTC 2021


Hi,

Currently I'm getting next errors:

[image: Capture.JPG]

I have a blocking probe in filesrc and send a message and when
received next implementations.
Also the teh comment code was verified

       if (gst_message_has_name(message, "ChangePipeline"))

        {

            GstElement* fileOld = scaler->filesrc_;



            gst_element_set_state(scaler->pipeline_, GST_STATE_READY);



            GstState current_state, pending_state;

            const auto result = gst_element_get_state(scaler->pipeline_,
&current_state, &pending_state, GST_CLOCK_TIME_NONE);



            //gst_element_unlink(scaler->filesrc_, scaler->demuxer_);



            //gst_element_set_state(scaler->demuxer_, GST_STATE_NULL);

            gst_element_set_state(scaler->filesrc_, GST_STATE_NULL);



            //gst_bin_remove(GST_BIN(scaler->pipeline_), scaler->demuxer_);

            gst_bin_remove(GST_BIN(scaler->pipeline_), scaler->filesrc_);



            scaler->filesrc_  = gst_element_factory_make("filesrc",
"filesrc");

            //scaler->demuxer_ = gst_element_factory_make("decodebin",
"demuxer");



            g_object_set(scaler->filesrc_, "location", "h:/2-ml.mp4", NULL);



            //g_signal_connect(G_OBJECT(scaler->pipeline_), "pad-added",
G_CALLBACK(on_pad_added), p_data);



            //gst_bin_add(GST_BIN(scaler->pipeline_), scaler->demuxer_);

            gst_bin_add(GST_BIN(scaler->pipeline_), scaler->filesrc_);



            //gst_element_link(scaler->demuxer_, scaler->outputsink_);

            gst_element_link(scaler->filesrc_, scaler->demuxer_);



            //gst_element_sync_state_with_parent(scaler->demuxer_);

            gst_element_sync_state_with_parent(scaler->filesrc_);



            gst_element_set_state(scaler->pipeline_, GST_STATE_PLAYING);



            GstPad* blockpad = gst_element_get_static_pad(fileOld, "src");

            gst_pad_remove_probe(blockpad, scaler->idProbe_);



        }

Op wo 11 aug. 2021 om 04:28 schreef marc lievens <mark.lievens at gmail.com>:

> Hi
> I already tried this with posting a message and change the pipeline status
> to ready and unlinking/linking the decodebin and change of file location
> and set back status of pipeline to playing.
> I also tried this with unlinking/lining the filesrc with/without previous
> one.
>
> Thx ,
> marc
>
> Op di 10 aug. 2021 om 14:45 schreef Thornton, Keith via gstreamer-devel <
> gstreamer-devel at lists.freedesktop.org>:
>
>> Hi,
>>
>> Probes are called from the streaming thread and in this thread you can’t
>> change the state of the pipeline. Can you not change the state to READY
>> from a different thread, change the location and then change the state to
>> PLAYING.
>>
>> Gruesse
>>
>>
>>
>> *Von:* gstreamer-devel <gstreamer-devel-bounces at lists.freedesktop.org> *Im
>> Auftrag von *marc lievens via gstreamer-devel
>> *Gesendet:* Dienstag, 10. August 2021 12:14
>> *An:* gstreamer-devel at lists.freedesktop.org
>> *Cc:* marc lievens <marc.lievens1210 at telenet.be>
>> *Betreff:* How hard can it be to change filesrc location runtime
>>
>>
>>
>> Hi,
>>
>>
>>
>> I seems to overlook something when I change the element filesrc location
>> at runtime.
>>
>>
>>
>> I tried already to change the location already in different ways and dis
>> read the documentation concerning dynamic pipelines
>>
>>
>>
>> At this moment I simplified the pipeline to :  filesrc | decodebin|
>> autovideosink, but still I seems to do something wrong.
>>
>>
>>
>> What I already tried is :
>>
>>
>>
>>    - In blocking probe on file source  I changed location with/without
>>    filesrc state changes(GST_STATE_NULL and sync with parent )  and pipeline
>>    changes ( GST_STATE_READY and GST_STATE_PLAY)
>>    - With 2 probes and send eos as explained  in dynamic pipeline
>>    documentation , and this with creating new filesrc and/or decodebin.
>>    - With posting a message and  change file location when message
>>    received to avoid deadlocks
>>
>>
>>
>> I  really have no idea what I’m doing wrong or if it is even possible.
>>
>>
>>
>> I would appreciate if anyone can point me in the right direction or
>> explains me the sequence of actions to take
>>
>>
>>
>> Cheers ,
>>
>> marc
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20210811/eb91da5a/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Capture.JPG
Type: image/jpeg
Size: 67673 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20210811/eb91da5a/attachment-0001.jpe>


More information about the gstreamer-devel mailing list