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