< prev index next >

modules/javafx.media/src/main/native/gstreamer/gstreamer-lite/gstreamer/gst/gstvalue.c

Print this page
rev 10250 : imported patch 9-cpu-1701.patch


4311 }
4312 
4313 static gboolean
4314 gst_value_subtract_fraction_range_fraction_range (GValue * dest,
4315     const GValue * minuend, const GValue * subtrahend)
4316 {
4317   /* since we don't have open ranges, we have to approximate */
4318   /* done like with ints and doubles. Creates a list of 2 fraction ranges */
4319   const GValue *min1 = gst_value_get_fraction_range_min (minuend);
4320   const GValue *max2 = gst_value_get_fraction_range_max (minuend);
4321   const GValue *max1 = gst_value_get_fraction_range_min (subtrahend);
4322   const GValue *min2 = gst_value_get_fraction_range_max (subtrahend);
4323   gint cmp1, cmp2;
4324   GValue v1 = { 0, };
4325   GValue v2 = { 0, };
4326   GValue *pv1, *pv2;            /* yeah, hungarian! */
4327   GstValueCompareFunc compare;
4328 
4329   g_return_val_if_fail (min1 != NULL && max1 != NULL, FALSE);
4330   g_return_val_if_fail (min2 != NULL && max2 != NULL, FALSE);




4331 
4332   compare = gst_value_get_compare_func (min1);
4333   g_return_val_if_fail (compare, FALSE);
4334 
4335   cmp1 = gst_value_compare_with_func (max2, max1, compare);
4336   g_return_val_if_fail (cmp1 != GST_VALUE_UNORDERED, FALSE);
4337   if (cmp1 == GST_VALUE_LESS_THAN)
4338     max1 = max2;
4339   cmp1 = gst_value_compare_with_func (min1, min2, compare);
4340   g_return_val_if_fail (cmp1 != GST_VALUE_UNORDERED, FALSE);
4341   if (cmp1 == GST_VALUE_GREATER_THAN)
4342     min2 = min1;
4343 
4344   cmp1 = gst_value_compare_with_func (min1, max1, compare);
4345   cmp2 = gst_value_compare_with_func (min2, max2, compare);
4346 
4347   if (cmp1 == GST_VALUE_LESS_THAN && cmp2 == GST_VALUE_LESS_THAN) {
4348     pv1 = &v1;
4349     pv2 = &v2;
4350   } else if (cmp1 == GST_VALUE_LESS_THAN) {


5022     g_warning ("adding type %s multiple times", g_type_name (table->type));
5023 
5024   /* FIXME: we're not really doing the const justice, we assume the table is
5025    * static */
5026   gst_value_hash_add_type (table->type, table);
5027 }
5028 
5029 /**
5030  * gst_value_init_and_copy:
5031  * @dest: (out caller-allocates): the target value
5032  * @src: the source value
5033  *
5034  * Initialises the target value to be of the same type as source and then copies
5035  * the contents from source to target.
5036  */
5037 void
5038 gst_value_init_and_copy (GValue * dest, const GValue * src)
5039 {
5040   g_return_if_fail (G_IS_VALUE (src));
5041   g_return_if_fail (dest != NULL);




5042 
5043   g_value_init (dest, G_VALUE_TYPE (src));
5044   g_value_copy (src, dest);
5045 }
5046 
5047 /* move src into dest and clear src */
5048 static void
5049 gst_value_move (GValue * dest, GValue * src)
5050 {
5051   g_assert (G_IS_VALUE (src));
5052   g_assert (dest != NULL);
5053 
5054   *dest = *src;
5055   memset (src, 0, sizeof (GValue));
5056 }
5057 
5058 /**
5059  * gst_value_serialize:
5060  * @value: a #GValue to serialize
5061  *




4311 }
4312 
4313 static gboolean
4314 gst_value_subtract_fraction_range_fraction_range (GValue * dest,
4315     const GValue * minuend, const GValue * subtrahend)
4316 {
4317   /* since we don't have open ranges, we have to approximate */
4318   /* done like with ints and doubles. Creates a list of 2 fraction ranges */
4319   const GValue *min1 = gst_value_get_fraction_range_min (minuend);
4320   const GValue *max2 = gst_value_get_fraction_range_max (minuend);
4321   const GValue *max1 = gst_value_get_fraction_range_min (subtrahend);
4322   const GValue *min2 = gst_value_get_fraction_range_max (subtrahend);
4323   gint cmp1, cmp2;
4324   GValue v1 = { 0, };
4325   GValue v2 = { 0, };
4326   GValue *pv1, *pv2;            /* yeah, hungarian! */
4327   GstValueCompareFunc compare;
4328 
4329   g_return_val_if_fail (min1 != NULL && max1 != NULL, FALSE);
4330   g_return_val_if_fail (min2 != NULL && max2 != NULL, FALSE);
4331 #ifdef GSTREAMER_LITE
4332   if (min1 == NULL || max1 == NULL || min2 == NULL || max2 == NULL)
4333     return FALSE;
4334 #endif // GSTREAMER_LITE
4335 
4336   compare = gst_value_get_compare_func (min1);
4337   g_return_val_if_fail (compare, FALSE);
4338 
4339   cmp1 = gst_value_compare_with_func (max2, max1, compare);
4340   g_return_val_if_fail (cmp1 != GST_VALUE_UNORDERED, FALSE);
4341   if (cmp1 == GST_VALUE_LESS_THAN)
4342     max1 = max2;
4343   cmp1 = gst_value_compare_with_func (min1, min2, compare);
4344   g_return_val_if_fail (cmp1 != GST_VALUE_UNORDERED, FALSE);
4345   if (cmp1 == GST_VALUE_GREATER_THAN)
4346     min2 = min1;
4347 
4348   cmp1 = gst_value_compare_with_func (min1, max1, compare);
4349   cmp2 = gst_value_compare_with_func (min2, max2, compare);
4350 
4351   if (cmp1 == GST_VALUE_LESS_THAN && cmp2 == GST_VALUE_LESS_THAN) {
4352     pv1 = &v1;
4353     pv2 = &v2;
4354   } else if (cmp1 == GST_VALUE_LESS_THAN) {


5026     g_warning ("adding type %s multiple times", g_type_name (table->type));
5027 
5028   /* FIXME: we're not really doing the const justice, we assume the table is
5029    * static */
5030   gst_value_hash_add_type (table->type, table);
5031 }
5032 
5033 /**
5034  * gst_value_init_and_copy:
5035  * @dest: (out caller-allocates): the target value
5036  * @src: the source value
5037  *
5038  * Initialises the target value to be of the same type as source and then copies
5039  * the contents from source to target.
5040  */
5041 void
5042 gst_value_init_and_copy (GValue * dest, const GValue * src)
5043 {
5044   g_return_if_fail (G_IS_VALUE (src));
5045   g_return_if_fail (dest != NULL);
5046 #ifdef GSTREAMER_LITE
5047   if (src == NULL || !G_IS_VALUE (src) || dest == NULL)
5048     return;
5049 #endif // GSTREAMER_LITE
5050 
5051   g_value_init (dest, G_VALUE_TYPE (src));
5052   g_value_copy (src, dest);
5053 }
5054 
5055 /* move src into dest and clear src */
5056 static void
5057 gst_value_move (GValue * dest, GValue * src)
5058 {
5059   g_assert (G_IS_VALUE (src));
5060   g_assert (dest != NULL);
5061 
5062   *dest = *src;
5063   memset (src, 0, sizeof (GValue));
5064 }
5065 
5066 /**
5067  * gst_value_serialize:
5068  * @value: a #GValue to serialize
5069  *


< prev index next >