After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 777662 - GstStream: Stream type/flags setters seem like a bad idea
GstStream: Stream type/flags setters seem like a bad idea
Status: RESOLVED NOTABUG
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-01-23 19:23 UTC by Sebastian Dröge (slomo)
Modified: 2017-02-08 17:59 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Sebastian Dröge (slomo) 2017-01-23 19:23:39 UTC
Currently there are setters for caps and tags, which makes sense, and for stream type and flags. The latter don't seem like a good idea to me. Whenever that part of a stream changes, it would seem like a change to a completely different stream (i.e. new GstStream, stream collection, etc).

Is there any use case where changing the type/flags could make change, or should we deprecate those setters?
Comment 1 Tim-Philipp Müller 2017-01-23 19:54:48 UTC
I remember I raised these explicitly at the time as well, and there was some reasonable explanation/use case for it. I think basically a demuxer might create a stream object but fill in type etc. at a later time, but still before it gets announced. Maybe there should be some kind of sealing.
Comment 2 Edward Hervey 2017-01-30 10:07:01 UTC
Yes, it's indeed to avoid storing information in multiple places and use the GstStream object to store all stream-related information in the creator *before* the stream object is sent.

A simple solution to this would be to make it writable only if the refcount is one (i.e. by the sole owner). An alternative would be to make it copy-on-write (i.e. if the refcount is greater than one a copy is returned).
Comment 3 Sebastian Dröge (slomo) 2017-01-30 10:14:52 UTC
(In reply to Edward Hervey from comment #2)
> Yes, it's indeed to avoid storing information in multiple places and use the
> GstStream object to store all stream-related information in the creator
> *before* the stream object is sent.
> 
> A simple solution to this would be to make it writable only if the refcount
> is one (i.e. by the sole owner). An alternative would be to make it
> copy-on-write (i.e. if the refcount is greater than one a copy is returned).

That's not so simple, because bindings :)

If the intention is to make it write-only after sending, just make it "seal'able" via a flag or boolean.
Comment 4 Sebastian Dröge (slomo) 2017-02-08 17:59:40 UTC
The use case for these is e.g. a filesrc that creates the stream but does not know anything about it yet, but later elements might add/specialize things.