Commit 10d24a34 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Split headers

parent d71f9f6d
......@@ -10,6 +10,7 @@ npvlcdir = $(libdir)/mozilla/plugins
AM_CPPFLAGS = $(LIBVLC_CFLAGS)
libvlcplugin_la_SOURCES = \
common.h \
events.h \
events.cpp \
vlcshell.h \
......
/*****************************************************************************
* vlcplugin.h: a VLC plugin for Mozilla
*****************************************************************************
* Copyright (C) 2002-2012 VideoLAN
* $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Damien Fouilleul <damienf.fouilleul@laposte.net>
* Jean-Paul Saman <jpsaman@videolan.org>
* Sergey Radionov <rsatom@gmail.com>
* Jean-Baptiste Kempf <jb@videolan.org>
* Cheng Sun <chengsun9@gmail.com>
*
* This program 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.
*
* This program 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef __VLCPLUGIN_COMMON_H__
#define __VLCPLUGIN_COMMON_H__
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
// Setup XP_MACOSX, XP_UNIX, XP_WIN
#if defined(_WIN32)
# define XP_WIN 1
#elif defined(__APPLE__)
# define XP_MACOSX 1
#else
# define XP_UNIX 1
# define MOZ_X11 1
#endif
#if !defined(XP_MACOSX) && !defined(XP_UNIX) && !defined(XP_WIN)
# define XP_UNIX 1
#elif defined(XP_MACOSX)
# undef XP_UNIX
#endif
#ifndef __MAX
# define __MAX(a, b) ( ((a) > (b)) ? (a) : (b) )
#endif
#ifndef __MIN
# define __MIN(a, b) ( ((a) < (b)) ? (a) : (b) )
#endif
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
// Include stdint before NP*.h
#include <stdint.h>
// We use <npfunctions.h> insted of including <npapi.h>
// To avoid using Microsoft SDK (rather then from Mozilla SDK),
#include <npfunctions.h>
#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
typedef uint16 NPuint16_t;
typedef int16 NPint16_t;
typedef int32 NPint32_t;
#else
typedef uint16_t NPuint16_t;
typedef int16_t NPint16_t;
typedef int32_t NPint32_t;
#endif
/* Lock includes */
#ifdef XP_WIN
# include <windows.h>
#elif defined(XP_UNIX)
# include <pthread.h>
#endif
#include <assert.h>
typedef struct {
#if defined(XP_UNIX)
pthread_mutex_t mutex;
#elif defined(XP_WIN)
CRITICAL_SECTION cs;
#else
# warning "locking not implemented in this platform"
#endif
} plugin_lock_t;
/*****************************************************************************
* Lock utility functions
*****************************************************************************/
static void plugin_lock_init(plugin_lock_t *lock)
{
assert(lock);
#if defined(XP_UNIX)
pthread_mutex_init(&lock->mutex, NULL);
#elif defined(XP_WIN)
InitializeCriticalSection(&lock->cs);
#else
#warning "locking not implemented in this platform"
#endif
}
static void plugin_lock_destroy(plugin_lock_t *lock)
{
assert(lock);
#if defined(XP_UNIX)
pthread_mutex_destroy(&lock->mutex);
#elif defined(XP_WIN)
DeleteCriticalSection(&lock->cs);
#else
#warning "locking not implemented in this platform"
#endif
}
static void plugin_lock(plugin_lock_t *lock)
{
assert(lock);
#if defined(XP_UNIX)
pthread_mutex_lock(&lock->mutex);
#elif defined(XP_WIN)
EnterCriticalSection(&lock->cs);
#else
#warning "locking not implemented in this platform"
#endif
}
static void plugin_unlock(plugin_lock_t *lock)
{
assert(lock);
#if defined(XP_UNIX)
pthread_mutex_unlock(&lock->mutex);
#elif defined(XP_WIN)
LeaveCriticalSection(&lock->cs);
#else
#warning "locking not implemented in this platform"
#endif
}
#endif /* __VLCPLUGIN_H__ */
/*****************************************************************************
* vlcplugin_base.h: a VLC plugin for Mozilla
* events.cpp: events for the VLC Plugin
*****************************************************************************
* Copyright (C) 2002-2009 the VideoLAN team
* $Id$
......
......@@ -31,7 +31,7 @@
#include <assert.h>
#include <vector>
#include "vlcplugin.h"
#include "common.h"
#include "../common/vlc_player.h"
typedef struct {
......
......@@ -57,8 +57,12 @@
#endif
#include <cstring>
#include "../common.h"
#include "../vlcshell.h"
#ifdef USE_GTK
# include <gtk/gtk.h>
#endif
/*
* Define PLUGIN_TRACE to have the wrapper functions print
* messages to stderr whenever they are called.
......
......@@ -33,124 +33,21 @@
# include "config.h"
#endif
// Setup XP_MACOSX, XP_UNIX, XP_WIN
#if defined(_WIN32)
# define XP_WIN 1
#elif defined(__APPLE__)
# define XP_MACOSX 1
#else
# define XP_UNIX 1
# define MOZ_X11 1
#endif
#if !defined(XP_MACOSX) && !defined(XP_UNIX) && !defined(XP_WIN)
# define XP_UNIX 1
#elif defined(XP_MACOSX)
# undef XP_UNIX
#endif
#ifndef __MAX
# define __MAX(a, b) ( ((a) > (b)) ? (a) : (b) )
#endif
#ifndef __MIN
# define __MIN(a, b) ( ((a) < (b)) ? (a) : (b) )
#endif
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
// Include stdint before NP*.h
#include <stdint.h>
// We use <npfunctions.h> insted of including <npapi.h>
// To avoid using Microsoft SDK (rather then from Mozilla SDK),
#include <npfunctions.h>
#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
typedef uint16 NPuint16_t;
typedef int16 NPint16_t;
typedef int32 NPint32_t;
#else
typedef uint16_t NPuint16_t;
typedef int16_t NPint16_t;
typedef int32_t NPint32_t;
#endif
/* Lock includes */
#ifdef XP_WIN
# include <windows.h>
#elif defined(XP_UNIX)
# include <pthread.h>
#endif
#include <assert.h>
typedef struct {
#if defined(XP_UNIX)
pthread_mutex_t mutex;
# if defined(USE_GTK)
# include "vlcplugin_gtk.h"
typedef class VlcPluginGtk VlcPlugin;
# else
# include "vlcplugin_xcb.h"
typedef class VlcPluginXcb VlcPlugin;
# endif
#elif defined(XP_WIN)
CRITICAL_SECTION cs;
#else
# warning "locking not implemented in this platform"
#endif
} plugin_lock_t;
/*****************************************************************************
* Lock utility functions
*****************************************************************************/
static void plugin_lock_init(plugin_lock_t *lock)
{
assert(lock);
#if defined(XP_UNIX)
pthread_mutex_init(&lock->mutex, NULL);
#elif defined(XP_WIN)
InitializeCriticalSection(&lock->cs);
#else
#warning "locking not implemented in this platform"
#endif
}
static void plugin_lock_destroy(plugin_lock_t *lock)
{
assert(lock);
#if defined(XP_UNIX)
pthread_mutex_destroy(&lock->mutex);
#elif defined(XP_WIN)
DeleteCriticalSection(&lock->cs);
#else
#warning "locking not implemented in this platform"
#endif
}
static void plugin_lock(plugin_lock_t *lock)
{
assert(lock);
#if defined(XP_UNIX)
pthread_mutex_lock(&lock->mutex);
#elif defined(XP_WIN)
EnterCriticalSection(&lock->cs);
#else
#warning "locking not implemented in this platform"
#endif
}
static void plugin_unlock(plugin_lock_t *lock)
{
assert(lock);
#if defined(XP_UNIX)
pthread_mutex_unlock(&lock->mutex);
#elif defined(XP_WIN)
LeaveCriticalSection(&lock->cs);
#else
#warning "locking not implemented in this platform"
# include "vlcplugin_win.h"
typedef class VlcPluginWin VlcPlugin;
#elif defined(XP_MACOSX)
# include "vlcplugin_mac.h"
typedef class VlcPluginMac VlcPlugin;
#endif
}
#include "vlcplugin_base.h"
#endif /* __VLCPLUGIN_H__ */
......@@ -31,7 +31,7 @@
#ifndef __VLCPLUGIN_BASE_H__
#define __VLCPLUGIN_BASE_H__
#include "vlcplugin.h"
#include "common.h"
#include "events.h"
#include <vector>
......@@ -198,22 +198,6 @@ private:
static std::set<VlcPluginBase*> _instances;
};
#if defined(XP_UNIX)
# if defined(USE_GTK)
# include "vlcplugin_gtk.h"
typedef class VlcPluginGtk VlcPlugin;
# else
# include "vlcplugin_xcb.h"
typedef class VlcPluginXcb VlcPlugin;
# endif
#elif defined(XP_WIN)
# include "vlcplugin_win.h"
typedef class VlcPluginWin VlcPlugin;
#elif defined(XP_MACOSX)
# include "vlcplugin_mac.h"
typedef class VlcPluginMac VlcPlugin;
#endif
#ifdef WINDOWLESS
const char DEF_CHROMA[] = "RV32";
......
......@@ -34,9 +34,9 @@
#include <string.h>
#include <stdlib.h>
#include "vlcplugin_base.h"
#include "vlcplugin.h"
#include "common.h"
#include "vlcshell.h"
#include "vlcplugin.h"
static char mimetype[] =
/* MPEG-1 and MPEG-2 */
......
......@@ -28,7 +28,6 @@
# include "config.h"
#endif
#include "vlcplugin.h"
NPP_GET_MIME_CONST char * NPP_GetMIMEDescription( void );
......
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