gstreamer_core/gst/gstminiobject.c
branchRCL_3
changeset 7 567bb019e3e3
parent 0 0e761a78d257
child 8 7e817e7e631c
equal deleted inserted replaced
6:9b2c3c7a1a9c 7:567bb019e3e3
    35 
    35 
    36 #include "gst/gst_private.h"
    36 #include "gst/gst_private.h"
    37 #include "gst/gstminiobject.h"
    37 #include "gst/gstminiobject.h"
    38 #include "gst/gstinfo.h"
    38 #include "gst/gstinfo.h"
    39 #include <gobject/gvaluecollector.h>
    39 #include <gobject/gvaluecollector.h>
    40 
    40 #ifdef __SYMBIAN32__
       
    41 #include <glib_global.h>
       
    42 #endif
    41 #ifndef GST_DISABLE_TRACE
    43 #ifndef GST_DISABLE_TRACE
    42 #include "gsttrace.h"
    44 #include "gsttrace.h"
    43 static GstAllocTrace *_gst_mini_object_trace;
    45 static GstAllocTrace *_gst_mini_object_trace;
    44 #endif
    46 #endif
    45 
    47 
   161 
   163 
   162 static void
   164 static void
   163 gst_mini_object_finalize (GstMiniObject * obj)
   165 gst_mini_object_finalize (GstMiniObject * obj)
   164 {
   166 {
   165   /* do nothing */
   167   /* do nothing */
       
   168 
       
   169   /* WARNING: if anything is ever put in this method, make sure that the
       
   170    * following sub-classes' finalize method chains up to this one:
       
   171    * gstbuffer
       
   172    * gstevent
       
   173    * gstmessage
       
   174    * gstquery
       
   175    */
   166 }
   176 }
   167 
   177 
   168 /**
   178 /**
   169  * gst_mini_object_new:
   179  * gst_mini_object_new:
   170  * @type: the #GType of the mini-object to create
   180  * @type: the #GType of the mini-object to create
   285   g_return_val_if_fail (mini_object != NULL, NULL);
   295   g_return_val_if_fail (mini_object != NULL, NULL);
   286 
   296 
   287   if (gst_mini_object_is_writable (mini_object)) {
   297   if (gst_mini_object_is_writable (mini_object)) {
   288     ret = (GstMiniObject *) mini_object;
   298     ret = (GstMiniObject *) mini_object;
   289   } else {
   299   } else {
       
   300     GST_CAT_DEBUG (GST_CAT_PERFORMANCE, "copy %s miniobject",
       
   301         g_type_name (G_TYPE_FROM_INSTANCE (mini_object)));
   290     ret = gst_mini_object_copy (mini_object);
   302     ret = gst_mini_object_copy (mini_object);
   291     gst_mini_object_unref ((GstMiniObject *) mini_object);
   303     gst_mini_object_unref ((GstMiniObject *) mini_object);
   292   }
   304   }
   293 
   305 
   294   return ret;
   306   return ret;
   444 static void
   456 static void
   445 gst_value_mini_object_copy (const GValue * src_value, GValue * dest_value)
   457 gst_value_mini_object_copy (const GValue * src_value, GValue * dest_value)
   446 {
   458 {
   447   if (src_value->data[0].v_pointer) {
   459   if (src_value->data[0].v_pointer) {
   448     dest_value->data[0].v_pointer =
   460     dest_value->data[0].v_pointer =
   449         gst_mini_object_ref (GST_MINI_OBJECT_CAST (src_value->data[0].
   461         gst_mini_object_ref (GST_MINI_OBJECT_CAST (src_value->
   450             v_pointer));
   462             data[0].v_pointer));
   451   } else {
   463   } else {
   452     dest_value->data[0].v_pointer = NULL;
   464     dest_value->data[0].v_pointer = NULL;
   453   }
   465   }
   454 }
   466 }
   455 
   467 
   563   g_return_val_if_fail (GST_VALUE_HOLDS_MINI_OBJECT (value), NULL);
   575   g_return_val_if_fail (GST_VALUE_HOLDS_MINI_OBJECT (value), NULL);
   564 
   576 
   565   return value->data[0].v_pointer;
   577   return value->data[0].v_pointer;
   566 }
   578 }
   567 
   579 
       
   580 /**
       
   581  * gst_value_dup_mini_object:
       
   582  * @value:   a valid #GValue of %GST_TYPE_MINI_OBJECT derived type
       
   583  *
       
   584  * Get the contents of a %GST_TYPE_MINI_OBJECT derived #GValue,
       
   585  * increasing its reference count.
       
   586  *
       
   587  * Returns: mini object contents of @value
       
   588  *
       
   589  * Since: 0.10.20
       
   590  */
       
   591 #ifdef __SYMBIAN32__
       
   592 EXPORT_C
       
   593 #endif
       
   594 
       
   595 GstMiniObject *
       
   596 gst_value_dup_mini_object (const GValue * value)
       
   597 {
       
   598   g_return_val_if_fail (GST_VALUE_HOLDS_MINI_OBJECT (value), NULL);
       
   599 
       
   600   return gst_mini_object_ref (value->data[0].v_pointer);
       
   601 }
       
   602 
       
   603 
   568 /* param spec */
   604 /* param spec */
   569 
       
   570 static GType gst_param_spec_mini_object_get_type (void);
       
   571 
       
   572 #define GST_TYPE_PARAM_SPEC_MINI_OBJECT (gst_param_spec_mini_object_get_type())
       
   573 #define GST_PARAM_SPEC_MINI_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_PARAM_SPEC_MINI_OBJECT, GstParamSpecMiniObject))
       
   574 
       
   575 typedef struct _GstParamSpecMiniObject GstParamSpecMiniObject;
       
   576 struct _GstParamSpecMiniObject
       
   577 {
       
   578   GParamSpec parent_instance;
       
   579 };
       
   580 
   605 
   581 static void
   606 static void
   582 param_mini_object_init (GParamSpec * pspec)
   607 param_mini_object_init (GParamSpec * pspec)
   583 {
   608 {
   584   /* GParamSpecMiniObject *ospec = G_PARAM_SPEC_MINI_OBJECT (pspec); */
   609   /* GParamSpecMiniObject *ospec = G_PARAM_SPEC_MINI_OBJECT (pspec); */
   617 
   642 
   618   /* not much to compare here, try to at least provide stable lesser/greater result */
   643   /* not much to compare here, try to at least provide stable lesser/greater result */
   619 
   644 
   620   return p1 < p2 ? -1 : p1 > p2;
   645   return p1 < p2 ? -1 : p1 > p2;
   621 }
   646 }
   622 
   647 #ifdef __SYMBIAN32__
   623 static GType
   648 EXPORT_C
       
   649 #endif
       
   650 
       
   651 
       
   652 GType
   624 gst_param_spec_mini_object_get_type (void)
   653 gst_param_spec_mini_object_get_type (void)
   625 {
   654 {
   626   static GType type;
   655   static GType type;
   627 
   656 
   628   if (G_UNLIKELY (type) == 0) {
   657   if (G_UNLIKELY (type) == 0) {
   665 {
   694 {
   666   GstParamSpecMiniObject *ospec;
   695   GstParamSpecMiniObject *ospec;
   667 
   696 
   668   g_return_val_if_fail (g_type_is_a (object_type, GST_TYPE_MINI_OBJECT), NULL);
   697   g_return_val_if_fail (g_type_is_a (object_type, GST_TYPE_MINI_OBJECT), NULL);
   669 
   698 
   670   ospec = g_param_spec_internal (GST_TYPE_PARAM_SPEC_MINI_OBJECT,
   699   ospec = g_param_spec_internal (GST_TYPE_PARAM_MINI_OBJECT,
   671       name, nick, blurb, flags);
   700       name, nick, blurb, flags);
   672   G_PARAM_SPEC (ospec)->value_type = object_type;
   701   G_PARAM_SPEC (ospec)->value_type = object_type;
   673 
   702 
   674   return G_PARAM_SPEC (ospec);
   703   return G_PARAM_SPEC (ospec);
   675 }
   704 }