Commit Graph

204 Commits

Author SHA1 Message Date
wm4 24be34f1e9 cleanup: Silence compilation warnings on MinGW-w64
Some of the code, especially the dshow and windows codec loader parts,
are extremely hacky and likely full of bugs. The goal is merely getting
rid of warnings that could obscure more important warnings and actual
bugs, instead of fixing actual problems. This reduces the number of
warnings from over 500 to almost the same as when compiling on Linux.

Note that many problems stem from using the ancient wine-derived
windows headers. There are some differences to the "proper" windows
header. Changing the code to compile with the proper headers would be
too much trouble, and it still has to work on Unix.

Some of the changes might actually break compilation on legacy MinGW,
but we don't support that anymore. Always use MinGW-w64, even when
compiling to 32 bit.

Fixes some warnings in the win32 loader code on Linux too.
2012-03-01 00:22:30 +02:00
diego ed8e92afcc Remove #warning preprocessor directives
The #warning preprocessor directive is non-standard and not available with all
compilers. Furthermore, the warnings it causes are noisy and have not led to
getting any of the underlying issues fixed in the space of a decade.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32480 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:18:10 +02:00
reimar db90a65d11 Remove remaining %lf printf conversions
Most cases are just code in comments.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32438 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:18:08 +02:00
diego 3b43c4fee5 loader: Move fs_seg extern variable declaration to ldt_keeper.h
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32133 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:16:45 +02:00
alexc 9e218d2df1 loader: Add msvcr100 support to the win32 loader
This is required for the Expression Screen Codec binary decoder.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31906 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:15:01 +02:00
reimar 04ce30b2fd loader: Reuse do_cpuid from cpudetect.c in loader/win32.c
Also avoids several "used uninitialized" warnings.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31905 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:15:01 +02:00
reimar 1605194717 loader/win32.c: misc cleanup
Make library/export function tables static const.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31898 b3059339-0415-0410-9bf9-f77b7e298cf2

Avoid mixing code and declarations.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31899 b3059339-0415-0410-9bf9-f77b7e298cf2

Make function declarations proper prototypes.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31900 b3059339-0415-0410-9bf9-f77b7e298cf2

Fix type in conditional.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31901 b3059339-0415-0410-9bf9-f77b7e298cf2

Avoid arithmetic on void * pointers.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31902 b3059339-0415-0410-9bf9-f77b7e298cf2

Add const to avoid warnings.
The const on the return type is not correct compared to the real win32 API
functions, but that really does not matter for us, avoiding the warning is
more useful.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31903 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:15:01 +02:00
compn 0c9034f030 loader/win32.c: remove sys/timeb.h include
It is obsolete and breaks compilation with new gcc.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31868 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:14:46 +02:00
sesse 46f30279e7 Add final missing bits of CineForm HD support on Linux (via the Windows
DirectShow codec).

Required changes:

 - codecs.conf entry (of course).
 - Allow opening files with “.col” in the file name, just like “vp3” and “.fpf”
   already was allowed. (CineForm expects to be able to do this, presumably
   for some color management code.)
 - In registry.c, fake a few registry keys that the codec expects the installer
   to have written. Also, change a few magic numbers (0, 2) to the appropriate
   constants (ERROR_SUCCESS, ERROR_FILE_NOT_FOUND) where appropriate, so the code
   is easier to follow.

SMP works fine, but seemingly performs suboptimally (e.g., on my dual-core
laptop, CineForm performs better if I lie to it and tell it I have four cores).
I don't know if this is inherent in the codec, or some inefficiency in the
emulated synchronization primitives.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31196 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-05-23 16:01:12 +00:00
sesse af6fb3740e Don't try to delete the global memory mutex in the Win32 loader code,
since it's now statically allocated and will not be reallocated if a new
allocation comes along.

This also fixes an issue where the mutex would not always be properly
unlocked, leading to deadlocks. I thought I'd committed that ages ago,
but obviously not, and it broke CineForm initialization.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30957 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-03-25 12:58:41 +00:00
diego 5e480c7b81 Get rid of pointless def_path variable; use codec_path directly instead.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30949 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-03-23 18:01:00 +00:00
diego 70c66c0476 Rename get_path.[ch] --> path.[ch].
These files now contain different functions related to path handling.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30943 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-03-20 23:38:27 +00:00
diego a06a3d476d Move SetCodecPath() from loader to get_path.c and make it unconditional.
This fixes compilation with the Win32 loader disabled but other binary
codec loaders enabled.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30942 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-03-20 23:27:07 +00:00
reimar a743c0a738 Split codec path related code into a separate file to fix Windows build.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30930 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-03-18 20:44:01 +00:00
sesse 67b20ea611 Fix thread safety issue in mreq_private: last_alloc was accessed from multiple
threads without being under a mutex.



git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30928 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-03-17 23:42:11 +00:00
sesse c7dbfb6467 Announce Windows XP SP2 instead of Windows 95 OSR2.
It's time we move to 2010: Announce Windows XP SP2 to codecs instead of Win95
OSR2.

Note: We still don't support the *Ex fields in the version info struct
properly (we shouldn't really overwrite the structure size, but rather check
it to see if it's safe to fill the extra fields). No codec I've found seems
to care.



git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30927 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-03-17 23:38:26 +00:00
sesse d5f3f8caab Announce SMP support for Win32.
Don't hardcode dwNumberOfProcessors=1 for Win32 anymore; the mutex/event code
is still far from perfect, but now good enough that I can't find any codecs
that breaks with this (tested on a quad with various codecs). This tells
codecs they can use more than one core if they want to (some already did, by
launching multiple threads even when told there was only a single core).


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30926 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-03-17 23:33:26 +00:00
sesse f414a15b33 Fix return value of InitializeCriticalSectionAndSpinCount.
InitializeCriticalSectionAndSpinCount returns a nonzero value on success,
and some codecs (notably VP7) seemingly got confused when it didn't, if and
only if we tried to emulate NT or newer.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30913 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-03-16 22:08:56 +00:00
sesse 2990ec1682 Fix indentation in GetVersionExW.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30902 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-03-15 16:09:35 +00:00
sesse 22ede70e58 Implement GetVersionExW with the same data as GetVersionExA but taking in a
different structure, and CreateMutexW, CreateEventW and CreateSemaphoreW as
simple wrappers around the A versions.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30900 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-03-15 12:54:54 +00:00
diego aee9749bca Replace separate Win32, XAnim and Real codec directories by one global dir.
Nowadays MPlayer does not use the codecs from other installed programs.
A runtime setting will soon take over the rare case that binary codecs
should be searched for in non-standard directories.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30888 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-03-14 16:13:32 +00:00
sesse c7c74e1404 Implement ResumeThread and SignalObjectAndWait.
Relatively simplistic implementations of ResumeThread (stub) and
SignalObjectAndWait (bAlertable is ignored). Both are needed for ProRes 4:2:2
support on Linux.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30861 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-03-08 13:00:59 +00:00
sesse b951d42e4e Implement Win32 mutexes.
Implement Win32 mutexes; they used to just be mapped on top of events, which
is not the same thing at all.

The implementation is pretty much the obvious one, similar to the
current critical section implementation and the semaphore implementation;
a single lock count protected by a pthread mutex, and an event lockers can
sleep on to know when the mutex is available.

Also make CreateMutexA and ReleaseMutex available even if QuickTime codecs
support is not configured.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30853 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-03-06 10:13:37 +00:00
sesse 8e19e87761 Fix semaphore behavior in WaitForSingleObject.
Two simple bugfixes for semaphores in WaitForSingleObject:

First, semaphore count should be decreased on loading the semaphore, not
increased. The case for duration=0 had this wrong (duration=-1 was fine).

Second, the code for duration=-1 forgot to set the return value, so it
would always return WAIT_FAILED.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30852 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-03-06 10:07:39 +00:00
sesse 474c365479 Make Win32 mutex and thread linked lists thread safe.
loader/win32.c contains a global linked list of all existing mutexes
(whose head is called mlist), which is accessed from multiple threads,
and as such needs to be protected by a mutex. Fixed.

Same thing for the global linked list of all existing threads, whose
head is called list.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30851 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-03-06 10:05:10 +00:00
sesse fbb74e16a3 Make GetModuleHandle(NULL) return a valid pointer.
Some codecs, and more recently Microsoft's CRT library, expect GetModuleHandle(NULL)
to return a pointer to the program's PE header mapped in memory. Thus, just returning
0x0 or 0x1 won't do it anymore, so create a minimal PE header and return that.

Patch originally by Gianluigi Tiesi ( mplayer (at) netfarm (dot) it ).


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30848 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-03-05 23:09:36 +00:00
sesse c27b99441b Partial revert of r30843.
Some extra changes snuck into my commit; they'll probably be reviewed
and committed to Subversion eventually, but were not part of the fix
for WaitForSingleObject on thread handles.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30844 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-03-05 11:14:07 +00:00
sesse 61f351dc90 Support thread handles in WaitForSingleObject.
Some codecs need this for clean shutdown (as opposed to a crash); we don't 
really support timed wait since POSIX doesn't, but it doesn't seem necessary.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30843 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-03-05 11:11:47 +00:00
sesse 5fb74d581f Make emulated Win32 critical sections thread safe.
Earlier, cs->locked was accessed outside the mutex to get around
the problem that default pthread mutexes are not recursive
(ie., you cannot do a double-lock from the same thread), causing
a thread-safety problem, as both detected by Helgrind and showing
up in some multithreaded codecs.

The ideal solution here would be to simply use recursive pthread
mutexes, but there were concerns about reduced debuggability and
possibly portability. Thus, instead, rewrite the critical sections
to be a simple lock count (with owner) protected by a regular mutex.
Whenever a thread wants to enter the critical section and lock_count
is not 0, it sleeps on a special event that tells it when the
critical section is available.



git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30837 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-03-04 15:57:08 +00:00
sesse f32e92b849 Fix crashes in CreatePalette by fixing the LOGPALETTE struct.
CreatePalette had problems for me, and looking at the code it was quite
obvious why; someone had reversed the order of the two elements of the
LOGPALETTE struct, causing it to allocate and copy a bogus amount of memory.
Why on earth anybody would want to do that is beyond me; whoever did it even
left a comment, but it wasn't very helpful, as it crashed nevertheless. :-)


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30832 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-03-04 15:31:54 +00:00
sesse c6fb73d6b1 Fix manual reset behavior of Win32 events.
Events have a “reset” member that specify if they flag is automatically                                   
set back on read/wait. However, this was populated by bManualReset, so the                                
flag was inverted and once an event was set, it would forever be counted                                  
as so. Fixed by inverting the flag.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30831 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-03-04 15:28:02 +00:00
sesse 84bcc5642a Fix return values of WaitForSingleObject when checking an event.
These were simply inverted compared to what they should be.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30830 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-03-04 15:23:52 +00:00
diego b63759b175 Do not cast the results of malloc/calloc/realloc.
These functions return void*, which is compatible with any pointer,
so there is no need for casts.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30744 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-02-26 15:01:37 +00:00
diego 2f6fca9481 Add declaration for exp_EH_prolog_dummy().
This avoids a warning with -Wmissing-prototypes.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30701 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-02-22 13:55:00 +00:00
diego 4d6d266521 Only #define WIN32_LOADER if it has not been #defined already, fixes warning:
loader/win32.c:27:1: warning: "WIN32_LOADER" redefined


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30689 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-02-21 22:14:11 +00:00
diego d306b727b1 Remove pointless '#if 1' preprocessor directives.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30654 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-02-19 10:22:29 +00:00
reimar 134bbb8cd8 Add a InitializeCriticalSectionAndSpinCount function.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30640 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-02-18 20:24:52 +00:00
reimar 87edb382c6 Add a GetModuleHandleW implementation.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30639 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-02-18 20:23:05 +00:00
reimar 2903a8583f Use snprintf to ensure we do not write outside the buffer bounds
when recording stub names into export_names.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30638 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-02-18 20:20:23 +00:00
diego f34f239cce Explain WIN32_LOADER definition hack.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30545 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-02-12 14:25:25 +00:00
diego 5b01485ea3 Get rid of pointless CONFIG_QTX_CODECS --> QTX preprocessor indirection.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30544 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-02-12 14:10:21 +00:00
diego c53143fffb Fix linking of loader test programs when loader is disabled.
Dependencies were only set correctly if the loader code was enabled.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30542 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-02-12 13:45:19 +00:00
reimar 77e66ee012 Add stubs for several functions, needed for CineForm codec.
Patch by Steinar H. Gunderson [sgunderson bigfoot com]
with some modifications by me.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30531 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-02-09 19:43:02 +00:00
reimar ee2a738ff8 Document some of the ext_stub magic.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30320 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-01-16 15:04:17 +00:00
reimar e09b799ade 100l, forgot to change the "magic" value in the stub also in the place replacing it.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30319 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-01-16 15:02:49 +00:00
reimar af6f08ce6a Place a volatile at a more appropriate place.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30268 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-01-10 19:59:36 +00:00
reimar acc53c9609 Change dummy value to fit into int.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30267 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-01-10 19:58:01 +00:00
reimar c65994b907 Remove return statement from function that has no return value.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30266 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-01-10 19:52:59 +00:00
reimar cbdb16328c Avoid excessive fflush in dbgprintf if we didn't even print anything.
Patch by Steinar H. Gunderson [sgunderson bigfoot com]


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30262 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-01-10 15:37:14 +00:00
reimar 7199cc3c4d Implement dummy EncodePointer/DecodePointer functions needed for e.g. lagarith.dll
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29767 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-10-10 09:27:22 +00:00