[longomatch] Add support for declinkvideosrc in OSX
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Add support for declinkvideosrc in OSX
- Date: Mon, 27 Apr 2015 22:21:02 +0000 (UTC)
commit 8054e32b9e79121b30d3de13f82a8a18d74ac0e4
Author: Josep Torra <n770galaxy gmail com>
Date: Fri Apr 24 08:42:17 2015 +0200
Add support for declinkvideosrc in OSX
LongoMatch.Multimedia/Utils/Devices.cs | 16 ++++++++--------
libcesarplayer/gst-camera-capturer.c | 17 +++++++++++------
libcesarplayer/lgm-device.c | 32 +++++++++++++++++++++-----------
3 files changed, 40 insertions(+), 25 deletions(-)
---
diff --git a/LongoMatch.Multimedia/Utils/Devices.cs b/LongoMatch.Multimedia/Utils/Devices.cs
index 1ce7b51..b033307 100644
--- a/LongoMatch.Multimedia/Utils/Devices.cs
+++ b/LongoMatch.Multimedia/Utils/Devices.cs
@@ -1,20 +1,20 @@
-//
+//
// Copyright (C) 2011 Andoni Morales Alastruey
-//
+//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
+//
using System.Collections.Generic;
using System.Text.RegularExpressions;
using LongoMatch.Core.Common;
@@ -42,7 +42,7 @@ namespace LongoMatch.Multimedia.Utils
static extern IntPtr lgm_device_video_format_get_info (IntPtr raw, out int width, out int
height,
out int fps_n, out int fps_d);
- static readonly string[] devices_osx = new string[1] { "avfvideosrc" };
+ static readonly string[] devices_osx = new string[2] { "avfvideosrc", "decklinkvideosrc" };
static readonly string[] devices_win = new string[2] { "ksvideosrc", "dshowvideosrc" };
static readonly string[] devices_lin = new string[2] { "v4l2src", "dv1394src" };
@@ -61,7 +61,7 @@ namespace LongoMatch.Multimedia.Utils
foreach (string source in devices) {
GLib.List devices_raw = new GLib.List (lgm_device_enum_video_devices (source),
typeof(IntPtr), true, false);
-
+
foreach (IntPtr device_raw in devices_raw) {
/* The Direct Show GStreamer element seems to have problems with the
* BlackMagic DeckLink cards, so filter them out. They are also
@@ -70,7 +70,7 @@ namespace LongoMatch.Multimedia.Utils
Regex.Match (source, ".*blackmagic.*|.*decklink.*",
RegexOptions.IgnoreCase).Success) {
continue;
}
-
+
Device device = new Device ();
device.DeviceType = CaptureSourceType.System;
device.SourceElement = source;
diff --git a/libcesarplayer/gst-camera-capturer.c b/libcesarplayer/gst-camera-capturer.c
index 23b7930..e76f01a 100644
--- a/libcesarplayer/gst-camera-capturer.c
+++ b/libcesarplayer/gst-camera-capturer.c
@@ -2,19 +2,19 @@
/*
* Gstreamer DV capturer
* Copyright (C) Andoni Morales Alastruey 2008 <ylatuya gmail com>
-*
+*
* Gstreamer DV capturer is free software.
-*
+*
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
-*
+*
* Gstreamer DV is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
-*
+*
* You should have received a copy of the GNU General Public License
* along with foob. If not, write to:
* The Free Software Foundation, Inc.,
@@ -312,8 +312,13 @@ gst_camera_capturer_update_device_id (GstCameraCapturer * gcc)
else
prop_name = "device-name";
- if (prop_name)
- g_object_set (gcc->priv->source, prop_name, gcc->priv->device_id, NULL);
+ if (!g_strcmp0 (gcc->priv->source_element_name, "decklinkvideosrc")) {
+ g_object_set (gcc->priv->source, "device-number", atoi(gcc->priv->device_id),
+ NULL);
+ } else {
+ if (prop_name)
+ g_object_set (gcc->priv->source, prop_name, gcc->priv->device_id, NULL);
+ }
}
static gboolean
diff --git a/libcesarplayer/lgm-device.c b/libcesarplayer/lgm-device.c
index 06a886b..6e6420a 100644
--- a/libcesarplayer/lgm-device.c
+++ b/libcesarplayer/lgm-device.c
@@ -235,7 +235,11 @@ lgm_device_fill_formats (LgmDevice *device, gchar *prop_name)
gint i;
source = gst_element_factory_make (device->source_name, NULL);
- g_object_set (source, prop_name, device->device_name, NULL);
+ if (!g_strcmp0 (device->source_name, "decklinkvideosrc")) {
+ g_object_set (source, prop_name, 0, NULL);
+ } else {
+ g_object_set (source, prop_name, device->device_name, NULL);
+ }
gst_element_set_state (source, GST_STATE_READY);
gst_element_get_state (source, NULL, NULL, 5 * GST_SECOND);
pad = gst_element_get_static_pad (source, "src");
@@ -248,16 +252,20 @@ lgm_device_fill_formats (LgmDevice *device, gchar *prop_name)
GST_DEBUG ("Filling formats for source:%s device:%s", device->source_name,
device->device_name);
- for (i=0; i < gst_caps_get_size (caps); i++) {
- GstStructure *s;
-
- s = gst_caps_get_structure (caps, i);
- if (gst_structure_has_name (s, "video/x-raw-yuv") ||
- gst_structure_has_name (s, "video/x-raw-rgb") ||
- gst_structure_has_name (s, "video/x-dv")) {
- lgm_device_parse_structure (s, table);
- } else if (gst_structure_has_name (s, "video/x-dv")) {
- lgm_device_add_format (table, 0, 0, 0, 0);
+ if (!g_strcmp0 (device->source_name, "decklinkvideosrc")) {
+ lgm_device_add_format (table, 0, 0, 0, 0);
+ } else {
+ for (i=0; i < gst_caps_get_size (caps); i++) {
+ GstStructure *s;
+
+ s = gst_caps_get_structure (caps, i);
+ if (gst_structure_has_name (s, "video/x-raw-yuv") ||
+ gst_structure_has_name (s, "video/x-raw-rgb") ||
+ gst_structure_has_name (s, "video/x-dv")) {
+ lgm_device_parse_structure (s, table);
+ } else if (gst_structure_has_name (s, "video/x-dv")) {
+ lgm_device_add_format (table, 0, 0, 0, 0);
+ }
}
}
device->formats = g_hash_table_get_values (table);
@@ -294,6 +302,8 @@ lgm_device_enum_devices (const gchar * source_name,
else if (!g_strcmp0 (source_name, "v4l2src") ||
!g_strcmp0 (source_name, "avfvideosrc"))
prop_name = "device";
+ else if (!g_strcmp0 (source_name, "decklinkvideosrc"))
+ prop_name = "device-number";
else if (!g_strcmp0 (source_name, "filesrc"))
prop_name = "location";
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]