From 8a9b64329c0e387dc59a1fca477a43c50f59ff34 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 19 Jan 2016 18:36:06 +0100 Subject: Relicense some non-MPlayer source files to LGPL 2.1 or later This covers source files which were added in mplayer2 and mpv times only, and where all code is covered by LGPL relicensing agreements. There are probably more files to which this applies, but I'm being conservative here. A file named ao_sdl.c exists in MPlayer too, but the mpv one is a complete rewrite, and was added some time after the original ao_sdl.c was removed. The same applies to vo_sdl.c, for which the SDL2 API is radically different in addition (MPlayer supports SDL 1.2 only). common.c contains only code written by me. But common.h is a strange case: although it originally was named mp_common.h and exists in MPlayer too, by now it contains only definitions written by uau and me. The exceptions are the CONTROL_ defines - thus not changing the license of common.h yet. codec_tags.c contained once large tables generated from MPlayer's codecs.conf, but all of these tables were removed. From demux_playlist.c I'm removing a code fragment from someone who was not asked; this probably could be done later (see commit 15dccc37). misc.c is a bit complicated to reason about (it was split off mplayer.c and thus contains random functions out of this file), but actually all functions have been added post-MPlayer. Except get_relative_time(), which was written by uau, but looks similar to 3 different versions of something similar in each of the Unix/win32/OSX timer source files. I'm not sure what that means in regards to copyright, so I've just moved it into another still-GPL source file for now. screenshot.c once had some minor parts of MPlayer's vf_screenshot.c, but they're all gone. --- osdep/atomics.h | 14 +++++++------- osdep/io.c | 14 +++++++------- osdep/io.h | 14 +++++++------- osdep/path-macosx.m | 14 +++++++------- osdep/path-unix.c | 14 +++++++------- osdep/path-win.c | 14 +++++++------- osdep/subprocess-posix.c | 14 +++++++------- osdep/subprocess-win.c | 14 +++++++------- osdep/subprocess.c | 14 +++++++------- osdep/subprocess.h | 14 +++++++------- osdep/threads.c | 15 ++++++++------- osdep/timer.c | 14 +++++++------- 12 files changed, 85 insertions(+), 84 deletions(-) (limited to 'osdep') diff --git a/osdep/atomics.h b/osdep/atomics.h index 1cac2d5700..c4f31286cc 100644 --- a/osdep/atomics.h +++ b/osdep/atomics.h @@ -2,18 +2,18 @@ * This file is part of mpv. * Copyright (c) 2013 Stefano Pigozzi * - * mpv is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * mpv is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. * * mpv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with mpv. If not, see . + * You should have received a copy of the GNU Lesser General Public + * License along with mpv. If not, see . */ #ifndef MP_ATOMICS_H diff --git a/osdep/io.c b/osdep/io.c index 5f46cdb69b..5952f21980 100644 --- a/osdep/io.c +++ b/osdep/io.c @@ -5,18 +5,18 @@ * * This file is part of mpv. * - * mpv is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * mpv is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. * * mpv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with mpv. If not, see . + * You should have received a copy of the GNU Lesser General Public + * License along with mpv. If not, see . */ #include diff --git a/osdep/io.h b/osdep/io.h index 8d3e24f551..541e36aeea 100644 --- a/osdep/io.h +++ b/osdep/io.h @@ -3,18 +3,18 @@ * * This file is part of mpv. * - * mpv is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * mpv is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. * * mpv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with mpv. If not, see . + * You should have received a copy of the GNU Lesser General Public + * License along with mpv. If not, see . */ #ifndef MPLAYER_OSDEP_IO diff --git a/osdep/path-macosx.m b/osdep/path-macosx.m index f011289e36..73abb0d305 100644 --- a/osdep/path-macosx.m +++ b/osdep/path-macosx.m @@ -1,18 +1,18 @@ /* * This file is part of mpv. * - * mpv is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * mpv is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. * * mpv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with mpv. If not, see . + * You should have received a copy of the GNU Lesser General Public + * License along with mpv. If not, see . */ #import diff --git a/osdep/path-unix.c b/osdep/path-unix.c index cea4235c15..d9a49ab06d 100644 --- a/osdep/path-unix.c +++ b/osdep/path-unix.c @@ -1,18 +1,18 @@ /* * This file is part of mpv. * - * mpv is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * mpv is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. * * mpv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with mpv. If not, see . + * You should have received a copy of the GNU Lesser General Public + * License along with mpv. If not, see . */ #include diff --git a/osdep/path-win.c b/osdep/path-win.c index 6e09e3861b..de7c0936f7 100644 --- a/osdep/path-win.c +++ b/osdep/path-win.c @@ -1,18 +1,18 @@ /* * This file is part of mpv. * - * mpv is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * mpv is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. * * mpv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with mpv. If not, see . + * You should have received a copy of the GNU Lesser General Public + * License along with mpv. If not, see . */ #include diff --git a/osdep/subprocess-posix.c b/osdep/subprocess-posix.c index 16f9735fe7..163559edbc 100644 --- a/osdep/subprocess-posix.c +++ b/osdep/subprocess-posix.c @@ -1,18 +1,18 @@ /* * This file is part of mpv. * - * mpv is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * mpv is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. * * mpv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with mpv. If not, see . + * You should have received a copy of the GNU Lesser General Public + * License along with mpv. If not, see . */ #include diff --git a/osdep/subprocess-win.c b/osdep/subprocess-win.c index 76e4964183..614cae663f 100644 --- a/osdep/subprocess-win.c +++ b/osdep/subprocess-win.c @@ -1,18 +1,18 @@ /* * This file is part of mpv. * - * mpv is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * mpv is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. * * mpv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with mpv. If not, see . + * You should have received a copy of the GNU Lesser General Public + * License along with mpv. If not, see . */ #include diff --git a/osdep/subprocess.c b/osdep/subprocess.c index 84a1b52fe6..e7678cdf76 100644 --- a/osdep/subprocess.c +++ b/osdep/subprocess.c @@ -1,18 +1,18 @@ /* * This file is part of mpv. * - * mpv is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * mpv is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. * * mpv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with mpv. If not, see . + * You should have received a copy of the GNU Lesser General Public + * License along with mpv. If not, see . */ #include diff --git a/osdep/subprocess.h b/osdep/subprocess.h index 33c4013f6d..a32e7911c8 100644 --- a/osdep/subprocess.h +++ b/osdep/subprocess.h @@ -1,18 +1,18 @@ /* * This file is part of mpv. * - * mpv is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * mpv is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. * * mpv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with mpv. If not, see . + * You should have received a copy of the GNU Lesser General Public + * License along with mpv. If not, see . */ #ifndef MP_SUBPROCESS_H_ diff --git a/osdep/threads.c b/osdep/threads.c index cccce85d1c..e4bd0b7758 100644 --- a/osdep/threads.c +++ b/osdep/threads.c @@ -1,19 +1,20 @@ /* * This file is part of mpv. * - * mpv is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * mpv is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. * * mpv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with mpv. If not, see . + * You should have received a copy of the GNU Lesser General Public + * License along with mpv. If not, see . */ + #include #include #include diff --git a/osdep/timer.c b/osdep/timer.c index 32f0172b0b..f75aec76f3 100644 --- a/osdep/timer.c +++ b/osdep/timer.c @@ -1,18 +1,18 @@ /* * This file is part of mpv. * - * mpv is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * mpv is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. * * mpv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with mpv. If not, see . + * You should have received a copy of the GNU Lesser General Public + * License along with mpv. If not, see . */ #include -- cgit v1.2.3 From c3348d86f21944bad9e582f3c5d6b4cc4e4abfb1 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 8 Feb 2016 20:29:08 +0100 Subject: build: make posix_spawn optional OK, Android doesn't support it. --- osdep/subprocess.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'osdep') diff --git a/osdep/subprocess.c b/osdep/subprocess.c index e7678cdf76..dbd6100d2c 100644 --- a/osdep/subprocess.c +++ b/osdep/subprocess.c @@ -17,6 +17,8 @@ #include +#include "config.h" + #include "common/common.h" #include "common/msg.h" #include "common/msg_control.h" @@ -55,3 +57,13 @@ void mp_subprocess_detached(struct mp_log *log, char **args) if (pthread_create(&thread, NULL, run_subprocess, p)) talloc_free(p); } + +#if !HAVE_SUBPROCESS +int mp_subprocess(char **args, struct mp_cancel *cancel, void *ctx, + subprocess_read_cb on_stdout, subprocess_read_cb on_stderr, + char **error) +{ + *error = "unsupported"; + return -1; +} +#endif -- cgit v1.2.3 From ff0112e08df32e88549d142371d49a2a8ac8a798 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Ekstr=C3=B6m?= Date: Sun, 7 Feb 2016 14:27:46 +0200 Subject: Initial Android support * Adds an 'android' feature, which is automatically detected. * Android has a broken strnlen, so a wrapper is added from FreeBSD. --- osdep/android/strnlen.c | 40 ++++++++++++++++++++++++++++++++++++++++ osdep/android/strnlen.h | 33 +++++++++++++++++++++++++++++++++ osdep/strnlen.h | 29 +++++++++++++++++++++++++++++ 3 files changed, 102 insertions(+) create mode 100644 osdep/android/strnlen.c create mode 100644 osdep/android/strnlen.h create mode 100644 osdep/strnlen.h (limited to 'osdep') diff --git a/osdep/android/strnlen.c b/osdep/android/strnlen.c new file mode 100644 index 0000000000..c8c9d3d4b8 --- /dev/null +++ b/osdep/android/strnlen.c @@ -0,0 +1,40 @@ +/*- + * Copyright (c) 2009 David Schultz + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include "osdep/android/strnlen.h" + +size_t +freebsd_strnlen(const char *s, size_t maxlen) +{ + size_t len; + + for (len = 0; len < maxlen; len++, s++) { + if (!*s) + break; + } + return (len); +} diff --git a/osdep/android/strnlen.h b/osdep/android/strnlen.h new file mode 100644 index 0000000000..c1f3391d4d --- /dev/null +++ b/osdep/android/strnlen.h @@ -0,0 +1,33 @@ +/*- + * Copyright (c) 2009 David Schultz + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef MP_OSDEP_ANDROID_STRNLEN +#define MP_OSDEP_ANDROID_STRNLEN + +size_t +freebsd_strnlen(const char *s, size_t maxlen); + +#endif diff --git a/osdep/strnlen.h b/osdep/strnlen.h new file mode 100644 index 0000000000..0a971d0ab0 --- /dev/null +++ b/osdep/strnlen.h @@ -0,0 +1,29 @@ +/* + * strnlen wrapper + * + * This file is part of mpv. + * + * mpv is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * mpv is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with mpv. If not, see . + */ + +#ifndef MP_OSDEP_STRNLEN +#define MP_OSDEP_STRNLEN + +#ifdef __ANDROID__ +// strnlen is broken on current android ndk, see https://code.google.com/p/android/issues/detail?id=74741 +#include "osdep/android/strnlen.h" +#define strnlen freebsd_strnlen +#endif + +#endif -- cgit v1.2.3 From 733e0b23c8be3aaf078e873f6e9776a5ab792ce9 Mon Sep 17 00:00:00 2001 From: Alexis Nootens Date: Sat, 13 Feb 2016 12:19:45 +0100 Subject: cocoa: fix charcode retrieving for accented characters The handler was retrieving an invalid charcode for accented characters, thus ignoring them. --- osdep/macosx_events.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'osdep') diff --git a/osdep/macosx_events.m b/osdep/macosx_events.m index 51aaf2aca4..6090a1937e 100644 --- a/osdep/macosx_events.m +++ b/osdep/macosx_events.m @@ -451,7 +451,8 @@ void cocoa_set_input_context(struct input_ctx *input_context) else chars = [event charactersIgnoringModifiers]; - int key = convert_key([event keyCode], *[chars UTF8String]); + struct bstr t = bstr0([chars UTF8String]); + int key = convert_key([event keyCode], bstr_decode_utf8(t, &t)); if (key > -1) [self handleMPKey:key withMask:[self keyModifierMask:event]]; -- cgit v1.2.3 From 3dfb07854b3143d59681fd65f7dd7c3ba65e1d2f Mon Sep 17 00:00:00 2001 From: Kevin Mitchell Date: Mon, 15 Feb 2016 17:52:56 -0800 Subject: dxva2: use mp_HESULT_to_str on FAILED(hr) --- osdep/windows_utils.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'osdep') diff --git a/osdep/windows_utils.c b/osdep/windows_utils.c index ee80a18ef4..21ff40a89d 100644 --- a/osdep/windows_utils.c +++ b/osdep/windows_utils.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "windows_utils.h" @@ -83,6 +84,40 @@ static char *hresult_to_str(const HRESULT hr) E(AUDCLNT_S_BUFFER_EMPTY) E(AUDCLNT_S_THREAD_ALREADY_REGISTERED) E(AUDCLNT_S_POSITION_STALLED) + E(D3DERR_WRONGTEXTUREFORMAT) + E(D3DERR_UNSUPPORTEDCOLOROPERATION) + E(D3DERR_UNSUPPORTEDCOLORARG) + E(D3DERR_UNSUPPORTEDALPHAOPERATION) + E(D3DERR_UNSUPPORTEDALPHAARG) + E(D3DERR_TOOMANYOPERATIONS) + E(D3DERR_CONFLICTINGTEXTUREFILTER) + E(D3DERR_UNSUPPORTEDFACTORVALUE) + E(D3DERR_CONFLICTINGRENDERSTATE) + E(D3DERR_UNSUPPORTEDTEXTUREFILTER) + E(D3DERR_CONFLICTINGTEXTUREPALETTE) + E(D3DERR_DRIVERINTERNALERROR) + E(D3DERR_NOTFOUND) + E(D3DERR_MOREDATA) + E(D3DERR_DEVICELOST) + E(D3DERR_DEVICENOTRESET) + E(D3DERR_NOTAVAILABLE) + E(D3DERR_OUTOFVIDEOMEMORY) + E(D3DERR_INVALIDDEVICE) + E(D3DERR_INVALIDCALL) + E(D3DERR_DRIVERINVALIDCALL) + E(D3DERR_WASSTILLDRAWING) + E(D3DOK_NOAUTOGEN) + E(D3DERR_DEVICEREMOVED) + E(D3DERR_DEVICEHUNG) + E(S_NOT_RESIDENT) + E(S_RESIDENT_IN_SHARED_MEMORY) + E(S_PRESENT_MODE_CHANGED) + E(S_PRESENT_OCCLUDED) + E(D3DERR_UNSUPPORTEDOVERLAY) + E(D3DERR_UNSUPPORTEDOVERLAYFORMAT) + E(D3DERR_CANNOTPROTECTCONTENT) + E(D3DERR_UNSUPPORTEDCRYPTO) + E(D3DERR_PRESENT_STATISTICS_DISJOINT) default: return ""; } -- cgit v1.2.3 From 50d9a2609ae283910d78c05d028ef378dc3d6617 Mon Sep 17 00:00:00 2001 From: Kevin Mitchell Date: Wed, 17 Feb 2016 02:40:43 -0800 Subject: windows_utils: try and use FormatMessage for errors. This is useful in particular for GetLastError, unfortunately, it's stil pretty dumb with regards to WASAPI or D3D specific errors, so keep the hresult_to_string switch. --- osdep/windows_utils.c | 24 ++++++++++++++++++++++-- osdep/windows_utils.h | 2 +- 2 files changed, 23 insertions(+), 3 deletions(-) (limited to 'osdep') diff --git a/osdep/windows_utils.c b/osdep/windows_utils.c index 21ff40a89d..a1ea32191a 100644 --- a/osdep/windows_utils.c +++ b/osdep/windows_utils.c @@ -124,9 +124,29 @@ static char *hresult_to_str(const HRESULT hr) #undef E } +static char *fmtmsg_buf(char *buf, size_t buf_size, DWORD errorID) +{ + DWORD n = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, errorID, 0, buf, buf_size, NULL); + if (!n && GetLastError() == ERROR_MORE_DATA) { + snprintf(buf, buf_size, + "", + buf_size); + } else { + if (n > 0 && buf[n-1] == '\n') + buf[n-1] = '\0'; + if (n > 1 && buf[n-2] == '\r') + buf[n-2] = '\0'; + } + return buf; +} +#define fmtmsg(hr) fmtmsg_buf((char[243]){0}, 243, (hr)) + char *mp_HRESULT_to_str_buf(char *buf, size_t buf_size, HRESULT hr) { - snprintf(buf, buf_size, "%s (0x%"PRIx32")", - hresult_to_str(hr), (uint32_t) hr); + char* msg = fmtmsg(hr); + msg = msg[0] ? msg : hresult_to_str(hr); + snprintf(buf, buf_size, "%s (0x%"PRIx32")", msg, (uint32_t)hr); return buf; } diff --git a/osdep/windows_utils.h b/osdep/windows_utils.h index 851eb1b4e3..6c750ded2a 100644 --- a/osdep/windows_utils.h +++ b/osdep/windows_utils.h @@ -23,7 +23,7 @@ char *mp_GUID_to_str_buf(char *buf, size_t buf_size, const GUID *guid); #define mp_GUID_to_str(guid) mp_GUID_to_str_buf((char[40]){0}, 40, (guid)) char *mp_HRESULT_to_str_buf(char *buf, size_t buf_size, HRESULT hr); -#define mp_HRESULT_to_str(hr) mp_HRESULT_to_str_buf((char[60]){0}, 60, (hr)) +#define mp_HRESULT_to_str(hr) mp_HRESULT_to_str_buf((char[256]){0}, 256, (hr)) #define mp_LastError_to_str() mp_HRESULT_to_str(HRESULT_FROM_WIN32(GetLastError())) #endif -- cgit v1.2.3 From bf0801a14a697755fc561c27404acf71c83a7f51 Mon Sep 17 00:00:00 2001 From: James Ross-Gowan Date: Thu, 18 Feb 2016 22:53:06 +1100 Subject: glob-win: relicense to LGPL This file was rewritten from scratch in 0cef033, so it should be okay. As mentioned in #730, it's a complete rewrite referencing only MSDN and POSIX, rather than the original code. --- osdep/glob-win.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'osdep') diff --git a/osdep/glob-win.c b/osdep/glob-win.c index cca226ae7a..a3485cdbd1 100644 --- a/osdep/glob-win.c +++ b/osdep/glob-win.c @@ -1,18 +1,18 @@ /* * This file is part of mpv. * - * mpv is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * mpv is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. * * mpv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with mpv. If not, see . + * You should have received a copy of the GNU Lesser General Public + * License along with mpv. If not, see . */ #include -- cgit v1.2.3