Commit graph

247 commits

Author SHA1 Message Date
Sebastian Dröge beb24d05af utils: Simplify fractions before doing calculations that could cause overflows
... to prevent some unnecessary overflows from happenening.
2010-05-13 08:21:37 +02:00
Sebastian Dröge ee21479eab utils: GCD is 0 if both parameters are 0, don't divide by zero
And turn overflow checks from assertions into simple checks to
return FALSE.
2010-05-13 08:01:14 +02:00
Sebastian Dröge 2c5d3d1761 utils: Simplify result of gst_fraction_multiply() 2010-05-13 08:01:14 +02:00
Wim Taymans 72c512a87d utils: use reffed _get_caps() version
We don't need to have a writable copy so we can use the _reffed
version instead.
2010-05-04 11:44:27 +02:00
Sebastian Dröge fbbb671e54 utils: Handle iterator resyncs in gst_pad_proxy_setcaps()
Fixes bug #612881.
2010-03-15 14:52:40 +01:00
Edward Hervey d60a3b8a59 gstreamer: remove unneeded casts
G_PARAM_SPEC_VALUE_TYPE does an expensive type check, whereas the
value_type field is a public field, so we can just use it directly.
2010-03-11 11:46:28 +01:00
Benjamin Otte 7e7f51f617 Fixes for -Wmissing-declarations -Wmissing-prototypes
Also adds those flags to the configure warning flags

https://bugzilla.gnome.org/show_bug.cgi?id=611692
2010-03-11 10:59:57 +01:00
Jeremy Huddleston fa0d218e4c utils: Use mulq instead of mul as some assemblers can't guess the size of the operands
Fixes bug #612370.
2010-03-10 07:17:07 +00:00
Stefan Kost 3c09381cef utils: defer getting the classes until we actualy need them
This function has a lot of early returns. Give them soem more benefit.
2010-01-10 21:49:25 +02:00
Stefan Kost 5fa9d942e3 utils: avoid extra hop in gst_element_link
No need to call gst_element_link_pads_filtered with filter=NULL, which would
call gst_element_link_pads() in that way. Call it directly to save a call and
expensive gobject type checks.
2010-01-10 21:44:34 +02:00
Sebastian Dröge 1c66f306d6 utils: Fix proxy_setcaps to only iterate pads of other direction 2009-12-08 16:40:57 +01:00
Wim Taymans c6f2a94777 utils: fix proxy_getcaps
Make it return the padtemplate caps on errors and no parent.
Only intersect pads of the oposite direction of the source pad.
2009-12-08 16:30:51 +01:00
Sebastian Dröge 6bff920ba0 utils: Rename proxy iterator fold functions to have a more meaningful name 2009-12-08 16:24:20 +01:00
Sebastian Dröge d6492c2958 utils: If one intersection gave empty caps don't continue iterating over the other pads 2009-12-08 16:09:02 +01:00
Stefan Kost f43f2bf960 docs: fix more bogus xrefs 2009-11-27 14:18:38 +02:00
Stefan Kost 23da3639f0 docs: fix xrefs in docs
Fix typos in xrefs, links to non existing functions and rework plural forms.
2009-11-25 16:59:50 +02:00
Stefan Kost 7ff832d36e docs: fix gtk-doc syntax for doc-blob start 2009-11-25 14:18:14 +02:00
Sebastian Dröge 0ed24bc50e utils: API: Add multiplication and addition functions for fractions
gst_util_fraction_add()
gst_util_fraction_multiply()

These work on plain integers instead of GValues to
keep the overhead as low as possible.
2009-11-16 09:56:32 +01:00
Sebastian Dröge e4257e8d5f gstutils: API: Add fraction helper functions
gst_util_greatest_common_divisor()
gst_util_double_to_fraction()
gst_util_fraction_to_double()

Using these instead of going over GValue has much lower overhead.

Also add float<->fraction transform functions for GValue.
2009-11-16 09:56:32 +01:00
Stefan Kost 4d17d331bf whitespace: remove blanks in doc-comment 2009-11-12 17:02:40 +02:00
Stefan Kost f63ecd04a8 pad: rename new api from _refed to _reffed.
Due to popular demand rename the new api as we still can.
API: gst_pad_get_caps_reffed(), gst_pad_peer_get_caps_reffed()
2009-11-05 12:54:32 +02:00
Stefan Kost fcc5d783df pad: add variants of gst_pad_get_caps() that don't copy caps. Fixes #590941
In most places in core and baseclasses we just need the caps to do caps-
intersections. In that case ref'ed caps are enough (no need to copy).
This patch also switches the code to use the new functions.
API: gst_pad_get_caps_refed(), gst_pad_peer_get_caps_refed()
2009-10-07 22:41:30 +03:00
Stefan Kost 201cbbdce0 pad: flip the G_UNLIKELY
Its likely that we have caps and unlikely (error) otherwise.
2009-10-07 11:12:57 +03:00
Stefan Kost 82526701f0 pad: don't intersect with any in proxy_pad_get_caps
We initialize the caps with any and if a pad has NULL caps, just skip it instead
of intersecting with any. Also add branch prediction here.
2009-10-07 10:59:54 +03:00
Stefan Kost b1f88b3f1f docs: rename aggregator to adder in the docs. 2009-10-07 10:59:54 +03:00
Johan Bilien 920e9b569d introspection: Add annotations for gst_element_query_{duration,position}
Fixes bug #595511.
2009-10-07 07:18:04 +02:00
Sebastian Dröge c4f76d5d22 utils: Add a comment to the scaling functions to explain why the rounding is correct 2009-09-09 18:38:29 +02:00
Sebastian Dröge 8d1aeeb2af utils: Use gcc's __uint128_t for 64bit unsigned integer scaling
This is available in newer gcc releases and it should only exist
on platforms that provide some native 128bit integer arithmetic
instructions.

The x86-64 assembly for this is still kept for non-gcc compilers
that don't provide __uint128_t magic.
2009-09-09 14:59:39 +02:00
Wim Taymans b0c1ebbd08 utils: use 128bits division on x86_64 2009-08-31 11:45:17 +02:00
Wim Taymans 378b1e30e7 utils: use shift instead of division
We can use a shift for scaling the denominator instead of a divide since the
denom is always positive. This avoids having the compiler generate code for the
different rounding rules when scaling negative values.
2009-08-28 15:32:26 +02:00
Wim Taymans 6cf8948663 utils: make inlining explicit 2009-08-28 13:45:38 +02:00
Wim Taymans d8911f269f utils: optimize for x86_64 with some inline asm
64bit x86 has native 64x64->128 bit multiply that we can use with some inline
assembler to speed up large multiplications.
Use bsr to find the number of leading zeros more efficiently.
2009-08-28 12:43:43 +02:00
Wim Taymans 0ef7a5af52 utils: factor out the leading zero count code 2009-08-28 12:33:37 +02:00
Wim Taymans 2b8d7a54cc utils: pass correction factor around
Pass the correction factor around to get rid of the enum, some code
and some branches.
2009-08-28 12:30:41 +02:00
Wim Taymans 75e8e9eb42 utils: whitespace fixes 2009-08-28 12:21:28 +02:00
Wim Taymans 2b66b29355 utils: move common correction code in a macro 2009-08-28 12:19:34 +02:00
Kipp Cannon 9cfd9f9374 gstutils: API: Add rounding to nearest and next integer versions of the 64 bit integer scaling functions
The new functions are
gst_util_uint64_scale_int_round()
gst_util_uint64_scale_int_ceil()
gst_util_uint64_scale_round()
gst_util_uint64_scale_ceil()

Fixes bug #590919.
2009-08-13 16:32:28 +02:00
Kipp Cannon 61481c1b79 gstutils: Revert parts of last change to optimize the scaling functions again
Partially fixes bug #590919.
2009-08-13 16:32:28 +02:00
Sebastian Dröge 6a84be95be gstutils: Fix violations of strict-aliasing rules in gst_util_uint64_scale() 2009-08-13 16:32:27 +02:00
Kipp Cannon 3d359729af gstutils: Refactor gst_util_uint64_scale()
This will later make it possible to provide rounding versions
of it without much code duplication.

Partially fixes bug #590919.
2009-08-13 16:32:27 +02:00
Stefan Kost 50fbc34f3f utils: use new _caps_can_intersect() 2009-08-06 15:30:34 +03:00
Tim-Philipp Müller 470e561216 gstxml: fix (de)serialisation of properties of type GstStructure
souphttpsrc has a property of type GstStructure, which causes an
assertion when serialising it to xml. Fixes #585137.
2009-06-16 08:55:17 +01:00
Tim-Philipp Müller f44204c8fa utils: gst_util_uint64_scale*() micro-optimisations
Sprinkle G_LIKELY/G_UNLIKELY; add inlined _scale_int_unchecked()
so we don't do some checks twice when calling it from _scale().
2009-06-08 17:13:17 +01:00
Sebastian Dröge 4e8f547f98 API: Add gst_message_{new,parse}_tag_full() to get/set the source pad
Fixes bug #582588.
2009-05-27 14:32:51 +02:00
Sebastian Dröge db6f445620 Revert "element: Set the originating pad as message source in gst_element_found_tags_for_pad ()"
This reverts commit bebfde7502.

This change shouldn't be done in a stable release series as
applications are actually expecting the sender to be an
GstElement. One example is totem.
2009-05-27 14:06:13 +02:00
Sebastian Dröge bebfde7502 element: Set the originating pad as message source in gst_element_found_tags_for_pad ()
Fixes bug #582588.
2009-05-14 12:25:20 +02:00
Jan Schmidt d50044dc2f docs: remove errant gtk-doc comment marker triggering a warning 2009-04-16 00:48:12 +01:00
Stefan Kost c9917a1a84 tests: remove the hacks to workaround the pad-leak 2009-04-08 17:49:18 +03:00
Wim Taymans 1bd7f96497 gstutils: improve property set and convert code
Use string deserialisation instead of custom parsing code to allow for all
supported ways of specifying property values.
fixes #576582.
2009-03-24 19:33:56 +01:00
Zeeshan Ali (Khattak) 8af9d58ea7 gstpad: fix gst_pad_can_link()
Move the gst_pad_can_link() implementation from gstutils to gstpad and use
gst_pad_link_prepare() to make it work correctly and also check the caps.

Make the broken implementation in gstutils static.

Small cleanups in the _get_fixed_caps() function.

Fixes #575682.
2009-03-18 17:01:16 +01:00