dshowsrcwrapper: convert line ended characters to LF
authorJulien Isorce <julien.isorce@gmail.com>
Mon, 7 Sep 2009 08:51:28 +0000 (10:51 +0200)
committerJulien Isorce <julien.isorce@gmail.com>
Mon, 7 Sep 2009 08:51:28 +0000 (10:51 +0200)
sys/dshowsrcwrapper/gstdshow.cpp
sys/dshowsrcwrapper/gstdshowaudiosrc.cpp
sys/dshowsrcwrapper/gstdshowvideosrc.cpp

index f3afb73..e03cb4c 100644 (file)
 #include "gstdshow.h"
 #include "gstdshowfakesink.h"
 
-void 
+void
 gst_dshow_free_mediatype (AM_MEDIA_TYPE *pmt)
 {
-  if (pmt != NULL) {    
+  if (pmt != NULL) {
     if (pmt->cbFormat != 0) {
       CoTaskMemFree((PVOID)pmt->pbFormat);
       pmt->cbFormat = 0;
@@ -41,7 +41,7 @@ gst_dshow_free_mediatype (AM_MEDIA_TYPE *pmt)
   }
 }
 
-void 
+void
 gst_dshow_free_pin_mediatype (gpointer pt)
 {
   GstCapturePinMediaType * pin_mediatype = (GstCapturePinMediaType *) pt;
@@ -57,7 +57,7 @@ gst_dshow_free_pin_mediatype (gpointer pt)
   }
 }
 
-GstCapturePinMediaType * 
+GstCapturePinMediaType *
 gst_dshow_new_pin_mediatype (IPin *pin, gint id, IAMStreamConfig * streamcaps)
 {
   GstCapturePinMediaType *pin_mediatype = g_new0 (GstCapturePinMediaType, 1);
@@ -74,7 +74,7 @@ gst_dshow_new_pin_mediatype (IPin *pin, gint id, IAMStreamConfig * streamcaps)
   return pin_mediatype;
 }
 
-void 
+void
 gst_dshow_free_pins_mediatypes (GList *pins_mediatypes)
 {
   guint i = 0;
@@ -87,27 +87,27 @@ gst_dshow_free_pins_mediatypes (GList *pins_mediatypes)
 }
 
 gboolean
-gst_dshow_check_mediatype (AM_MEDIA_TYPE *media_type, const GUID sub_type, 
+gst_dshow_check_mediatype (AM_MEDIA_TYPE *media_type, const GUID sub_type,
   const GUID format_type)
 {
   RPC_STATUS rpcstatus;
-  
+
   g_return_val_if_fail (media_type != NULL, FALSE);
-  
-  return 
+
+  return
     UuidCompare (&media_type->subtype, (UUID *) &sub_type,
     &rpcstatus) == 0 && rpcstatus == RPC_S_OK &&
     UuidCompare (&media_type->formattype, (UUID *) &format_type,
     &rpcstatus) == 0 && rpcstatus == RPC_S_OK;
 }
 
-gboolean 
+gboolean
 gst_dshow_get_pin_from_filter (IBaseFilter *filter, PIN_DIRECTION pindir, IPin **pin)
 {
   gboolean ret = FALSE;
   IEnumPins *enumpins = NULL;
   IPin *pintmp = NULL;
-  HRESULT hres; 
+  HRESULT hres;
   *pin = NULL;
 
   hres = filter->EnumPins (&enumpins);
@@ -131,8 +131,8 @@ gst_dshow_get_pin_from_filter (IBaseFilter *filter, PIN_DIRECTION pindir, IPin *
   return ret;
 }
 
-gboolean gst_dshow_find_filter(CLSID input_majortype, CLSID input_subtype, 
-                               CLSID output_majortype, CLSID output_subtype, 
+gboolean gst_dshow_find_filter(CLSID input_majortype, CLSID input_subtype,
+                               CLSID output_majortype, CLSID output_subtype,
                                gchar * prefered_filter_name, IBaseFilter **filter)
 {
   gboolean ret = FALSE;
@@ -156,24 +156,24 @@ gboolean gst_dshow_find_filter(CLSID input_majortype, CLSID input_subtype,
     _strupr (prefered_filter_upper);
   }
 
-  hres = CoCreateInstance(CLSID_FilterMapper2, NULL, CLSCTX_INPROC, 
+  hres = CoCreateInstance(CLSID_FilterMapper2, NULL, CLSCTX_INPROC,
       IID_IFilterMapper2, (void **) &mapper);
   if (FAILED(hres))
     goto clean;
-  
+
   memcpy(&arrayInTypes[0], &input_majortype, sizeof (CLSID));
   memcpy(&arrayInTypes[1], &input_subtype, sizeof (CLSID));
   memcpy(&arrayOutTypes[0], &output_majortype, sizeof (CLSID));
   memcpy(&arrayOutTypes[1], &output_subtype, sizeof (CLSID));
 
-  hres = mapper->EnumMatchingFilters (&enum_moniker, 0, FALSE, MERIT_DO_NOT_USE+1, 
-          TRUE, 1, arrayInTypes, NULL, NULL, FALSE, 
+  hres = mapper->EnumMatchingFilters (&enum_moniker, 0, FALSE, MERIT_DO_NOT_USE+1,
+          TRUE, 1, arrayInTypes, NULL, NULL, FALSE,
           TRUE, 1, arrayOutTypes, NULL, NULL);
   if (FAILED(hres))
     goto clean;
-  
+
   enum_moniker->Reset ();
-  
+
   while(hres = enum_moniker->Next (1, &moniker, &fetched),hres == S_OK
     && !exit) {
     IBaseFilter *filter_temp = NULL;
@@ -184,11 +184,11 @@ gboolean gst_dshow_find_filter(CLSID input_majortype, CLSID input_subtype,
     if(SUCCEEDED(hres) && property_bag) {
       VARIANT varFriendlyName;
       VariantInit (&varFriendlyName);
-      
+
       hres = property_bag->Read (L"FriendlyName", &varFriendlyName, NULL);
       if(hres == S_OK && varFriendlyName.bstrVal) {
-         friendly_name = g_utf16_to_utf8((const gunichar2*)varFriendlyName.bstrVal, 
-            wcslen(varFriendlyName.bstrVal), NULL, NULL, NULL);        
+         friendly_name = g_utf16_to_utf8((const gunichar2*)varFriendlyName.bstrVal,
+            wcslen(varFriendlyName.bstrVal), NULL, NULL, NULL);
          if (friendly_name)
            _strupr (friendly_name);
         SysFreeString (varFriendlyName.bstrVal);
@@ -196,7 +196,7 @@ gboolean gst_dshow_find_filter(CLSID input_majortype, CLSID input_subtype,
       property_bag->Release ();
     }
 
-    hres = moniker->BindToObject(NULL, NULL, IID_IBaseFilter, (void**)&filter_temp);    
+    hres = moniker->BindToObject(NULL, NULL, IID_IBaseFilter, (void**)&filter_temp);
     if(SUCCEEDED(hres) && filter_temp) {
       ret = TRUE;
       if (filter) {
@@ -211,8 +211,8 @@ gboolean gst_dshow_find_filter(CLSID input_majortype, CLSID input_subtype,
           exit = TRUE;
       }
 
-      /* if we just want to know if the formats are supported OR 
-          if we don't care about what will be the filter used 
+      /* if we just want to know if the formats are supported OR
+          if we don't care about what will be the filter used
           => we can stop enumeration */
       if (!filter || !prefered_filter_upper)
         exit = TRUE;
@@ -247,7 +247,7 @@ gst_dshow_getdevice_from_devicename  (const GUID *device_category, gchar **devic
   HRESULT hres = S_FALSE;
   ULONG fetched;
   gboolean bfound = FALSE;
-  
+
   hres = CoCreateInstance (CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER,
       IID_ICreateDevEnum, (void**)&devices_enum);
   if(hres != S_OK) {
@@ -263,7 +263,7 @@ gst_dshow_getdevice_from_devicename  (const GUID *device_category, gchar **devic
   }
 
   enum_moniker->Reset ();
-  
+
   while(hres = enum_moniker->Next (1, &moniker, &fetched),hres == S_OK
     && !bfound) {
     IPropertyBag *property_bag = NULL;
@@ -271,10 +271,10 @@ gst_dshow_getdevice_from_devicename  (const GUID *device_category, gchar **devic
     if(SUCCEEDED(hres) && property_bag) {
       VARIANT varFriendlyName;
       VariantInit (&varFriendlyName);
-      
+
       hres = property_bag->Read (L"FriendlyName", &varFriendlyName, NULL);
       if(hres == S_OK && varFriendlyName.bstrVal) {
-        gchar * friendly_name = g_utf16_to_utf8((const gunichar2*)varFriendlyName.bstrVal, 
+        gchar * friendly_name = g_utf16_to_utf8((const gunichar2*)varFriendlyName.bstrVal,
             wcslen(varFriendlyName.bstrVal), NULL, NULL, NULL);
 
         if (!*device_name) {
@@ -285,7 +285,7 @@ gst_dshow_getdevice_from_devicename  (const GUID *device_category, gchar **devic
           WCHAR *wszDisplayName = NULL;
           hres = moniker->GetDisplayName (NULL, NULL, &wszDisplayName);
           if(hres == S_OK && wszDisplayName) {
-            ret = g_utf16_to_utf8((const gunichar2*)wszDisplayName, 
+            ret = g_utf16_to_utf8((const gunichar2*)wszDisplayName,
              wcslen(wszDisplayName), NULL, NULL, NULL);
             CoTaskMemFree (wszDisplayName);
           }
@@ -310,19 +310,19 @@ clean:
   return ret;
 }
 
-gboolean 
+gboolean
 gst_dshow_show_propertypage (IBaseFilter *base_filter)
 {
   gboolean ret = FALSE;
   ISpecifyPropertyPages *pProp = NULL;
   HRESULT hres = base_filter->QueryInterface (IID_ISpecifyPropertyPages, (void **)&pProp);
-  if (SUCCEEDED(hres)) 
+  if (SUCCEEDED(hres))
   {
     /* Get the filter's name and IUnknown pointer.*/
     FILTER_INFO FilterInfo;
     CAUUID caGUID;
     IUnknown *pFilterUnk = NULL;
-    hres = base_filter->QueryFilterInfo (&FilterInfo); 
+    hres = base_filter->QueryFilterInfo (&FilterInfo);
     base_filter->QueryInterface (IID_IUnknown, (void **)&pFilterUnk);
 
     /* Show the page. */
@@ -338,13 +338,13 @@ gst_dshow_show_propertypage (IBaseFilter *base_filter)
   return ret;
 }
 
-GstCaps *gst_dshow_new_video_caps (GstVideoFormat video_format, const gchar* name, 
+GstCaps *gst_dshow_new_video_caps (GstVideoFormat video_format, const gchar* name,
   GstCapturePinMediaType *pin_mediatype)
 {
   GstCaps *video_caps = NULL;
   GstStructure *video_structure = NULL;
   VIDEOINFOHEADER *video_info = (VIDEOINFOHEADER *) pin_mediatype->mediatype->pbFormat;
-  
+
   pin_mediatype->defaultWidth = video_info->bmiHeader.biWidth;
   pin_mediatype->defaultHeight = video_info->bmiHeader.biHeight;
   pin_mediatype->defaultFPS = (gint) (10000000 / video_info->AvgTimePerFrame);
@@ -365,12 +365,12 @@ GstCaps *gst_dshow_new_video_caps (GstVideoFormat video_format, const gchar* nam
   /* other video format */
   if (!video_caps){
     if (g_strcasecmp (name, "video/x-dv, systemstream=FALSE") == 0) {
-      video_caps = gst_caps_new_simple ("video/x-dv", 
+      video_caps = gst_caps_new_simple ("video/x-dv",
         "systemstream", G_TYPE_BOOLEAN, FALSE,
         "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('d', 'v', 's', 'd'),
         NULL);
     } else if (g_strcasecmp (name, "video/x-dv, systemstream=TRUE") == 0) {
-      video_caps = gst_caps_new_simple ("video/x-dv", 
+      video_caps = gst_caps_new_simple ("video/x-dv",
         "systemstream", G_TYPE_BOOLEAN, TRUE, NULL);
       return video_caps;
     }
@@ -389,12 +389,12 @@ GstCaps *gst_dshow_new_video_caps (GstVideoFormat video_format, const gchar* nam
 
   /* For framerate we do not need a step (granularity) because  */
   /* "The IAMStreamConfig::SetFormat method will set the frame rate to the closest  */
-  /* value that the filter supports" as it said in the VIDEO_STREAM_CONFIG_CAPS dshwo doc */\r
-  \r
-  gst_structure_set (video_structure,\r
-      "width", GST_TYPE_INT_RANGE, pin_mediatype->vscc.MinOutputSize.cx, pin_mediatype->vscc.MaxOutputSize.cx,\r
+  /* value that the filter supports" as it said in the VIDEO_STREAM_CONFIG_CAPS dshwo doc */
+
+  gst_structure_set (video_structure,
+      "width", GST_TYPE_INT_RANGE, pin_mediatype->vscc.MinOutputSize.cx, pin_mediatype->vscc.MaxOutputSize.cx,
       "height", GST_TYPE_INT_RANGE, pin_mediatype->vscc.MinOutputSize.cy, pin_mediatype->vscc.MaxOutputSize.cy,
-      "framerate", GST_TYPE_FRACTION_RANGE, 
+      "framerate", GST_TYPE_FRACTION_RANGE,
           (gint) (10000000 / pin_mediatype->vscc.MaxFrameInterval), 1,
           (gint) (10000000 / pin_mediatype->vscc.MinFrameInterval), 1,
        NULL);
index 99163d6..143f951 100644 (file)
@@ -1,7 +1,7 @@
 /* GStreamer
  * Copyright (C)  2007 Sebastien Moutte <sebastien@moutte.net>
  *
- * gstdshowaudiosrc.c: 
+ * gstdshowaudiosrc.c:
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -172,7 +172,7 @@ gst_dshowaudiosrc_class_init (GstDshowAudioSrcClass * klass)
   g_object_class_install_property
       (gobject_class, PROP_DEVICE_NAME,
       g_param_spec_string ("device-name", "Device name",
-          "Human-readable name of the sound device", NULL, 
+          "Human-readable name of the sound device", NULL,
           static_cast<GParamFlags>(G_PARAM_READWRITE)));
 
   GST_DEBUG_CATEGORY_INIT (dshowaudiosrc_debug, "dshowaudiosrc", 0,
@@ -278,7 +278,7 @@ gst_dshowaudiosrc_get_device_name_values (GstDshowAudioSrc * src)
     goto clean;
   }
 
-  hres = devices_enum->CreateClassEnumerator(CLSID_AudioInputDeviceCategory, 
+  hres = devices_enum->CreateClassEnumerator(CLSID_AudioInputDeviceCategory,
     &moniker_enum, 0);
   if (hres != S_OK || !moniker_enum) {
     GST_ERROR ("Can't get enumeration of audio devices (error=0x%x)", hres);
@@ -292,7 +292,7 @@ gst_dshowaudiosrc_get_device_name_values (GstDshowAudioSrc * src)
       hres == S_OK) {
     IPropertyBag *property_bag = NULL;
 
-    hres = moniker->BindToStorage(NULL, NULL, IID_IPropertyBag, 
+    hres = moniker->BindToStorage(NULL, NULL, IID_IPropertyBag,
       (LPVOID *) &property_bag);
     if (SUCCEEDED (hres) && property_bag) {
       VARIANT varFriendlyName;
@@ -304,7 +304,7 @@ gst_dshowaudiosrc_get_device_name_values (GstDshowAudioSrc * src)
             g_utf16_to_utf8 ((const gunichar2 *) varFriendlyName.bstrVal,
             wcslen (varFriendlyName.bstrVal), NULL, NULL, NULL);
 
-        GValue value = { 0 };\r
+        GValue value = { 0 };
         g_value_init (&value, G_TYPE_STRING);
         g_value_set_string (&value, friendly_name);
         g_value_array_append (array, &value);
@@ -364,16 +364,16 @@ gst_dshowaudiosrc_set_property (GObject * object, guint prop_id,
       }
       break;
     }
-    case PROP_DEVICE_NAME:\r
-    {\r
-      if (src->device_name) {\r
-        g_free (src->device_name);\r
-        src->device_name = NULL;\r
-      }\r
-      if (g_value_get_string (value)) {\r
-        src->device_name = g_strdup (g_value_get_string (value));\r
-      }\r
-      break;\r
+    case PROP_DEVICE_NAME:
+    {
+      if (src->device_name) {
+        g_free (src->device_name);
+        src->device_name = NULL;
+      }
+      if (g_value_get_string (value)) {
+        src->device_name = g_strdup (g_value_get_string (value));
+      }
+      break;
     }
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -418,7 +418,7 @@ gst_dshowaudiosrc_get_caps (GstBaseSrc * basesrc)
     if (SUCCEEDED (hres)) {
       hres = MkParseDisplayName (lpbc, (LPCOLESTR) unidevice, &dwEaten, &audiom);
       if (SUCCEEDED (hres)) {
-        hres = audiom->BindToObject(lpbc, NULL, IID_IBaseFilter, 
+        hres = audiom->BindToObject(lpbc, NULL, IID_IBaseFilter,
           (LPVOID *) &src->audio_cap_filter);
         audiom->Release();
       }
@@ -616,7 +616,7 @@ gst_dshowaudiosrc_prepare (GstAudioSrc * asrc, GstRingBufferSpec * spec)
           goto error;
         }
 
-        hres = src->filter_graph->ConnectDirect(pin_mediatype->capture_pin, 
+        hres = src->filter_graph->ConnectDirect(pin_mediatype->capture_pin,
           input_pin, NULL);
         input_pin->Release();
 
index 0984b23..1dac9b4 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C)  2007 Sebastien Moutte <sebastien@moutte.net>
  * Copyright (C)  2009 Julien Isorce <julien.isorce@gmail.com>
  *
- * gstdshowvideosrc.c: 
+ * gstdshowvideosrc.c:
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -179,13 +179,13 @@ gst_dshowvideosrc_class_init (GstDshowVideoSrcClass * klass)
   g_object_class_install_property
       (gobject_class, PROP_DEVICE,
       g_param_spec_string ("device", "Device",
-          "Directshow device path (@..classID/name)", NULL, 
+          "Directshow device path (@..classID/name)", NULL,
           static_cast<GParamFlags>(G_PARAM_READWRITE)));
 
   g_object_class_install_property
       (gobject_class, PROP_DEVICE_NAME,
       g_param_spec_string ("device-name", "Device name",
-          "Human-readable name of the sound device", NULL, 
+          "Human-readable name of the sound device", NULL,
           static_cast<GParamFlags>(G_PARAM_READWRITE)));
 
   GST_DEBUG_CATEGORY_INIT (dshowvideosrc_debug, "dshowvideosrc", 0,
@@ -361,7 +361,7 @@ gst_dshowvideosrc_get_device_name_values (GstDshowVideoSrc * src)
     goto clean;
   }
 
-  hres = devices_enum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory, 
+  hres = devices_enum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory,
     &moniker_enum, 0);
   if (hres != S_OK || !moniker_enum) {
     GST_ERROR ("Can't get enumeration of video devices (error=0x%x)", hres);
@@ -388,7 +388,7 @@ gst_dshowvideosrc_get_device_name_values (GstDshowVideoSrc * src)
             g_utf16_to_utf8 ((const gunichar2 *) varFriendlyName.bstrVal,
             wcslen (varFriendlyName.bstrVal), NULL, NULL, NULL);
 
-        GValue value = { 0 };\r
+        GValue value = { 0 };
         g_value_init (&value, G_TYPE_STRING);
         g_value_set_string (&value, friendly_name);
         g_value_array_append (array, &value);
@@ -502,7 +502,7 @@ gst_dshowvideosrc_get_caps (GstBaseSrc * basesrc)
     if (SUCCEEDED (hres)) {
       hres = MkParseDisplayName (lpbc, (LPCOLESTR) unidevice, &dwEaten, &videom);
       if (SUCCEEDED (hres)) {
-        hres = videom->BindToObject(lpbc, NULL, IID_IBaseFilter, 
+        hres = videom->BindToObject(lpbc, NULL, IID_IBaseFilter,
           (LPVOID *) &src->video_cap_filter);
         videom->Release();
       }
@@ -622,7 +622,7 @@ gst_dshowvideosrc_start (GstBaseSrc * bsrc)
     goto error;
   }
 
-  hres = src->filter_graph->QueryInterface(IID_IMediaFilter, 
+  hres = src->filter_graph->QueryInterface(IID_IMediaFilter,
     (LPVOID *) &src->media_filter);
   if (hres != S_OK || !src->media_filter) {
     GST_ERROR ("Can't get IMediacontrol interface from the graph manager (error=0x%x)", hres);
@@ -732,7 +732,7 @@ gst_dshowvideosrc_set_caps (GstBaseSrc * bsrc, GstCaps * caps)
           goto error;
         }
 
-        hres = src->filter_graph->ConnectDirect(pin_mediatype->capture_pin, 
+        hres = src->filter_graph->ConnectDirect(pin_mediatype->capture_pin,
           input_pin, pin_mediatype->mediatype);
         input_pin->Release();
 
@@ -880,12 +880,12 @@ gst_dshowvideosrc_getcaps_from_streamcaps (GstDshowVideoSrc * src, IPin * pin,
   caps = gst_caps_new_empty ();
 
   for (; i < icount; i++) {
-    
-    GstCapturePinMediaType *pin_mediatype = 
+
+    GstCapturePinMediaType *pin_mediatype =
       gst_dshow_new_pin_mediatype (pin, i, streamcaps);
 
     if (pin_mediatype) {
-    
+
       GstCaps *mediacaps = NULL;
 
       if (gst_dshow_check_mediatype (pin_mediatype->mediatype, MEDIASUBTYPE_I420, FORMAT_VideoInfo)) {
@@ -895,11 +895,11 @@ gst_dshowvideosrc_getcaps_from_streamcaps (GstDshowVideoSrc * src, IPin * pin,
         mediacaps = gst_dshow_new_video_caps (GST_VIDEO_FORMAT_BGR, NULL, pin_mediatype);
 
       } else if (gst_dshow_check_mediatype (pin_mediatype->mediatype, MEDIASUBTYPE_dvsd, FORMAT_VideoInfo)) {
-        mediacaps = gst_dshow_new_video_caps (GST_VIDEO_FORMAT_UNKNOWN, "video/x-dv, systemstream=FALSE", 
+        mediacaps = gst_dshow_new_video_caps (GST_VIDEO_FORMAT_UNKNOWN, "video/x-dv, systemstream=FALSE",
           pin_mediatype);
 
-      } else if (gst_dshow_check_mediatype (pin_mediatype->mediatype, MEDIASUBTYPE_dvsd, FORMAT_DvInfo)) { 
-        mediacaps = gst_dshow_new_video_caps (GST_VIDEO_FORMAT_UNKNOWN, "video/x-dv, systemstream=TRUE", 
+      } else if (gst_dshow_check_mediatype (pin_mediatype->mediatype, MEDIASUBTYPE_dvsd, FORMAT_DvInfo)) {
+        mediacaps = gst_dshow_new_video_caps (GST_VIDEO_FORMAT_UNKNOWN, "video/x-dv, systemstream=TRUE",
           pin_mediatype);
 
         pin_mediatype->granularityWidth = 0;
@@ -949,7 +949,7 @@ gst_dshowvideosrc_push_buffer (byte * buffer, long size, gpointer src_object,
   GST_BUFFER_DURATION (buf) = stop - start;
 
   if (src->is_rgb) {
-    /* FOR RGB directshow decoder will return bottom-up BITMAP 
+    /* FOR RGB directshow decoder will return bottom-up BITMAP
      * There is probably a way to get top-bottom video frames from
      * the decoder...
      */