本文整理汇总了C++中GST_V4L2_IS_OPEN函数的典型用法代码示例。如果您正苦于以下问题:C++ GST_V4L2_IS_OPEN函数的具体用法?C++ GST_V4L2_IS_OPEN怎么用?C++ GST_V4L2_IS_OPEN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GST_V4L2_IS_OPEN函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gst_v4l2_video_dec_open
static gboolean
gst_v4l2_video_dec_open (GstVideoDecoder * decoder)
{
GstV4l2VideoDec *self = GST_V4L2_VIDEO_DEC (decoder);
GST_DEBUG_OBJECT (self, "Opening");
if (!gst_v4l2_object_open (self->v4l2output))
goto failure;
if (!gst_v4l2_object_open_shared (self->v4l2capture, self->v4l2output))
goto failure;
self->probed_sinkcaps = gst_v4l2_object_get_caps (self->v4l2output,
gst_v4l2_object_get_codec_caps ());
if (gst_caps_is_empty (self->probed_sinkcaps))
goto no_encoded_format;
self->probed_srccaps = gst_v4l2_object_get_caps (self->v4l2capture,
gst_v4l2_object_get_raw_caps ());
if (gst_caps_is_empty (self->probed_srccaps))
goto no_raw_format;
return TRUE;
no_encoded_format:
GST_ELEMENT_ERROR (self, RESOURCE, SETTINGS,
(_("Encoder on device %s has no supported input format"),
self->v4l2output->videodev), (NULL));
goto failure;
no_raw_format:
GST_ELEMENT_ERROR (self, RESOURCE, SETTINGS,
(_("Encoder on device %s has no supported output format"),
self->v4l2output->videodev), (NULL));
goto failure;
failure:
if (GST_V4L2_IS_OPEN (self->v4l2output))
gst_v4l2_object_close (self->v4l2output);
if (GST_V4L2_IS_OPEN (self->v4l2capture))
gst_v4l2_object_close (self->v4l2capture);
gst_caps_replace (&self->probed_srccaps, NULL);
gst_caps_replace (&self->probed_sinkcaps, NULL);
return FALSE;
}
示例2: gst_v4l2src_get_caps
static GstCaps *
gst_v4l2src_get_caps (GstBaseSrc * src)
{
GstV4l2Src *v4l2src = GST_V4L2SRC (src);
GstCaps *ret;
GSList *walk;
GSList *formats;
if (!GST_V4L2_IS_OPEN (v4l2src->v4l2object)) {
/* FIXME: copy? */
return
gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_SRC_PAD
(v4l2src)));
}
if (v4l2src->probed_caps)
return gst_caps_ref (v4l2src->probed_caps);
formats = gst_v4l2_object_get_format_list (v4l2src->v4l2object);
ret = gst_caps_new_empty ();
for (walk = formats; walk; walk = walk->next) {
struct v4l2_fmtdesc *format;
GstStructure *template;
示例3: gst_v4l2src_capture_stop
/******************************************************
* gst_v4l2src_capture_stop():
* stop streaming capture
* return value: TRUE on success, FALSE on error
******************************************************/
gboolean
gst_v4l2src_capture_stop (GstV4l2Src * v4l2src)
{
GST_DEBUG_OBJECT (v4l2src, "stopping capturing");
if (!GST_V4L2_IS_OPEN (v4l2src->v4l2object)) {
goto done;
}
if (!GST_V4L2_IS_ACTIVE (v4l2src->v4l2object)) {
goto done;
}
if (v4l2src->use_mmap) {
/* we actually need to sync on all queued buffers but not
* on the non-queued ones */
if (!gst_v4l2_object_stop_streaming (v4l2src->v4l2object)) {
return FALSE;
}
}
done:
/* make an optional pending wait stop */
v4l2src->quit = TRUE;
v4l2src->is_capturing = FALSE;
return TRUE;
}
示例4: gst_v4l2src_get_caps
static GstCaps *
gst_v4l2src_get_caps (GstBaseSrc * src, GstCaps * filter)
{
GstV4l2Src *v4l2src;
GstV4l2Object *obj;
GstCaps *ret;
GSList *walk;
GSList *formats;
v4l2src = GST_V4L2SRC (src);
obj = v4l2src->v4l2object;
if (!GST_V4L2_IS_OPEN (obj)) {
return gst_pad_get_pad_template_caps (GST_BASE_SRC_PAD (v4l2src));
}
if (v4l2src->probed_caps)
return gst_caps_ref (v4l2src->probed_caps);
formats = gst_v4l2_object_get_format_list (obj);
ret = gst_caps_new_empty ();
for (walk = formats; walk; walk = walk->next) {
struct v4l2_fmtdesc *format;
GstStructure *template;
示例5: gst_v4l2sink_sync_overlay_fields
static void
gst_v4l2sink_sync_overlay_fields (GstV4l2Sink * v4l2sink)
{
if (GST_V4L2_IS_OPEN (v4l2sink->v4l2object)) {
gint fd = v4l2sink->v4l2object->video_fd;
struct v4l2_format format;
memset (&format, 0x00, sizeof (struct v4l2_format));
format.type = V4L2_BUF_TYPE_VIDEO_OVERLAY;
g_return_if_fail (v4l2_ioctl (fd, VIDIOC_G_FMT, &format) >= 0);
if (v4l2sink->overlay_fields_set) {
if (v4l2sink->overlay_fields_set & OVERLAY_TOP_SET)
format.fmt.win.w.top = v4l2sink->overlay.top;
if (v4l2sink->overlay_fields_set & OVERLAY_LEFT_SET)
format.fmt.win.w.left = v4l2sink->overlay.left;
if (v4l2sink->overlay_fields_set & OVERLAY_WIDTH_SET)
format.fmt.win.w.width = v4l2sink->overlay.width;
if (v4l2sink->overlay_fields_set & OVERLAY_HEIGHT_SET)
format.fmt.win.w.height = v4l2sink->overlay.height;
g_return_if_fail (v4l2_ioctl (fd, VIDIOC_S_FMT, &format) >= 0);
v4l2sink->overlay_fields_set = 0;
}
v4l2sink->overlay = format.fmt.win.w;
}
}
示例6: gst_v4l2_tuner_set_frequency
gboolean
gst_v4l2_tuner_set_frequency (GstV4l2Object * v4l2object,
GstTunerChannel * channel, gulong frequency)
{
GstV4l2TunerChannel *v4l2channel = GST_V4L2_TUNER_CHANNEL (channel);
gint chan;
/* assert that we're opened and that we're using a known item */
g_return_val_if_fail (GST_V4L2_IS_OPEN (v4l2object), FALSE);
g_return_val_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel,
GST_TUNER_CHANNEL_FREQUENCY), FALSE);
g_return_val_if_fail (gst_v4l2_tuner_contains_channel (v4l2object,
v4l2channel), FALSE);
if (v4l2object->get_in_out_func (v4l2object, &chan)) {
if (chan == GST_V4L2_TUNER_CHANNEL (channel)->index &&
GST_TUNER_CHANNEL_HAS_FLAG (channel, GST_TUNER_CHANNEL_FREQUENCY)) {
if (gst_v4l2_set_frequency (v4l2object, v4l2channel->tuner, frequency)) {
gst_tuner_frequency_changed (GST_TUNER (v4l2object->element), channel,
frequency);
return TRUE;
}
}
}
return FALSE;
}
示例7: gst_v4l2_get_input
gboolean
gst_v4l2_get_input (GstV4l2Object * v4l2object, gint * input)
{
gint n;
GST_DEBUG_OBJECT (v4l2object->element, "trying to get input");
if (!GST_V4L2_IS_OPEN (v4l2object))
return FALSE;
if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_G_INPUT, &n) < 0)
goto input_failed;
*input = n;
GST_DEBUG_OBJECT (v4l2object->element, "input: %d", n);
return TRUE;
/* ERRORS */
input_failed:
{
GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS,
(_("Failed to get current input on device '%s'. May be it is a radio device"), v4l2object->videodev), GST_ERROR_SYSTEM);
return FALSE;
}
}
示例8: gst_v4l2sink_get_caps
static GstCaps *
gst_v4l2sink_get_caps (GstBaseSink * bsink)
{
GstV4l2Sink *v4l2sink = GST_V4L2SINK (bsink);
GstCaps *ret;
GSList *walk;
GSList *formats;
if (!GST_V4L2_IS_OPEN (v4l2sink->v4l2object)) {
/* FIXME: copy? */
GST_DEBUG_OBJECT (v4l2sink, "device is not open");
return
gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_SINK_PAD
(v4l2sink)));
}
if (v4l2sink->probed_caps) {
LOG_CAPS (v4l2sink, v4l2sink->probed_caps);
return gst_caps_ref (v4l2sink->probed_caps);
}
formats = gst_v4l2_object_get_format_list (v4l2sink->v4l2object);
ret = gst_caps_new_empty ();
for (walk = v4l2sink->v4l2object->formats; walk; walk = walk->next) {
struct v4l2_fmtdesc *format;
GstStructure *template;
示例9: gst_v4l2_signal_strength
/******************************************************
* gst_v4l2_signal_strength():
* get the strength of the signal on the current input
* return value: TRUE on success, FALSE on error
******************************************************/
gboolean
gst_v4l2_signal_strength (GstV4l2Object * v4l2object,
gint tunernum, gulong * signal_strength)
{
struct v4l2_tuner tuner = { 0, };
GST_DEBUG_OBJECT (v4l2object->element, "trying to get signal strength");
if (!GST_V4L2_IS_OPEN (v4l2object))
return FALSE;
tuner.index = tunernum;
if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_G_TUNER, &tuner) < 0)
goto tuner_failed;
*signal_strength = tuner.signal;
return TRUE;
/* ERRORS */
tuner_failed:
{
GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS,
(_("Failed to get signal strength for device '%s'."),
v4l2object->videodev), GST_ERROR_SYSTEM);
return FALSE;
}
}
示例10: gst_v4l2_set_attribute
/******************************************************
* gst_v4l2_set_attribute():
* try to set the value of one specific attribute
* return value: TRUE on success, FALSE on error
******************************************************/
gboolean
gst_v4l2_set_attribute (GstV4l2Object * v4l2object,
int attribute_num, const int value)
{
struct v4l2_control control = { 0, };
GST_DEBUG_OBJECT (v4l2object->element, "setting value of attribute %d to %d",
attribute_num, value);
if (!GST_V4L2_IS_OPEN (v4l2object))
return FALSE;
control.id = attribute_num;
control.value = value;
if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_S_CTRL, &control) < 0)
goto ctrl_failed;
return TRUE;
/* ERRORS */
ctrl_failed:
{
GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS,
(_("Failed to set value %d for control %d on device '%s'."),
value, attribute_num, v4l2object->videodev), GST_ERROR_SYSTEM);
return FALSE;
}
}
示例11: gst_v4l2_get_capabilities
/******************************************************
* gst_v4l2_get_capabilities():
* get the device's capturing capabilities
* return value: TRUE on success, FALSE on error
******************************************************/
gboolean
gst_v4l2_get_capabilities (GstV4l2Object * v4l2object)
{
GstElement *e;
e = v4l2object->element;
GST_DEBUG_OBJECT (e, "getting capabilities");
if (!GST_V4L2_IS_OPEN (v4l2object))
return FALSE;
if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_QUERYCAP, &v4l2object->vcap) < 0)
goto cap_failed;
GST_LOG_OBJECT (e, "driver: '%s'", v4l2object->vcap.driver);
GST_LOG_OBJECT (e, "card: '%s'", v4l2object->vcap.card);
GST_LOG_OBJECT (e, "bus_info: '%s'", v4l2object->vcap.bus_info);
GST_LOG_OBJECT (e, "version: %08x", v4l2object->vcap.version);
GST_LOG_OBJECT (e, "capabilites: %08x", v4l2object->vcap.capabilities);
return TRUE;
/* ERRORS */
cap_failed:
{
GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, SETTINGS,
(_("Error getting capabilities for device '%s': "
"It isn't a v4l2 driver. Check if it is a v4l1 driver."),
v4l2object->videodev), GST_ERROR_SYSTEM);
return FALSE;
}
}
示例12: gst_v4l2_set_frequency
/******************************************************
* gst_v4l2_set_frequency():
* set frequency
* return value: TRUE on success, FALSE on error
******************************************************/
gboolean
gst_v4l2_set_frequency (GstV4l2Object * v4l2object,
gint tunernum, gulong frequency)
{
struct v4l2_frequency freq = { 0, };
GstTunerChannel *channel;
GST_DEBUG_OBJECT (v4l2object->element,
"setting current tuner frequency to %lu", frequency);
if (!GST_V4L2_IS_OPEN (v4l2object))
return FALSE;
channel = gst_tuner_get_channel (GST_TUNER (v4l2object->element));
freq.tuner = tunernum;
/* fill in type - ignore error */
v4l2_ioctl (v4l2object->video_fd, VIDIOC_G_FREQUENCY, &freq);
freq.frequency = frequency / channel->freq_multiplicator;
if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_S_FREQUENCY, &freq) < 0)
goto freq_failed;
return TRUE;
/* ERRORS */
freq_failed:
{
GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS,
(_("Failed to set current tuner frequency for device '%s' to %lu Hz."),
v4l2object->videodev, frequency), GST_ERROR_SYSTEM);
return FALSE;
}
}
示例13: gst_v4l2_set_output
gboolean
gst_v4l2_set_output (GstV4l2Object * v4l2object, gint output)
{
GST_DEBUG_OBJECT (v4l2object->element, "trying to set output to %d", output);
if (!GST_V4L2_IS_OPEN (v4l2object))
return FALSE;
if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_S_OUTPUT, &output) < 0)
goto output_failed;
return TRUE;
/* ERRORS */
output_failed:
if (v4l2object->vcap.capabilities & V4L2_CAP_TUNER) {
/* only give a warning message if driver actually claims to have tuner
* support
*/
GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS,
(_("Failed to set output %d on device %s."),
output, v4l2object->videodev), GST_ERROR_SYSTEM);
}
return FALSE;
}
示例14: gst_v4l2_get_output
gboolean
gst_v4l2_get_output (GstV4l2Object * v4l2object, gint * output)
{
gint n;
GST_DEBUG_OBJECT (v4l2object->element, "trying to get output");
if (!GST_V4L2_IS_OPEN (v4l2object))
return FALSE;
if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_G_OUTPUT, &n) < 0)
goto output_failed;
*output = n;
GST_DEBUG_OBJECT (v4l2object->element, "output: %d", n);
return TRUE;
/* ERRORS */
output_failed:
if (v4l2object->vcap.capabilities & V4L2_CAP_TUNER) {
/* only give a warning message if driver actually claims to have tuner
* support
*/
GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS,
(_("Failed to get current output on device '%s'. May be it is a radio device"), v4l2object->videodev), GST_ERROR_SYSTEM);
}
return FALSE;
}
示例15: gst_v4l2_decoder_cmd
static gboolean
gst_v4l2_decoder_cmd (GstV4l2Object * v4l2object, guint cmd, guint flags)
{
struct v4l2_decoder_cmd dcmd = { 0, };
GST_DEBUG_OBJECT (v4l2object->element,
"sending v4l2 decoder command %u with flags %u", cmd, flags);
if (!GST_V4L2_IS_OPEN (v4l2object))
return FALSE;
dcmd.cmd = cmd;
dcmd.flags = flags;
if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_DECODER_CMD, &dcmd) < 0)
goto dcmd_failed;
return TRUE;
dcmd_failed:
if (errno == ENOTTY) {
GST_INFO_OBJECT (v4l2object->element,
"Failed to send decoder command %u with flags %u for '%s'. (%s)",
cmd, flags, v4l2object->videodev, g_strerror (errno));
} else {
GST_ERROR_OBJECT (v4l2object->element,
"Failed to send decoder command %u with flags %u for '%s'. (%s)",
cmd, flags, v4l2object->videodev, g_strerror (errno));
}
return FALSE;
}