gst_plugins_base/gst-libs/gst/app/gstappsrc.c
branchRCL_3
changeset 29 567bb019e3e3
parent 0 0e761a78d257
child 30 7e817e7e631c
equal deleted inserted replaced
6:9b2c3c7a1a9c 29:567bb019e3e3
   111 
   111 
   112 #include <string.h>
   112 #include <string.h>
   113 
   113 
   114 #include "gstapp-marshal.h"
   114 #include "gstapp-marshal.h"
   115 #include "gstappsrc.h"
   115 #include "gstappsrc.h"
   116 #ifdef __SYMBIAN32__
       
   117 #include <glib_global.h>
       
   118 #endif
       
   119 
   116 
   120 struct _GstAppSrcPrivate
   117 struct _GstAppSrcPrivate
   121 {
   118 {
   122   GCond *cond;
   119   GCond *cond;
   123   GMutex *mutex;
   120   GMutex *mutex;
   223 #ifdef __SYMBIAN32__
   220 #ifdef __SYMBIAN32__
   224 static void gst_app_src_base_init (gpointer g_class);
   221 static void gst_app_src_base_init (gpointer g_class);
   225 static void gst_app_src_class_init (GstAppSrcClass * klass);
   222 static void gst_app_src_class_init (GstAppSrcClass * klass);
   226 static void gst_app_src_init (GstAppSrc * appsrc, GstAppSrcClass * klass);
   223 static void gst_app_src_init (GstAppSrc * appsrc, GstAppSrcClass * klass);
   227 #endif
   224 #endif
   228 
       
   229 static void gst_app_src_set_property (GObject * object, guint prop_id,
   225 static void gst_app_src_set_property (GObject * object, guint prop_id,
   230     const GValue * value, GParamSpec * pspec);
   226     const GValue * value, GParamSpec * pspec);
   231 static void gst_app_src_get_property (GObject * object, guint prop_id,
   227 static void gst_app_src_get_property (GObject * object, guint prop_id,
   232     GValue * value, GParamSpec * pspec);
   228     GValue * value, GParamSpec * pspec);
   233 
   229 
   265 
   261 
   266 #ifndef __SYMBIAN32__
   262 #ifndef __SYMBIAN32__
   267 GST_BOILERPLATE_FULL (GstAppSrc, gst_app_src, GstBaseSrc, GST_TYPE_BASE_SRC,
   263 GST_BOILERPLATE_FULL (GstAppSrc, gst_app_src, GstBaseSrc, GST_TYPE_BASE_SRC,
   268     _do_init);
   264     _do_init);
   269 #else
   265 #else
   270 
       
   271 static GstBaseSrcClass *parent_class = NULL;           
   266 static GstBaseSrcClass *parent_class = NULL;           
   272 static void
   267 static void
   273 gst_app_src_class_init_trampoline (gpointer g_class,
   268 gst_app_src_class_init_trampoline (gpointer g_class,
   274                         gpointer data)
   269                         gpointer data)
   275 {                                   
   270 {                                   
   276   parent_class = (GstBaseSrcClass *)               
   271   parent_class = (GstBaseSrcClass *)               
   277       g_type_class_peek_parent (g_class);              
   272       g_type_class_peek_parent (g_class);              
   278       gst_app_src_class_init ((GstAppSrcClass *)g_class);       
   273       gst_app_src_class_init ((GstAppSrcClass *)g_class);       
   279 }
   274 }
   280 
       
   281 EXPORT_C GType
   275 EXPORT_C GType
   282 gst_app_src_get_type (void)
   276 gst_app_src_get_type (void)
   283 {
   277 {
   284 static GType object_type = 0;                      
   278 static GType object_type = 0;                      
   285  if (G_UNLIKELY (object_type == 0)) {                  
   279  if (G_UNLIKELY (object_type == 0)) {                  
   300  }                                 
   294  }                                 
   301  return object_type;               
   295  return object_type;               
   302 }
   296 }
   303 #endif
   297 #endif
   304 
   298 
   305 
       
   306 
       
   307 static void
   299 static void
   308 gst_app_src_base_init (gpointer g_class)
   300 gst_app_src_base_init (gpointer g_class)
   309 {
   301 {
   310   GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
   302   GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
   311 
   303 
   338    * on outgoing buffers.
   330    * on outgoing buffers.
   339    */
   331    */
   340   g_object_class_install_property (gobject_class, PROP_CAPS,
   332   g_object_class_install_property (gobject_class, PROP_CAPS,
   341       g_param_spec_boxed ("caps", "Caps",
   333       g_param_spec_boxed ("caps", "Caps",
   342           "The allowed caps for the src pad", GST_TYPE_CAPS,
   334           "The allowed caps for the src pad", GST_TYPE_CAPS,
   343           G_PARAM_READWRITE));
   335           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   344   /**
   336   /**
   345    * GstAppSrc::format
   337    * GstAppSrc::format
   346    *
   338    *
   347    * The format to use for segment events. When the source is producing
   339    * The format to use for segment events. When the source is producing
   348    * timestamped buffers this property should be set to GST_FORMAT_TIME.
   340    * timestamped buffers this property should be set to GST_FORMAT_TIME.
   349    */
   341    */
   350   g_object_class_install_property (gobject_class, PROP_FORMAT,
   342   g_object_class_install_property (gobject_class, PROP_FORMAT,
   351       g_param_spec_enum ("format", "Format",
   343       g_param_spec_enum ("format", "Format",
   352           "The format of the segment events and seek", GST_TYPE_FORMAT,
   344           "The format of the segment events and seek", GST_TYPE_FORMAT,
   353           DEFAULT_PROP_FORMAT, G_PARAM_READWRITE));
   345           DEFAULT_PROP_FORMAT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   354   /**
   346   /**
   355    * GstAppSrc::size
   347    * GstAppSrc::size
   356    *
   348    *
   357    * The total size in bytes of the data stream. If the total size is known, it
   349    * The total size in bytes of the data stream. If the total size is known, it
   358    * is recommended to configure it with this property.
   350    * is recommended to configure it with this property.
   359    */
   351    */
   360   g_object_class_install_property (gobject_class, PROP_SIZE,
   352   g_object_class_install_property (gobject_class, PROP_SIZE,
   361       g_param_spec_int64 ("size", "Size",
   353       g_param_spec_int64 ("size", "Size",
   362           "The size of the data stream in bytes (-1 if unknown)",
   354           "The size of the data stream in bytes (-1 if unknown)",
   363           -1, G_MAXINT64, DEFAULT_PROP_SIZE,
   355           -1, G_MAXINT64, DEFAULT_PROP_SIZE,
   364           G_PARAM_READWRITE));
   356           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   365   /**
   357   /**
   366    * GstAppSrc::stream-type
   358    * GstAppSrc::stream-type
   367    *
   359    *
   368    * The type of stream that this source is producing.  For seekable streams the
   360    * The type of stream that this source is producing.  For seekable streams the
   369    * application should connect to the seek-data signal.
   361    * application should connect to the seek-data signal.
   370    */
   362    */
   371   g_object_class_install_property (gobject_class, PROP_STREAM_TYPE,
   363   g_object_class_install_property (gobject_class, PROP_STREAM_TYPE,
   372       g_param_spec_enum ("stream-type", "Stream Type",
   364       g_param_spec_enum ("stream-type", "Stream Type",
   373           "the type of the stream", GST_TYPE_APP_STREAM_TYPE,
   365           "the type of the stream", GST_TYPE_APP_STREAM_TYPE,
   374           DEFAULT_PROP_STREAM_TYPE,
   366           DEFAULT_PROP_STREAM_TYPE,
   375           G_PARAM_READWRITE));
   367           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   376   /**
   368   /**
   377    * GstAppSrc::max-bytes
   369    * GstAppSrc::max-bytes
   378    *
   370    *
   379    * The maximum amount of bytes that can be queued internally.
   371    * The maximum amount of bytes that can be queued internally.
   380    * After the maximum amount of bytes are queued, appsrc will emit the
   372    * After the maximum amount of bytes are queued, appsrc will emit the
   382    */
   374    */
   383   g_object_class_install_property (gobject_class, PROP_MAX_BYTES,
   375   g_object_class_install_property (gobject_class, PROP_MAX_BYTES,
   384       g_param_spec_uint64 ("max-bytes", "Max bytes",
   376       g_param_spec_uint64 ("max-bytes", "Max bytes",
   385           "The maximum number of bytes to queue internally (0 = unlimited)",
   377           "The maximum number of bytes to queue internally (0 = unlimited)",
   386           0, G_MAXUINT64, DEFAULT_PROP_MAX_BYTES,
   378           0, G_MAXUINT64, DEFAULT_PROP_MAX_BYTES,
   387           G_PARAM_READWRITE));
   379           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   388   /**
   380   /**
   389    * GstAppSrc::block
   381    * GstAppSrc::block
   390    *
   382    *
   391    * When max-bytes are queued and after the enough-data signal has been emited,
   383    * When max-bytes are queued and after the enough-data signal has been emited,
   392    * block any further push-buffer calls until the amount of queued bytes drops
   384    * block any further push-buffer calls until the amount of queued bytes drops
   393    * below the max-bytes limit.
   385    * below the max-bytes limit.
   394    */
   386    */
   395   g_object_class_install_property (gobject_class, PROP_BLOCK,
   387   g_object_class_install_property (gobject_class, PROP_BLOCK,
   396       g_param_spec_boolean ("block", "Block",
   388       g_param_spec_boolean ("block", "Block",
   397           "Block push-buffer when max-bytes are queued",
   389           "Block push-buffer when max-bytes are queued",
   398           DEFAULT_PROP_BLOCK, G_PARAM_READWRITE));
   390           DEFAULT_PROP_BLOCK, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   399 
   391 
   400   /**
   392   /**
   401    * GstAppSrc::is-live
   393    * GstAppSrc::is-live
   402    *
   394    *
   403    * Instruct the source to behave like a live source. This includes that it
   395    * Instruct the source to behave like a live source. This includes that it
   404    * will only push out buffers in the PLAYING state.
   396    * will only push out buffers in the PLAYING state.
   405    */
   397    */
   406   g_object_class_install_property (gobject_class, PROP_IS_LIVE,
   398   g_object_class_install_property (gobject_class, PROP_IS_LIVE,
   407       g_param_spec_boolean ("is-live", "Is Live",
   399       g_param_spec_boolean ("is-live", "Is Live",
   408           "Whether to act as a live source",
   400           "Whether to act as a live source",
   409           DEFAULT_PROP_IS_LIVE, G_PARAM_READWRITE ));
   401           DEFAULT_PROP_IS_LIVE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   410   /**
   402   /**
   411    * GstAppSrc::min-latency
   403    * GstAppSrc::min-latency
   412    *
   404    *
   413    * The minimum latency of the source. A value of -1 will use the default
   405    * The minimum latency of the source. A value of -1 will use the default
   414    * latency calculations of #GstBaseSrc.
   406    * latency calculations of #GstBaseSrc.
   415    */
   407    */
   416   g_object_class_install_property (gobject_class, PROP_MIN_LATENCY,
   408   g_object_class_install_property (gobject_class, PROP_MIN_LATENCY,
   417       g_param_spec_int64 ("min-latency", "Min Latency",
   409       g_param_spec_int64 ("min-latency", "Min Latency",
   418           "The minimum latency (-1 = default)",
   410           "The minimum latency (-1 = default)",
   419           -1, G_MAXINT64, DEFAULT_PROP_MIN_LATENCY,
   411           -1, G_MAXINT64, DEFAULT_PROP_MIN_LATENCY,
   420           G_PARAM_READWRITE));
   412           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   421   /**
   413   /**
   422    * GstAppSrc::max-latency
   414    * GstAppSrc::max-latency
   423    *
   415    *
   424    * The maximum latency of the source. A value of -1 means an unlimited amout
   416    * The maximum latency of the source. A value of -1 means an unlimited amout
   425    * of latency.
   417    * of latency.
   426    */
   418    */
   427   g_object_class_install_property (gobject_class, PROP_MAX_LATENCY,
   419   g_object_class_install_property (gobject_class, PROP_MAX_LATENCY,
   428       g_param_spec_int64 ("max-latency", "Max Latency",
   420       g_param_spec_int64 ("max-latency", "Max Latency",
   429           "The maximum latency (-1 = unlimited)",
   421           "The maximum latency (-1 = unlimited)",
   430           -1, G_MAXINT64, DEFAULT_PROP_MAX_LATENCY,
   422           -1, G_MAXINT64, DEFAULT_PROP_MAX_LATENCY,
   431           G_PARAM_READWRITE));
   423           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   432 
   424 
   433   /**
   425   /**
   434    * GstAppSrc::emit-signals
   426    * GstAppSrc::emit-signals
   435    *
   427    *
   436    * Make appsrc emit the "need-data", "enough-data" and "seek-data" signals.
   428    * Make appsrc emit the "need-data", "enough-data" and "seek-data" signals.
   440    * Since: 0.10.23
   432    * Since: 0.10.23
   441    */
   433    */
   442   g_object_class_install_property (gobject_class, PROP_EMIT_SIGNALS,
   434   g_object_class_install_property (gobject_class, PROP_EMIT_SIGNALS,
   443       g_param_spec_boolean ("emit-signals", "Emit signals",
   435       g_param_spec_boolean ("emit-signals", "Emit signals",
   444           "Emit new-preroll and new-buffer signals", DEFAULT_PROP_EMIT_SIGNALS,
   436           "Emit new-preroll and new-buffer signals", DEFAULT_PROP_EMIT_SIGNALS,
   445           G_PARAM_READWRITE));
   437           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   446 
   438 
   447   /**
   439   /**
   448    * GstAppSrc::need-data:
   440    * GstAppSrc::need-data:
   449    * @appsrc: the appsrc element that emited the signal
   441    * @appsrc: the appsrc element that emited the signal
   450    * @length: the amount of bytes needed.
   442    * @length: the amount of bytes needed.