[longomatch] Handle better Direct Show capture source



commit 6e4ccf4de8255e2f115b72780aefdbaace528ed7
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Thu Jul 22 02:19:47 2010 +0200

    Handle better Direct Show capture source
    
    This should be replaced once we can get list devices with a full info, like
    supported output caps.

 CesarPlayer/Common/Enum.cs                       |    1 +
 LongoMatch/Gui/Component/ProjectDetailsWidget.cs |   11 ++++++++---
 libcesarplayer/src/gst-camera-capturer.c         |   18 +++++++-----------
 libcesarplayer/src/gst-camera-capturer.h         |    3 ++-
 4 files changed, 18 insertions(+), 15 deletions(-)
---
diff --git a/CesarPlayer/Common/Enum.cs b/CesarPlayer/Common/Enum.cs
index ffafa01..6331834 100644
--- a/CesarPlayer/Common/Enum.cs
+++ b/CesarPlayer/Common/Enum.cs
@@ -163,5 +163,6 @@ namespace LongoMatch.Video.Common
 		None,
 		DV,
 		Raw,
+		DShow
 	}
 }
diff --git a/LongoMatch/Gui/Component/ProjectDetailsWidget.cs b/LongoMatch/Gui/Component/ProjectDetailsWidget.cs
index 77179fd..739c11e 100644
--- a/LongoMatch/Gui/Component/ProjectDetailsWidget.cs
+++ b/LongoMatch/Gui/Component/ProjectDetailsWidget.cs
@@ -238,10 +238,15 @@ namespace LongoMatch.Gui.Component
 				s.OutputFile = fileEntry.Text;
 				s.AudioBitrate = (uint)audiobitratespinbutton.Value;
 				s.VideoBitrate = (uint)videobitratespinbutton.Value;
-				if (videoDevices[devicecombobox.Active].DeviceType == DeviceType.DV)
-					s.CaptureSourceType = CaptureSourceType.DV;
-				else 
+				if (videoDevices[devicecombobox.Active].DeviceType == DeviceType.DV){
+					if (Environment.OSVersion.Platform == PlatformID.Win32NT)
+						s.CaptureSourceType = CaptureSourceType.DShow;
+					else
+						s.CaptureSourceType = CaptureSourceType.DV;
+				}
+				else {
 					s.CaptureSourceType = CaptureSourceType.Raw;
+				}
 				s.DeviceID = videoDevices[devicecombobox.Active].ID;
 				/* Get size info */
 				switch (sizecombobox.ActiveText){
diff --git a/libcesarplayer/src/gst-camera-capturer.c b/libcesarplayer/src/gst-camera-capturer.c
index 22a3686..4da8b78 100644
--- a/libcesarplayer/src/gst-camera-capturer.c
+++ b/libcesarplayer/src/gst-camera-capturer.c
@@ -986,9 +986,8 @@ gst_camera_capture_create_dv1394_source_bin (GstCameraCapturer * gcc)
   return bin;
 }
 
-#ifdef WIN32
 static GstElement *
-gst_camera_capture_create_source_bin (GstCameraCapturer * gcc)
+gst_camera_capture_create_dshow_source_bin (GstCameraCapturer * gcc)
 {
   GstElement *bin;
   GstElement *source;
@@ -1022,7 +1021,6 @@ gst_camera_capture_create_source_bin (GstCameraCapturer * gcc)
 
   return bin;
 }
-#endif
 
 gboolean
 gst_camera_capturer_set_source (GstCameraCapturer * gcc,
@@ -1040,26 +1038,24 @@ gst_camera_capturer_set_source (GstCameraCapturer * gcc,
   switch (gcc->priv->source_type) {
     case GST_CAMERA_CAPTURE_SOURCE_TYPE_DV:
     {
-#ifdef WIN32
-      gcc->priv->videosrc = gst_camera_capture_create_source_bin (gcc);
-#else
       gcc->priv->videosrc = gst_camera_capture_create_dv1394_source_bin (gcc);
-#endif
+      /*gcc->priv->audiosrc = gcc->priv->videosrc; */
+      break;
+    }
+    case GST_CAMERA_CAPTURE_SOURCE_TYPE_DSHOW:
+    {
+      gcc->priv->videosrc = gst_camera_capture_create_dshow_source_bin (gcc);
       /*gcc->priv->audiosrc = gcc->priv->videosrc; */
       break;
     }
     case GST_CAMERA_CAPTURE_SOURCE_TYPE_RAW:
     default:
     {
-#ifdef WIN32
-      gcc->priv->videosrc = gst_camera_capture_create_source_bin (gcc);
-#else
       gchar *bin =
           g_strdup_printf ("%s ! videorate ! ffmpegcolorspace ! videoscale",
           RAWVIDEOSRC);
       gcc->priv->videosrc = gst_parse_bin_from_description (bin, TRUE, err);
       gcc->priv->audiosrc = gst_element_factory_make (AUDIOSRC, "audiosource");
-#endif
       break;
     }
   }
diff --git a/libcesarplayer/src/gst-camera-capturer.h b/libcesarplayer/src/gst-camera-capturer.h
index 64c984b..40c98ae 100644
--- a/libcesarplayer/src/gst-camera-capturer.h
+++ b/libcesarplayer/src/gst-camera-capturer.h
@@ -67,7 +67,8 @@ typedef enum
 {
   GST_CAMERA_CAPTURE_SOURCE_TYPE_NONE = 0,
   GST_CAMERA_CAPTURE_SOURCE_TYPE_DV = 1,
-  GST_CAMERA_CAPTURE_SOURCE_TYPE_RAW = 2
+  GST_CAMERA_CAPTURE_SOURCE_TYPE_RAW = 2,
+  GST_CAMERA_CAPTURE_SOURCE_TYPE_DSHOW = 3
 } GstCameraCaptureSourceType;
 
 EXPORT GType



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]