[gst-devel] Re: [gst-cvs] rbultje gst-plugins: gst-plugins/ gst-plugins/sys/oss/

Benjamin Otte in7y118 at public.uni-hamburg.de
Mon Oct 25 06:22:02 CEST 2004

On Sun, 24 Oct 2004, Ronald S. Bultje wrote:

> For those who don't know, short expl.: GST_BUFFER_OFFSET_END() indicates
> the offset of the end of the buffer (so begin + size), but nothing
> specifies the format. The patch from some time ago converts this into
> samples for osssrc (see below), whereas it used to be in bytes before
> that. Both would be equally correct and incorrect. The breakage is that
> they used osssrc->curoffset for this, which is specified to be in bytes.
> they moved it to be in samples without converting the rest of the code
> to it, breaking the clock provided by osssrc, breaking osssrc querying
> and breaking timestamps in osssrc. Those aren't noticeable in gst-launch
> pipelines, but they are noticeable in larger applications that use this
> (e.g. gst-rec. ;-) ).
The current conversion and offset stuff is horribly broken. Some reasons:
1) Noone knows what values the offset (and offset_end) field expects for
various different mime types. Bytes? Frames? Something else? What is a
"frame" in the current context?
2) Some pads have conversion routines when other pads don't. What's worse:
Sometimes they even have different conversion routines.
3) Luckily you can invent your own formats, send them down the pipeline
and confuse various elements even more.
4) Some elements set offset values, some elements don't. If you have a
plugin that relies on correct offset values, you're code is gonna end up
in so much if (IS_VALID (something)) that it's not even readable anymore.
And luckily many plugins just take the value, if it's invalid or not.

So what solutions do I have in mind for that?

1) conversion code belongs to caps.
typedef gboolean (* ConversionFunc) (GstCaps *fixed_caps, GstFormat in,
gint64 in_val, GstFormat out, gint64 *out_val);
gst_caps_set_conversion_func (mimetype, ConversionFunc);
Those two should do it. As a bonus you could attach the current func to
the pads on negotiation and be done with it.

2) There are _defined_ offsets to every caps. Timestamp is
always GST_FORMAT_TIME, offset is defined per format.

3) availability of timestamp, duration, offset and offset_end is defined
in { NOT_AVAILABLE, OPTIONAL, AVAILABLE } per caps. If it is defined as
AVAILABLE, every element MUST provide it.

4) all of this info is registered with its caps or mime type and queryable
via code and gst-inspect --mime complete with descriptions (not sure if
they should be translated). There exists an element that can use these
informations to check that buffers are conforming.

Yay, someone wants to code this?
Or object to my ideas?


More information about the gstreamer-devel mailing list