Re: [FFmpeg-devel] [PATCH 2/2] dshow: Make dshow device buildable on Cygwin

2016-05-28 Thread Roger Pack
which compiler (mingw-w64 I presume?) are you using here?

On 5/6/16, Moriyoshi Koizumi  wrote:
> From: Moriyoshi koizumi 
>
> wchar_t is not always the same thing as WCHAR.
>
> Signed-off-by: Moriyoshi koizumi 
> ---
>  libavdevice/dshow.c |  6 +++---
>  libavdevice/dshow_capture.h | 10 +-
>  libavdevice/dshow_filter.c  | 16 
>  libavdevice/dshow_pin.c | 10 +-
>  4 files changed, 21 insertions(+), 21 deletions(-)
>
> diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
> index 678861d..432b643 100644
> --- a/libavdevice/dshow.c
> +++ b/libavdevice/dshow.c
> @@ -129,7 +129,7 @@ dshow_read_close(AVFormatContext *s)
>  return 0;
>  }
>
> -static char *dup_wchar_to_utf8(wchar_t *w)
> +static char *dup_wchar_to_utf8(WCHAR *w)
>  {
>  char *s = NULL;
>  int l = WideCharToMultiByte(CP_UTF8, 0, w, -1, 0, 0, 0, 0);
> @@ -599,7 +599,7 @@ dshow_cycle_pins(AVFormatContext *avctx, enum
> dshowDeviceType devtype,
>  GUID category;
>  DWORD r2;
>  char *name_buf = NULL;
> -wchar_t *pin_id = NULL;
> +WCHAR *pin_id = NULL;
>  char *pin_buf = NULL;
>  char *desired_pin_name = devtype == VideoDevice ?
> ctx->video_pin_name : ctx->audio_pin_name;
>
> @@ -734,7 +734,7 @@ dshow_open_device(AVFormatContext *avctx, ICreateDevEnum
> *devenum,
>  IStream *ofile_stream = NULL;
>  IPersistStream *pers_stream = NULL;
>
> -const wchar_t *filter_name[2] = { L"Audio capture filter", L"Video
> capture filter" };
> +const WCHAR *filter_name[2] = { L"Audio capture filter", L"Video
> capture filter" };
>
>
>  if ( ((ctx->audio_filter_load_file) &&
> (strlen(ctx->audio_filter_load_file)>0) && (sourcetype ==
> AudioSourceDevice)) ||
> diff --git a/libavdevice/dshow_capture.h b/libavdevice/dshow_capture.h
> index f26eaf9..860b782 100644
> --- a/libavdevice/dshow_capture.h
> +++ b/libavdevice/dshow_capture.h
> @@ -176,7 +176,7 @@ long  WINAPI libAVPin_ConnectedTo
> (libAVPin *, IPin **);
>  long  WINAPI libAVPin_ConnectionMediaType (libAVPin *,
> AM_MEDIA_TYPE *);
>  long  WINAPI libAVPin_QueryPinInfo(libAVPin *, PIN_INFO
> *);
>  long  WINAPI libAVPin_QueryDirection  (libAVPin *,
> PIN_DIRECTION *);
> -long  WINAPI libAVPin_QueryId (libAVPin *, wchar_t
> **);
> +long  WINAPI libAVPin_QueryId (libAVPin *, WCHAR
> **);
>  long  WINAPI libAVPin_QueryAccept (libAVPin *, const
> AM_MEDIA_TYPE *);
>  long  WINAPI libAVPin_EnumMediaTypes  (libAVPin *,
> IEnumMediaTypes **);
>  long  WINAPI libAVPin_QueryInternalConnections(libAVPin *, IPin **,
> unsigned long *);
> @@ -249,7 +249,7 @@ libAVEnumMediaTypes *libAVEnumMediaTypes_Create(const
> AM_MEDIA_TYPE *type);
>  struct libAVFilter {
>  IBaseFilterVtbl *vtbl;
>  long ref;
> -const wchar_t *name;
> +const WCHAR *name;
>  libAVPin *pin;
>  FILTER_INFO info;
>  FILTER_STATE state;
> @@ -272,10 +272,10 @@ long  WINAPI libAVFilter_GetState
> (libAVFilter *, DWORD, FILTER_ST
>  long  WINAPI libAVFilter_SetSyncSource  (libAVFilter *,
> IReferenceClock *);
>  long  WINAPI libAVFilter_GetSyncSource  (libAVFilter *,
> IReferenceClock **);
>  long  WINAPI libAVFilter_EnumPins   (libAVFilter *, IEnumPins
> **);
> -long  WINAPI libAVFilter_FindPin(libAVFilter *, const
> wchar_t *, IPin **);
> +long  WINAPI libAVFilter_FindPin(libAVFilter *, const WCHAR
> *, IPin **);
>  long  WINAPI libAVFilter_QueryFilterInfo(libAVFilter *, FILTER_INFO
> *);
> -long  WINAPI libAVFilter_JoinFilterGraph(libAVFilter *,
> IFilterGraph *, const wchar_t *);
> -long  WINAPI libAVFilter_QueryVendorInfo(libAVFilter *, wchar_t
> **);
> +long  WINAPI libAVFilter_JoinFilterGraph(libAVFilter *,
> IFilterGraph *, const WCHAR *);
> +long  WINAPI libAVFilter_QueryVendorInfo(libAVFilter *, WCHAR **);
>
>  void libAVFilter_Destroy(libAVFilter *);
>  libAVFilter *libAVFilter_Create (void *, void *, enum
> dshowDeviceType);
> diff --git a/libavdevice/dshow_filter.c b/libavdevice/dshow_filter.c
> index 7360adc..3ba3871 100644
> --- a/libavdevice/dshow_filter.c
> +++ b/libavdevice/dshow_filter.c
> @@ -20,6 +20,8 @@
>   */
>
>  #include "dshow_capture.h"
> +#include 
> +#include 
>
>  DECLARE_QUERYINTERFACE(libAVFilter,
>  { {_IUnknown,0}, {_IBaseFilter,0} })
> @@ -108,14 +110,14 @@ libAVFilter_EnumPins(libAVFilter *this, IEnumPins
> **enumpin)
>  return S_OK;
>  }
>  long WINAPI
> -libAVFilter_FindPin(libAVFilter *this, const wchar_t *id, IPin **pin)
> +libAVFilter_FindPin(libAVFilter *this, const WCHAR *id, IPin **pin)
>  {
>  libAVPin *found = NULL;
>  dshowdebug("libAVFilter_FindPin(%p)\n", this);
>
>  if (!id || !pin)
>  return E_POINTER;
> - 

[FFmpeg-devel] [PATCH 2/2] dshow: Make dshow device buildable on Cygwin

2016-05-06 Thread Moriyoshi Koizumi
From: Moriyoshi koizumi 

wchar_t is not always the same thing as WCHAR.

Signed-off-by: Moriyoshi koizumi 
---
 libavdevice/dshow.c |  6 +++---
 libavdevice/dshow_capture.h | 10 +-
 libavdevice/dshow_filter.c  | 16 
 libavdevice/dshow_pin.c | 10 +-
 4 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
index 678861d..432b643 100644
--- a/libavdevice/dshow.c
+++ b/libavdevice/dshow.c
@@ -129,7 +129,7 @@ dshow_read_close(AVFormatContext *s)
 return 0;
 }
 
-static char *dup_wchar_to_utf8(wchar_t *w)
+static char *dup_wchar_to_utf8(WCHAR *w)
 {
 char *s = NULL;
 int l = WideCharToMultiByte(CP_UTF8, 0, w, -1, 0, 0, 0, 0);
@@ -599,7 +599,7 @@ dshow_cycle_pins(AVFormatContext *avctx, enum 
dshowDeviceType devtype,
 GUID category;
 DWORD r2;
 char *name_buf = NULL;
-wchar_t *pin_id = NULL;
+WCHAR *pin_id = NULL;
 char *pin_buf = NULL;
 char *desired_pin_name = devtype == VideoDevice ? ctx->video_pin_name 
: ctx->audio_pin_name;
 
@@ -734,7 +734,7 @@ dshow_open_device(AVFormatContext *avctx, ICreateDevEnum 
*devenum,
 IStream *ofile_stream = NULL;
 IPersistStream *pers_stream = NULL;
 
-const wchar_t *filter_name[2] = { L"Audio capture filter", L"Video capture 
filter" };
+const WCHAR *filter_name[2] = { L"Audio capture filter", L"Video capture 
filter" };
 
 
 if ( ((ctx->audio_filter_load_file) && 
(strlen(ctx->audio_filter_load_file)>0) && (sourcetype == AudioSourceDevice)) ||
diff --git a/libavdevice/dshow_capture.h b/libavdevice/dshow_capture.h
index f26eaf9..860b782 100644
--- a/libavdevice/dshow_capture.h
+++ b/libavdevice/dshow_capture.h
@@ -176,7 +176,7 @@ long  WINAPI libAVPin_ConnectedTo 
(libAVPin *, IPin **);
 long  WINAPI libAVPin_ConnectionMediaType (libAVPin *, 
AM_MEDIA_TYPE *);
 long  WINAPI libAVPin_QueryPinInfo(libAVPin *, PIN_INFO *);
 long  WINAPI libAVPin_QueryDirection  (libAVPin *, 
PIN_DIRECTION *);
-long  WINAPI libAVPin_QueryId (libAVPin *, wchar_t **);
+long  WINAPI libAVPin_QueryId (libAVPin *, WCHAR **);
 long  WINAPI libAVPin_QueryAccept (libAVPin *, const 
AM_MEDIA_TYPE *);
 long  WINAPI libAVPin_EnumMediaTypes  (libAVPin *, 
IEnumMediaTypes **);
 long  WINAPI libAVPin_QueryInternalConnections(libAVPin *, IPin **, 
unsigned long *);
@@ -249,7 +249,7 @@ libAVEnumMediaTypes *libAVEnumMediaTypes_Create(const 
AM_MEDIA_TYPE *type);
 struct libAVFilter {
 IBaseFilterVtbl *vtbl;
 long ref;
-const wchar_t *name;
+const WCHAR *name;
 libAVPin *pin;
 FILTER_INFO info;
 FILTER_STATE state;
@@ -272,10 +272,10 @@ long  WINAPI libAVFilter_GetState   
(libAVFilter *, DWORD, FILTER_ST
 long  WINAPI libAVFilter_SetSyncSource  (libAVFilter *, 
IReferenceClock *);
 long  WINAPI libAVFilter_GetSyncSource  (libAVFilter *, 
IReferenceClock **);
 long  WINAPI libAVFilter_EnumPins   (libAVFilter *, IEnumPins **);
-long  WINAPI libAVFilter_FindPin(libAVFilter *, const wchar_t 
*, IPin **);
+long  WINAPI libAVFilter_FindPin(libAVFilter *, const WCHAR *, 
IPin **);
 long  WINAPI libAVFilter_QueryFilterInfo(libAVFilter *, FILTER_INFO *);
-long  WINAPI libAVFilter_JoinFilterGraph(libAVFilter *, IFilterGraph 
*, const wchar_t *);
-long  WINAPI libAVFilter_QueryVendorInfo(libAVFilter *, wchar_t **);
+long  WINAPI libAVFilter_JoinFilterGraph(libAVFilter *, IFilterGraph 
*, const WCHAR *);
+long  WINAPI libAVFilter_QueryVendorInfo(libAVFilter *, WCHAR **);
 
 void libAVFilter_Destroy(libAVFilter *);
 libAVFilter *libAVFilter_Create (void *, void *, enum dshowDeviceType);
diff --git a/libavdevice/dshow_filter.c b/libavdevice/dshow_filter.c
index 7360adc..3ba3871 100644
--- a/libavdevice/dshow_filter.c
+++ b/libavdevice/dshow_filter.c
@@ -20,6 +20,8 @@
  */
 
 #include "dshow_capture.h"
+#include 
+#include 
 
 DECLARE_QUERYINTERFACE(libAVFilter,
 { {_IUnknown,0}, {_IBaseFilter,0} })
@@ -108,14 +110,14 @@ libAVFilter_EnumPins(libAVFilter *this, IEnumPins 
**enumpin)
 return S_OK;
 }
 long WINAPI
-libAVFilter_FindPin(libAVFilter *this, const wchar_t *id, IPin **pin)
+libAVFilter_FindPin(libAVFilter *this, const WCHAR *id, IPin **pin)
 {
 libAVPin *found = NULL;
 dshowdebug("libAVFilter_FindPin(%p)\n", this);
 
 if (!id || !pin)
 return E_POINTER;
-if (!wcscmp(id, L"In")) {
+if (!StrCmpW(id, L"In")) {
 found = this->pin;
 libAVPin_AddRef(found);
 }
@@ -140,26 +142,24 @@ libAVFilter_QueryFilterInfo(libAVFilter *this, 
FILTER_INFO *info)
 }
 long WINAPI
 libAVFilter_JoinFilterGraph(libAVFilter *this, IFilterGraph *graph,
-  

[FFmpeg-devel] [PATCH 2/2] dshow: Make dshow device buildable on Cygwin

2016-05-06 Thread Moriyoshi Koizumi
From: Moriyoshi koizumi 

wchar_t is not always the same thing as WCHAR.

Signed-off-by: Moriyoshi koizumi 
---
 libavdevice/dshow.c |  6 +++---
 libavdevice/dshow_capture.h | 10 +-
 libavdevice/dshow_filter.c  | 16 
 libavdevice/dshow_pin.c | 10 +-
 4 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
index 678861d..432b643 100644
--- a/libavdevice/dshow.c
+++ b/libavdevice/dshow.c
@@ -129,7 +129,7 @@ dshow_read_close(AVFormatContext *s)
 return 0;
 }
 
-static char *dup_wchar_to_utf8(wchar_t *w)
+static char *dup_wchar_to_utf8(WCHAR *w)
 {
 char *s = NULL;
 int l = WideCharToMultiByte(CP_UTF8, 0, w, -1, 0, 0, 0, 0);
@@ -599,7 +599,7 @@ dshow_cycle_pins(AVFormatContext *avctx, enum 
dshowDeviceType devtype,
 GUID category;
 DWORD r2;
 char *name_buf = NULL;
-wchar_t *pin_id = NULL;
+WCHAR *pin_id = NULL;
 char *pin_buf = NULL;
 char *desired_pin_name = devtype == VideoDevice ? ctx->video_pin_name 
: ctx->audio_pin_name;
 
@@ -734,7 +734,7 @@ dshow_open_device(AVFormatContext *avctx, ICreateDevEnum 
*devenum,
 IStream *ofile_stream = NULL;
 IPersistStream *pers_stream = NULL;
 
-const wchar_t *filter_name[2] = { L"Audio capture filter", L"Video capture 
filter" };
+const WCHAR *filter_name[2] = { L"Audio capture filter", L"Video capture 
filter" };
 
 
 if ( ((ctx->audio_filter_load_file) && 
(strlen(ctx->audio_filter_load_file)>0) && (sourcetype == AudioSourceDevice)) ||
diff --git a/libavdevice/dshow_capture.h b/libavdevice/dshow_capture.h
index f26eaf9..860b782 100644
--- a/libavdevice/dshow_capture.h
+++ b/libavdevice/dshow_capture.h
@@ -176,7 +176,7 @@ long  WINAPI libAVPin_ConnectedTo 
(libAVPin *, IPin **);
 long  WINAPI libAVPin_ConnectionMediaType (libAVPin *, 
AM_MEDIA_TYPE *);
 long  WINAPI libAVPin_QueryPinInfo(libAVPin *, PIN_INFO *);
 long  WINAPI libAVPin_QueryDirection  (libAVPin *, 
PIN_DIRECTION *);
-long  WINAPI libAVPin_QueryId (libAVPin *, wchar_t **);
+long  WINAPI libAVPin_QueryId (libAVPin *, WCHAR **);
 long  WINAPI libAVPin_QueryAccept (libAVPin *, const 
AM_MEDIA_TYPE *);
 long  WINAPI libAVPin_EnumMediaTypes  (libAVPin *, 
IEnumMediaTypes **);
 long  WINAPI libAVPin_QueryInternalConnections(libAVPin *, IPin **, 
unsigned long *);
@@ -249,7 +249,7 @@ libAVEnumMediaTypes *libAVEnumMediaTypes_Create(const 
AM_MEDIA_TYPE *type);
 struct libAVFilter {
 IBaseFilterVtbl *vtbl;
 long ref;
-const wchar_t *name;
+const WCHAR *name;
 libAVPin *pin;
 FILTER_INFO info;
 FILTER_STATE state;
@@ -272,10 +272,10 @@ long  WINAPI libAVFilter_GetState   
(libAVFilter *, DWORD, FILTER_ST
 long  WINAPI libAVFilter_SetSyncSource  (libAVFilter *, 
IReferenceClock *);
 long  WINAPI libAVFilter_GetSyncSource  (libAVFilter *, 
IReferenceClock **);
 long  WINAPI libAVFilter_EnumPins   (libAVFilter *, IEnumPins **);
-long  WINAPI libAVFilter_FindPin(libAVFilter *, const wchar_t 
*, IPin **);
+long  WINAPI libAVFilter_FindPin(libAVFilter *, const WCHAR *, 
IPin **);
 long  WINAPI libAVFilter_QueryFilterInfo(libAVFilter *, FILTER_INFO *);
-long  WINAPI libAVFilter_JoinFilterGraph(libAVFilter *, IFilterGraph 
*, const wchar_t *);
-long  WINAPI libAVFilter_QueryVendorInfo(libAVFilter *, wchar_t **);
+long  WINAPI libAVFilter_JoinFilterGraph(libAVFilter *, IFilterGraph 
*, const WCHAR *);
+long  WINAPI libAVFilter_QueryVendorInfo(libAVFilter *, WCHAR **);
 
 void libAVFilter_Destroy(libAVFilter *);
 libAVFilter *libAVFilter_Create (void *, void *, enum dshowDeviceType);
diff --git a/libavdevice/dshow_filter.c b/libavdevice/dshow_filter.c
index 7360adc..3ba3871 100644
--- a/libavdevice/dshow_filter.c
+++ b/libavdevice/dshow_filter.c
@@ -20,6 +20,8 @@
  */
 
 #include "dshow_capture.h"
+#include 
+#include 
 
 DECLARE_QUERYINTERFACE(libAVFilter,
 { {_IUnknown,0}, {_IBaseFilter,0} })
@@ -108,14 +110,14 @@ libAVFilter_EnumPins(libAVFilter *this, IEnumPins 
**enumpin)
 return S_OK;
 }
 long WINAPI
-libAVFilter_FindPin(libAVFilter *this, const wchar_t *id, IPin **pin)
+libAVFilter_FindPin(libAVFilter *this, const WCHAR *id, IPin **pin)
 {
 libAVPin *found = NULL;
 dshowdebug("libAVFilter_FindPin(%p)\n", this);
 
 if (!id || !pin)
 return E_POINTER;
-if (!wcscmp(id, L"In")) {
+if (!StrCmpW(id, L"In")) {
 found = this->pin;
 libAVPin_AddRef(found);
 }
@@ -140,26 +142,24 @@ libAVFilter_QueryFilterInfo(libAVFilter *this, 
FILTER_INFO *info)
 }
 long WINAPI
 libAVFilter_JoinFilterGraph(libAVFilter *this, IFilterGraph *graph,
-