Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
4a742a33
Commit
4a742a33
authored
Oct 07, 2012
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
android: threads support
parent
314fd505
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
513 additions
and
5 deletions
+513
-5
include/vlc_threads.h
include/vlc_threads.h
+24
-3
src/Makefile.am
src/Makefile.am
+1
-1
src/android/thread.c
src/android/thread.c
+487
-0
src/libvlc.h
src/libvlc.h
+1
-1
No files found.
include/vlc_threads.h
View file @
4a742a33
...
@@ -42,6 +42,15 @@
...
@@ -42,6 +42,15 @@
# define pthread_sigmask sigprocmask
# define pthread_sigmask sigprocmask
#elif defined( __ANDROID__ )
/* pthreads subset without pthread_cancel() */
# define LIBVLC_NEED_SEMAPHORE
# define LIBVLC_NEED_RWLOCK
# include <unistd.h>
/* _POSIX_SPIN_LOCKS */
# include <pthread.h>
# include <poll.h>
#else
/* pthreads (like Linux & BSD) */
#else
/* pthreads (like Linux & BSD) */
# define LIBVLC_USE_PTHREAD 1
# define LIBVLC_USE_PTHREAD 1
# define LIBVLC_USE_PTHREAD_CANCEL 1
# define LIBVLC_USE_PTHREAD_CANCEL 1
...
@@ -73,7 +82,7 @@
...
@@ -73,7 +82,7 @@
# define VLC_THREAD_PRIORITY_OUTPUT 22
# define VLC_THREAD_PRIORITY_OUTPUT 22
# define VLC_THREAD_PRIORITY_HIGHEST 22
# define VLC_THREAD_PRIORITY_HIGHEST 22
#elif defined(LIBVLC_USE_PTHREAD)
#elif defined(LIBVLC_USE_PTHREAD)
|| defined(__ANDROID__)
# define VLC_THREAD_PRIORITY_LOW 0
# define VLC_THREAD_PRIORITY_LOW 0
# define VLC_THREAD_PRIORITY_INPUT 10
# define VLC_THREAD_PRIORITY_INPUT 10
# define VLC_THREAD_PRIORITY_AUDIO 5
# define VLC_THREAD_PRIORITY_AUDIO 5
...
@@ -116,7 +125,17 @@
...
@@ -116,7 +125,17 @@
* Type definitions
* Type definitions
*****************************************************************************/
*****************************************************************************/
#if defined (LIBVLC_USE_PTHREAD)
#if defined (__ANDROID__)
typedef
struct
vlc_thread
*
vlc_thread_t
;
typedef
pthread_mutex_t
vlc_mutex_t
;
#define VLC_STATIC_MUTEX PTHREAD_MUTEX_INITIALIZER
typedef
pthread_cond_t
vlc_cond_t
;
#define VLC_STATIC_COND PTHREAD_COND_INITIALIZER
typedef
pthread_key_t
vlc_threadvar_t
;
typedef
struct
vlc_timer
*
vlc_timer_t
;
#elif defined (LIBVLC_USE_PTHREAD)
typedef
pthread_t
vlc_thread_t
;
typedef
pthread_t
vlc_thread_t
;
typedef
pthread_mutex_t
vlc_mutex_t
;
typedef
pthread_mutex_t
vlc_mutex_t
;
#define VLC_STATIC_MUTEX PTHREAD_MUTEX_INITIALIZER
#define VLC_STATIC_MUTEX PTHREAD_MUTEX_INITIALIZER
...
@@ -332,7 +351,7 @@ VLC_API int vlc_savecancel(void);
...
@@ -332,7 +351,7 @@ VLC_API int vlc_savecancel(void);
VLC_API
void
vlc_restorecancel
(
int
state
);
VLC_API
void
vlc_restorecancel
(
int
state
);
VLC_API
void
vlc_testcancel
(
void
);
VLC_API
void
vlc_testcancel
(
void
);
#if defined (LIBVLC_USE_PTHREAD_CANCEL)
#if defined (LIBVLC_USE_PTHREAD_CANCEL)
|| defined(__ANDROID__)
/**
/**
* Registers a new procedure to run if the thread is cancelled (or otherwise
* Registers a new procedure to run if the thread is cancelled (or otherwise
* exits prematurely). Any call to vlc_cleanup_push() <b>must</b> paired with a
* exits prematurely). Any call to vlc_cleanup_push() <b>must</b> paired with a
...
@@ -383,7 +402,9 @@ struct vlc_cleanup_t
...
@@ -383,7 +402,9 @@ struct vlc_cleanup_t
vlc_control_cancel (VLC_CLEANUP_POP); \
vlc_control_cancel (VLC_CLEANUP_POP); \
vlc_cleanup_data.proc (vlc_cleanup_data.data); \
vlc_cleanup_data.proc (vlc_cleanup_data.data); \
} while (0)
} while (0)
#endif
/* LIBVLC_USE_PTHREAD_CANCEL || __ANDROID__ */
#if !defined (LIBVLC_USE_PTHREAD_CANCEL)
/* poll() with cancellation */
/* poll() with cancellation */
static
inline
int
vlc_poll
(
struct
pollfd
*
fds
,
unsigned
nfds
,
int
timeout
)
static
inline
int
vlc_poll
(
struct
pollfd
*
fds
,
unsigned
nfds
,
int
timeout
)
{
{
...
...
src/Makefile.am
View file @
4a742a33
...
@@ -259,9 +259,9 @@ SOURCES_libvlc_darwin = \
...
@@ -259,9 +259,9 @@ SOURCES_libvlc_darwin = \
SOURCES_libvlc_android
=
\
SOURCES_libvlc_android
=
\
android/dirs.c
\
android/dirs.c
\
android/thread.c
\
posix/filesystem.c
\
posix/filesystem.c
\
posix/plugin.c
\
posix/plugin.c
\
posix/thread.c
\
posix/timer.c
\
posix/timer.c
\
posix/linux_cpu.c
\
posix/linux_cpu.c
\
posix/linux_specific.c
\
posix/linux_specific.c
\
...
...
src/android/thread.c
0 → 100644
View file @
4a742a33
This diff is collapsed.
Click to expand it.
src/libvlc.h
View file @
4a742a33
...
@@ -66,7 +66,7 @@ void vlc_threads_setup (libvlc_int_t *);
...
@@ -66,7 +66,7 @@ void vlc_threads_setup (libvlc_int_t *);
void
vlc_trace
(
const
char
*
fn
,
const
char
*
file
,
unsigned
line
);
void
vlc_trace
(
const
char
*
fn
,
const
char
*
file
,
unsigned
line
);
#define vlc_backtrace() vlc_trace(__func__, __FILE__, __LINE__)
#define vlc_backtrace() vlc_trace(__func__, __FILE__, __LINE__)
#if
defined (LIBVLC_USE_PTHREAD
) && !defined (NDEBUG)
#if
(defined (LIBVLC_USE_PTHREAD) || defined(__ANDROID__)
) && !defined (NDEBUG)
void
vlc_assert_locked
(
vlc_mutex_t
*
);
void
vlc_assert_locked
(
vlc_mutex_t
*
);
#else
#else
# define vlc_assert_locked( m ) (void)m
# define vlc_assert_locked( m ) (void)m
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment