本文整理汇总了C++中GST_BASE_SRC函数的典型用法代码示例。如果您正苦于以下问题:C++ GST_BASE_SRC函数的具体用法?C++ GST_BASE_SRC怎么用?C++ GST_BASE_SRC使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GST_BASE_SRC函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gst_v4l2src_init
static void
gst_v4l2src_init (GstV4l2Src * v4l2src, GstV4l2SrcClass * klass)
{
/* fixme: give an update_fps_function */
v4l2src->v4l2object = gst_v4l2_object_new (GST_ELEMENT (v4l2src),
V4L2_BUF_TYPE_VIDEO_CAPTURE, DEFAULT_PROP_DEVICE,
gst_v4l2_get_input, gst_v4l2_set_input, NULL);
/* number of buffers requested */
v4l2src->num_buffers = PROP_DEF_QUEUE_SIZE;
v4l2src->always_copy = PROP_DEF_ALWAYS_COPY;
v4l2src->decimate = PROP_DEF_DECIMATE;
v4l2src->is_capturing = FALSE;
gst_base_src_set_format (GST_BASE_SRC (v4l2src), GST_FORMAT_TIME);
gst_base_src_set_live (GST_BASE_SRC (v4l2src), TRUE);
v4l2src->fps_d = 0;
v4l2src->fps_n = 0;
}
示例2: gst_base_audio_src_init
static void
gst_base_audio_src_init (GstBaseAudioSrc * baseaudiosrc,
GstBaseAudioSrcClass * g_class)
{
baseaudiosrc->priv = GST_BASE_AUDIO_SRC_GET_PRIVATE (baseaudiosrc);
baseaudiosrc->buffer_time = DEFAULT_BUFFER_TIME;
baseaudiosrc->latency_time = DEFAULT_LATENCY_TIME;
baseaudiosrc->priv->provide_clock = DEFAULT_PROVIDE_CLOCK;
baseaudiosrc->priv->slave_method = DEFAULT_SLAVE_METHOD;
/* reset blocksize we use latency time to calculate a more useful
* value based on negotiated format. */
GST_BASE_SRC (baseaudiosrc)->blocksize = 0;
baseaudiosrc->clock = gst_audio_clock_new ("GstAudioSrcClock",
(GstAudioClockGetTimeFunc) gst_base_audio_src_get_time, baseaudiosrc);
/* we are always a live source */
gst_base_src_set_live (GST_BASE_SRC (baseaudiosrc), TRUE);
/* we operate in time */
gst_base_src_set_format (GST_BASE_SRC (baseaudiosrc), GST_FORMAT_TIME);
}
示例3: gst_v4l2src_init
static void
gst_v4l2src_init (GstV4l2Src * v4l2src, GstV4l2SrcClass * klass)
{
/* fixme: give an update_fps_function */
v4l2src->v4l2object = gst_v4l2_object_new (GST_ELEMENT (v4l2src),
gst_v4l2_get_input, gst_v4l2_set_input, NULL);
/* number of buffers requested */
v4l2src->num_buffers = GST_V4L2_MIN_BUFFERS;
v4l2src->always_copy = DEFAULT_PROP_ALWAYS_COPY;
v4l2src->formats = NULL;
v4l2src->is_capturing = FALSE;
gst_base_src_set_format (GST_BASE_SRC (v4l2src), GST_FORMAT_TIME);
gst_base_src_set_live (GST_BASE_SRC (v4l2src), TRUE);
v4l2src->fps_d = 0;
v4l2src->fps_n = 0;
}
示例4: shell_recorder_src_add_buffer
/**
* shell_recorder_src_add_buffer:
*
* Adds a buffer to the internal queue to be pushed out at the next opportunity.
* There is no flow control, so arbitrary amounts of memory may be used by
* the buffers on the queue. The buffer contents must match the #GstCaps
* set in the :caps property.
*/
void
shell_recorder_src_add_buffer (ShellRecorderSrc *src,
GstBuffer *buffer)
{
g_return_if_fail (SHELL_IS_RECORDER_SRC (src));
g_return_if_fail (src->caps != NULL);
gst_base_src_set_caps (GST_BASE_SRC (src), src->caps);
shell_recorder_src_update_memory_used (src,
(int)(gst_buffer_get_size(buffer) / 1024));
g_async_queue_push (src->queue, gst_buffer_ref (buffer));
}
示例5: gst_dccp_client_src_set_property
/*
* Set the value of a property for the client src.
*/
static void
gst_dccp_client_src_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstDCCPClientSrc *src = GST_DCCP_CLIENT_SRC (object);
switch (prop_id) {
case PROP_PORT:
src->port = g_value_get_int (value);
break;
case PROP_HOST:
if (!g_value_get_string (value)) {
g_warning ("host property cannot be NULL");
break;
}
g_free (src->host);
src->host = g_strdup (g_value_get_string (value));
break;
case PROP_SOCK_FD:
src->sock_fd = g_value_get_int (value);
break;
case PROP_CLOSED:
src->closed = g_value_get_boolean (value);
break;
case PROP_CCID:
src->ccid = g_value_get_int (value);
break;
case PROP_CAPS:
{
const GstCaps *new_caps_val = gst_value_get_caps (value);
GstCaps *new_caps;
GstCaps *old_caps;
if (new_caps_val == NULL) {
new_caps = gst_caps_new_any ();
} else {
new_caps = gst_caps_copy (new_caps_val);
}
old_caps = src->caps;
src->caps = new_caps;
if (old_caps)
gst_caps_unref (old_caps);
gst_pad_set_caps (GST_BASE_SRC (src)->srcpad, new_caps);
break;
}
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
示例6: gst_dx9screencapsrc_init
static void
gst_dx9screencapsrc_init (GstDX9ScreenCapSrc * src)
{
/* Set src element inital values... */
src->surface = NULL;
src->d3d9_device = NULL;
src->capture_x = 0;
src->capture_y = 0;
src->capture_w = 0;
src->capture_h = 0;
src->monitor = 0;
src->show_cursor = FALSE;
src->monitor_info.cbSize = sizeof(MONITORINFO);
gst_base_src_set_format (GST_BASE_SRC (src), GST_FORMAT_TIME);
gst_base_src_set_live (GST_BASE_SRC (src), TRUE);
if (!g_d3d9)
g_d3d9 = Direct3DCreate9 (D3D_SDK_VERSION);
else
IDirect3D9_AddRef (g_d3d9);
}
示例7: gst_devsound_src_init
static void gst_devsound_src_init(GstDevsoundSrc * devsoundsrc)
{
GST_DEBUG_OBJECT(devsoundsrc, "initializing devsoundsrc");
gst_base_src_set_live(GST_BASE_SRC(devsoundsrc), TRUE);
//gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) devsoundsrc, "gst_devsound_src_init ENTER ",NULL);
devsoundsrc->device = g_strdup(DEFAULT_DEVICE);
devsoundsrc->handle=NULL;
devsoundsrc->preference = 0; //default=>EMdaPriorityPreferenceNone;
devsoundsrc->priority = 0; //default=>EMdaPriorityNormal;
devsoundsrc->firstTimeInit = kUnInitialized;
// pthread_mutex_init(&create_mutex1, NULL);
// pthread_cond_init(&create_condition1, NULL);
//gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) devsoundsrc, "gst_devsound_src_init EXIT ",NULL);
}
示例8: gst_nanomsgsrc_get_property
static void gst_nanomsgsrc_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
{
GstNanomsgSrc *nanomsgsrc = GST_NANOMSGSRC(object);
switch (prop_id)
{
case PROP_URI:
LOCK_SRC_MUTEX(nanomsgsrc);
g_value_set_string(value, nanomsgsrc->uri);
UNLOCK_SRC_MUTEX(nanomsgsrc);
break;
case PROP_TIMEOUT:
LOCK_SRC_MUTEX(nanomsgsrc);
g_value_set_uint64(value, nanomsgsrc->timeout);
UNLOCK_SRC_MUTEX(nanomsgsrc);
break;
case PROP_PROTOCOL:
LOCK_SRC_MUTEX(nanomsgsrc);
g_value_set_enum(value, nanomsgsrc->protocol);
UNLOCK_SRC_MUTEX(nanomsgsrc);
break;
case PROP_IPV4ONLY:
LOCK_SRC_MUTEX(nanomsgsrc);
g_value_set_boolean(value, nanomsgsrc->ipv4only);
UNLOCK_SRC_MUTEX(nanomsgsrc);
break;
case PROP_RCVBUFSIZE:
LOCK_SRC_MUTEX(nanomsgsrc);
g_value_set_int(value, nanomsgsrc->rcvbufsize);
UNLOCK_SRC_MUTEX(nanomsgsrc);
break;
case PROP_SUBSCRIPTION_TOPIC:
LOCK_SRC_MUTEX(nanomsgsrc);
g_value_set_string(value, nanomsgsrc->subscription_topic);
UNLOCK_SRC_MUTEX(nanomsgsrc);
break;
case PROP_IS_LIVE:
g_value_set_boolean(value, gst_base_src_is_live(GST_BASE_SRC(object)));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
}
}
示例9: gst_avdtp_src_start
static gboolean
gst_avdtp_src_start (GstBaseSrc * bsrc)
{
GstAvdtpSrc *avdtpsrc = GST_AVDTP_SRC (bsrc);
/* None of this can go into prepare() since we need to set up the
* connection to figure out what format the device is going to send us.
*/
if (!gst_avdtp_connection_acquire (&avdtpsrc->conn, FALSE)) {
GST_ERROR_OBJECT (avdtpsrc, "Failed to acquire connection");
return FALSE;
}
if (!gst_avdtp_connection_get_properties (&avdtpsrc->conn)) {
GST_ERROR_OBJECT (avdtpsrc, "Failed to get transport properties");
goto fail;
}
if (!gst_avdtp_connection_conf_recv_stream_fd (&avdtpsrc->conn)) {
GST_ERROR_OBJECT (avdtpsrc, "Failed to configure stream fd");
goto fail;
}
GST_DEBUG_OBJECT (avdtpsrc, "Setting block size to link MTU (%d)",
avdtpsrc->conn.data.link_mtu);
gst_base_src_set_blocksize (GST_BASE_SRC (avdtpsrc),
avdtpsrc->conn.data.link_mtu);
avdtpsrc->dev_caps = gst_avdtp_connection_get_caps (&avdtpsrc->conn);
if (!avdtpsrc->dev_caps) {
GST_ERROR_OBJECT (avdtpsrc, "Failed to get device caps");
goto fail;
}
gst_poll_fd_init (&avdtpsrc->pfd);
avdtpsrc->pfd.fd = g_io_channel_unix_get_fd (avdtpsrc->conn.stream);
gst_poll_add_fd (avdtpsrc->poll, &avdtpsrc->pfd);
gst_poll_fd_ctl_read (avdtpsrc->poll, &avdtpsrc->pfd, TRUE);
gst_poll_set_flushing (avdtpsrc->poll, FALSE);
g_atomic_int_set (&avdtpsrc->unlocked, FALSE);
return TRUE;
fail:
gst_avdtp_connection_release (&avdtpsrc->conn);
return FALSE;
}
示例10: gst_gdiscreencapsrc_init
static void
gst_gdiscreencapsrc_init (GstGDIScreenCapSrc * src,
GstGDIScreenCapSrcClass * klass)
{
/* Set src element inital values... */
GstPad *src_pad = GST_BASE_SRC_PAD (src);
gst_pad_set_fixatecaps_function (src_pad, gst_gdiscreencapsrc_fixate);
src->frames = 0;
src->dibMem = NULL;
src->hBitmap = (HBITMAP) INVALID_HANDLE_VALUE;
src->memDC = (HDC) INVALID_HANDLE_VALUE;
src->capture_x = 0;
src->capture_y = 0;
src->capture_w = 0;
src->capture_h = 0;
src->monitor = 0;
src->show_cursor = FALSE;
gst_base_src_set_format (GST_BASE_SRC (src), GST_FORMAT_TIME);
gst_base_src_set_live (GST_BASE_SRC (src), TRUE);
}
示例11: gst_app_src_set_property
static void
gst_app_src_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstAppSrc *appsrc = GST_APP_SRC_CAST (object);
GstAppSrcPrivate *priv = appsrc->priv;
switch (prop_id) {
case PROP_CAPS:
gst_app_src_set_caps (appsrc, gst_value_get_caps (value));
break;
case PROP_SIZE:
gst_app_src_set_size (appsrc, g_value_get_int64 (value));
break;
case PROP_STREAM_TYPE:
gst_app_src_set_stream_type (appsrc, g_value_get_enum (value));
break;
case PROP_MAX_BYTES:
gst_app_src_set_max_bytes (appsrc, g_value_get_uint64 (value));
break;
case PROP_FORMAT:
priv->format = g_value_get_enum (value);
break;
case PROP_BLOCK:
priv->block = g_value_get_boolean (value);
break;
case PROP_IS_LIVE:
gst_base_src_set_live (GST_BASE_SRC (appsrc),
g_value_get_boolean (value));
break;
case PROP_MIN_LATENCY:
gst_app_src_set_latencies (appsrc, TRUE, g_value_get_int64 (value),
FALSE, -1);
break;
case PROP_MAX_LATENCY:
gst_app_src_set_latencies (appsrc, FALSE, -1, TRUE,
g_value_get_int64 (value));
break;
case PROP_EMIT_SIGNALS:
gst_app_src_set_emit_signals (appsrc, g_value_get_boolean (value));
break;
case PROP_MIN_PERCENT:
priv->min_percent = g_value_get_uint (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
示例12: gst_rpi_cam_src_init
static void
gst_rpi_cam_src_init (GstRpiCamSrc * src)
{
GstColorBalanceChannel *channel;
gst_base_src_set_format (GST_BASE_SRC (src), GST_FORMAT_TIME);
gst_base_src_set_live (GST_BASE_SRC (src), TRUE);
raspicapture_default_config (&src->capture_config);
src->capture_config.intraperiod = KEYFRAME_INTERVAL_DEFAULT;
src->capture_config.verbose = 1;
g_mutex_init (&src->config_lock);
/* Don't let basesrc set timestamps, we'll do it using
* buffer PTS and system times */
gst_base_src_set_do_timestamp (GST_BASE_SRC (src), FALSE);
/* Generate the channels list */
channel = g_object_new (GST_TYPE_COLOR_BALANCE_CHANNEL, NULL);
channel->label = g_strdup ("CONTRAST");
channel->min_value = -100;
channel->max_value = 100;
src->channels = g_list_append (src->channels, channel);
channel = g_object_new (GST_TYPE_COLOR_BALANCE_CHANNEL, NULL);
channel->label = g_strdup ("BRIGHTNESS");
channel->min_value = 0;
channel->max_value = 100;
src->channels = g_list_append (src->channels, channel);
channel = g_object_new (GST_TYPE_COLOR_BALANCE_CHANNEL, NULL);
channel->label = g_strdup ("SATURATION");
channel->min_value = -100;
channel->max_value = 100;
src->channels = g_list_append (src->channels, channel);
}
示例13: gst_rtmp_src_init
static void
gst_rtmp_src_init (GstRTMPSrc * rtmpsrc)
{
#ifdef G_OS_WIN32
WSADATA wsa_data;
if (WSAStartup (MAKEWORD (2, 2), &wsa_data) != 0) {
GST_ERROR_OBJECT (rtmpsrc, "WSAStartup failed: 0x%08x", WSAGetLastError ());
}
#endif
rtmpsrc->cur_offset = 0;
rtmpsrc->last_timestamp = 0;
gst_base_src_set_format (GST_BASE_SRC (rtmpsrc), GST_FORMAT_TIME);
}
示例14: gst_espeak_init
/* initialize the new element
* instantiate pads and add them to element
* set pad calback functions
* initialize instance structure
*/
static void gst_espeak_init (GstEspeak * self, GstEspeakClass * gclass) {
self->text = NULL;
self->pitch = 0;
self->rate = 0;
self->voice = g_strdup (ESPEAK_DEFAULT_VOICE);
self->voices = espeak_get_voices ();
self->speak = espeak_new (GST_ELEMENT (self));
self->caps = gst_caps_new_simple ("audio/x-raw-int",
"rate", G_TYPE_INT, espeak_get_sample_rate (),
"channels", G_TYPE_INT, 1,
"endianness", G_TYPE_INT, G_BYTE_ORDER,
"width", G_TYPE_INT, 16,
"depth", G_TYPE_INT, 16, "signed", G_TYPE_BOOLEAN, TRUE, NULL);
gst_base_src_set_format (GST_BASE_SRC (self), GST_FORMAT_DEFAULT);
}
示例15: gst_mms_query
/* FIXME operating in TIME rather than BYTES could remove this altogether
* and be more convenient elsewhere */
static gboolean
gst_mms_query (GstBaseSrc * src, GstQuery * query)
{
GstMMS *mmssrc = GST_MMS (src);
gboolean res = TRUE;
GstFormat format;
gint64 value;
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_POSITION:
gst_query_parse_position (query, &format, &value);
if (format != GST_FORMAT_BYTES) {
res = FALSE;
break;
}
value = (gint64) mmsx_get_current_pos (mmssrc->connection);
gst_query_set_position (query, format, value);
break;
case GST_QUERY_DURATION:
if (!mmsx_get_seekable (mmssrc->connection)) {
res = FALSE;
break;
}
gst_query_parse_duration (query, &format, &value);
switch (format) {
case GST_FORMAT_BYTES:
value = (gint64) mmsx_get_length (mmssrc->connection);
gst_query_set_duration (query, format, value);
break;
case GST_FORMAT_TIME:
value = mmsx_get_time_length (mmssrc->connection) * GST_SECOND;
gst_query_set_duration (query, format, value);
break;
default:
res = FALSE;
}
break;
default:
/* chain to parent */
res =
GST_BASE_SRC_CLASS (parent_class)->query (GST_BASE_SRC (src), query);
break;
}
return res;
}