How to close the current file in GstPlay?

In my application based on gstreamer-rs I used to load media files into an instance of GstPlay by calling GstPlay::set_uri(Some("file://...")) when opening a file. When playback is complete (not necessarily when the file has ended) the application calls GstPlay::set_uri(None) to close the loaded file.

With the pre-release of GStreamer v1.24 I noticed the following warning message in the log output:

WARNING: 11:47:04.355: cannot set NULL uri

If usage pattern is deprecated in v1.24, what would be the proper alternative to close the currently loaded media in GstPlay without immediately loading a new file?

That should be handled within libgstplay imho. Stoping the player is another option.

1 Like

Can you create an issue in GitLab about the NULL URI problem? That needs fixing.

For your actual problem, you probably just want to call stop() on the player instead.

From the change in commit 6bffbe283ad it seems the warning was added on purpose?

I can switch to just calling stop() but if I understand the docs correctly the player might still keep a handle on the input file in this state? Have not verified that, though.

Yes, but nobody updated GstPlay to know about this. That needs fixing.

It sets the playbin to READY state, which removes the source element in urisourcebin. The input file won’t be open anymore unless there’s a bug and something is leaking it :slight_smile:

1 Like
1 Like

Ok, thanks for explaining. Will create a ticket for GstPlay in GitLab then.

I see you have been faster in creating a ticket :).