[vlc-commits] Contribs: improve flac support on WinRT

Jean-Baptiste Kempf git at videolan.org
Mon May 16 15:01:31 CEST 2016


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon May 16 14:59:04 2016 +0200| [6b6f0b70e184381e2b9bb12574d095e4b596cc56] | committer: Jean-Baptiste Kempf

Contribs: improve flac support on WinRT

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6b6f0b70e184381e2b9bb12574d095e4b596cc56
---

 contrib/src/flac/console_write.patch |   59 ++++++++++++++++++----------------
 1 file changed, 31 insertions(+), 28 deletions(-)

diff --git a/contrib/src/flac/console_write.patch b/contrib/src/flac/console_write.patch
index 5ebfc37..aa719f6 100644
--- a/contrib/src/flac/console_write.patch
+++ b/contrib/src/flac/console_write.patch
@@ -1,39 +1,42 @@
---- flac/src/share/win_utf8_io/win_utf8_io.c.orig	2016-05-13 11:27:58.508525189 +0200
-+++ flac/src/share/win_utf8_io/win_utf8_io.c	2016-05-13 12:16:51.951811662 +0200
-@@ -162,33 +162,14 @@
- /* get the console width in characters */
+--- flac.orig/src/share/win_utf8_io/win_utf8_io.c	2016-05-16 14:52:36.408520025 +0200
++++ flac/src/share/win_utf8_io/win_utf8_io.c	2016-05-16 14:57:07.880507930 +0200
+@@ -42,6 +42,7 @@
+ #include <stdarg.h>
+ #define WIN32_LEAN_AND_MEAN
+ #include <windows.h> /* for WideCharToMultiByte and MultiByteToWideChar */
++#include <winapifamily.h>
+ 
+ #include "share/win_utf8_io.h"
+ 
+@@ -163,16 +164,22 @@
  int win_get_console_width(void)
  {
--	int width = 80;
--	CONSOLE_SCREEN_BUFFER_INFO csbi;
--	HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
--	if (GetConsoleScreenBufferInfo(hOut, &csbi) != 0) width = csbi.dwSize.X;
--	return width;
-+    return 80;
+ 	int width = 80;
++#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+ 	CONSOLE_SCREEN_BUFFER_INFO csbi;
+ 	HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
+ 	if (GetConsoleScreenBufferInfo(hOut, &csbi) != 0) width = csbi.dwSize.X;
++#endif
+ 	return width;
  }
  
  /* print functions */
 -
  int print_console(FILE *stream, const wchar_t *text, size_t len)
  {
--	static HANDLE hOut;
--	static HANDLE hErr;
--	DWORD out;
--	hOut = GetStdHandle(STD_OUTPUT_HANDLE);
--	hErr = GetStdHandle(STD_ERROR_HANDLE);
--	if (stream == stdout && hOut != INVALID_HANDLE_VALUE && GetFileType(hOut) == FILE_TYPE_CHAR) {
--		if (WriteConsoleW(hOut, text, len, &out, NULL) == 0) return -1;
--		return out;
--	} else if (stream == stderr && hErr != INVALID_HANDLE_VALUE && GetFileType(hErr) == FILE_TYPE_CHAR) {
--		if (WriteConsoleW(hErr, text, len, &out, NULL) == 0) return -1;
--		return out;
--	} else {
--		int ret = fputws(text, stream);
--		if (ret < 0) return ret;
--		return len;
--	}
-+    (void)stream, (void)text;
-+    return len;
++#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
++	(void)stream;
++	OutputDebugStringW(text);
++	return len;
++#else
+ 	static HANDLE hOut;
+ 	static HANDLE hErr;
+ 	DWORD out;
+@@ -189,6 +196,7 @@
+ 		if (ret < 0) return ret;
+ 		return len;
+ 	}
++#endif
  }
  
  int printf_utf8(const char *format, ...)



More information about the vlc-commits mailing list