annotate loader/dshow/cmediasample.h @ 30795:1001c606f94c

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.
author sesse
date Thu, 04 Mar 2010 15:57:08 +0000
parents a8ea87c71d18
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26045
a8ea87c71d18 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25794
diff changeset
1 #ifndef MPLAYER_CMEDIASAMPLE_H
a8ea87c71d18 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25794
diff changeset
2 #define MPLAYER_CMEDIASAMPLE_H
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
3
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
4 #include "interfaces.h"
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
5 #include "guids.h"
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
6
25794
2c8cdb9123b8 Fix a ton of illegal identifiers. Identifiers starting with __ or _ and a
diego
parents: 3467
diff changeset
7 typedef struct CMediaSample CMediaSample;
2c8cdb9123b8 Fix a ton of illegal identifiers. Identifiers starting with __ or _ and a
diego
parents: 3467
diff changeset
8 struct CMediaSample
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
9 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
10 IMediaSample_vt* vt;
3130
623cdb771e97 avifile sync. seems to some bugs fixed...
arpi
parents: 3056
diff changeset
11 DECLARE_IUNKNOWN();
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
12 IMemAllocator* all;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
13 int size;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
14 int actual_size;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
15 char* block;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
16 char* own_block;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
17 int isPreroll;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
18 int isSyncPoint;
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
19 int isDiscontinuity;
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
20 LONGLONG time_start;
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
21 LONGLONG time_end;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
22 AM_MEDIA_TYPE media_type;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
23 int type_valid;
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
24 void ( *SetPointer) (CMediaSample* This, char* pointer);
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
25 void ( *ResetPointer) (CMediaSample* This); // FIXME replace with Set & 0
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
26 };
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
27
25794
2c8cdb9123b8 Fix a ton of illegal identifiers. Identifiers starting with __ or _ and a
diego
parents: 3467
diff changeset
28 CMediaSample* CMediaSampleCreate(IMemAllocator* allocator, int size);
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
29 // called from allocator
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
30 void CMediaSample_Destroy(CMediaSample* This);
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
31
26045
a8ea87c71d18 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25794
diff changeset
32 #endif /* MPLAYER_CMEDIASAMPLE_H */