Commit e1be17fa authored by Simon Morlat's avatar Simon Morlat
Browse files

Merge branch 'master' of git.sv.gnu.org:/srv/git/linphone

Conflicts:
	linphone/mediastreamer2/src/msfileplayer_win.c
parents 5bc0e578 d43008a1
......@@ -17,11 +17,12 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#define UNICODE
#include "mediastreamer2/msfileplayer.h"
#include "mediastreamer2/waveheader.h"
#include "mediastreamer2/msticker.h"
typedef enum {
CLOSED,
STARTED,
......@@ -127,26 +128,18 @@ static int read_wav_header(PlayerData *d){
static int player_open(MSFilter *f, void *arg){
PlayerData *d=(PlayerData*)f->data;
HANDLE fd;
const char *afile=(const char*)arg;
LPCTSTR file;
#ifdef _UNICODE
wchar_t wfile[MAX_PATH];
mbstowcs(wfile,afile,MAX_PATH);
file=wfile;
#else
file=afile;
#endif
fd = CreateFile(file, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
const char *file=(const char*)arg;
WCHAR wUnicode[1024];
MultiByteToWideChar(CP_UTF8, 0, file, -1, wUnicode, 1024);
fd = CreateFile(wUnicode, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, 0, NULL);
if (fd==INVALID_HANDLE_VALUE){
ms_warning("Failed to open %s: error %i",afile,GetLastError());
ms_warning("Failed to open %s",file);
return -1;
}
d->state=STOPPED;
d->fd=fd;
if (strstr(afile,".wav")!=NULL) read_wav_header(d);
if (strstr(file,".wav")!=NULL) read_wav_header(d);
return 0;
}
......
......@@ -17,6 +17,8 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#define UNICODE
#include "mediastreamer2/msfilerec.h"
#include "mediastreamer2/waveheader.h"
......@@ -84,6 +86,9 @@ static void write_wav_header(int rate,int size, char *filename){
wave_header_t header;
DWORD bytes_written=0;
HANDLE fd;
WCHAR wUnicode[1024];
MultiByteToWideChar(CP_UTF8, 0, filename, -1, wUnicode, 1024);
memcpy(&header.riff_chunk.riff,"RIFF",4);
header.riff_chunk.len=le_uint32(size+32);
memcpy(&header.riff_chunk.wave,"WAVE",4);
......@@ -101,11 +106,7 @@ static void write_wav_header(int rate,int size, char *filename){
header.data_chunk.len=le_uint32(size);
/* TODO: replace with "lseek" equivalent for windows */
#if defined(_WIN32_WCE)
fd=CreateFile((LPCWSTR)filename, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
#else
fd=CreateFile(filename, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
#endif
fd=CreateFile(wUnicode, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
if (fd==INVALID_HANDLE_VALUE){
#if !defined(_WIN32_WCE)
ms_warning("Cannot open %s: %s",filename,strerror(errno));
......@@ -127,13 +128,12 @@ static int rec_open(MSFilter *f, void *arg){
RecState *s=(RecState*)f->data;
const char *filename=(const char*)arg;
WCHAR wUnicode[1024];
MultiByteToWideChar(CP_UTF8, 0, filename, -1, wUnicode, 1024);
ms_mutex_lock(&f->lock);
snprintf(s->filename, sizeof(s->filename), "%s", filename);
#if defined(_WIN32_WCE)
s->fd=CreateFile((LPCWSTR)filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
#else
s->fd=CreateFile(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
#endif
s->fd=CreateFile(wUnicode, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
if (s->fd==INVALID_HANDLE_VALUE){
#if !defined(_WIN32_WCE)
ms_warning("Cannot open %s: %s",filename,strerror(errno));
......
......@@ -19,12 +19,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifdef __DIRECTSOUND_ENABLED__
#define UNICODE
#include "mediastreamer2/mssndcard.h"
#include "mediastreamer2/msfilter.h"
#include "mediastreamer2/msticker.h"
#define UNICODE
#include <mmsystem.h>
#ifdef _MSC_VER
#include <mmreg.h>
......@@ -1045,7 +1045,7 @@ static void _winsnddscard_detect(MSSndCardManager *m){
if (ms_lib_instance==NULL)
{
ms_lib_instance = LoadLibrary("dsound.dll");
ms_lib_instance = LoadLibrary(L"dsound.dll");
if( ms_lib_instance == NULL )
{
/* error */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment