Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
dfdc294e
Commit
dfdc294e
authored
Aug 29, 2006
by
Damien Fouilleul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- more javascript fixes
- code cleanup
parent
873a4def
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
309 additions
and
148 deletions
+309
-148
mozilla/control/npolibvlc.cpp
mozilla/control/npolibvlc.cpp
+36
-37
mozilla/control/npolibvlc.h
mozilla/control/npolibvlc.h
+15
-22
mozilla/control/nporuntime.h
mozilla/control/nporuntime.h
+47
-27
mozilla/control/npovlc.cpp
mozilla/control/npovlc.cpp
+47
-48
mozilla/control/npovlc.h
mozilla/control/npovlc.h
+5
-7
mozilla/test.html
mozilla/test.html
+148
-0
mozilla/vlcplugin.cpp
mozilla/vlcplugin.cpp
+11
-7
No files found.
mozilla/control/npolibvlc.cpp
View file @
dfdc294e
/*****************************************************************************
* vlc.cpp: support for NPRuntime API for Netscape Script-able plugins
* FYI: http://www.mozilla.org/projects/plugins/npruntime.html
* npolibvlc.cpp: official Javascript APIs
*****************************************************************************
* Copyright (C) 200
5
the VideoLAN team
* Copyright (C) 200
2-2006
the VideoLAN team
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
*
...
...
@@ -42,15 +41,10 @@
LibvlcRootNPObject
::
LibvlcRootNPObject
(
NPP
instance
,
const
NPClass
*
aClass
)
:
RuntimeNPObject
(
instance
,
aClass
)
{
static
NPClass
*
audioClass
=
new
RuntimeNPClass
<
LibvlcAudioNPObject
>
();
static
NPClass
*
inputClass
=
new
RuntimeNPClass
<
LibvlcInputNPObject
>
();
static
NPClass
*
playlistClass
=
new
RuntimeNPClass
<
LibvlcPlaylistNPObject
>
();
static
NPClass
*
videoClass
=
new
RuntimeNPClass
<
LibvlcVideoNPObject
>
();
audioObj
=
NPN_CreateObject
(
instance
,
audioClass
);
inputObj
=
NPN_CreateObject
(
instance
,
inputClass
);
playlistObj
=
NPN_CreateObject
(
instance
,
playlistClass
);
videoObj
=
NPN_CreateObject
(
instance
,
videoClass
);
audioObj
=
NPN_CreateObject
(
instance
,
RuntimeNPClass
<
LibvlcAudioNPObject
>::
getClass
());
inputObj
=
NPN_CreateObject
(
instance
,
RuntimeNPClass
<
LibvlcInputNPObject
>::
getClass
());
playlistObj
=
NPN_CreateObject
(
instance
,
RuntimeNPClass
<
LibvlcPlaylistNPObject
>::
getClass
());
videoObj
=
NPN_CreateObject
(
instance
,
RuntimeNPClass
<
LibvlcVideoNPObject
>::
getClass
());
}
LibvlcRootNPObject
::~
LibvlcRootNPObject
()
...
...
@@ -69,6 +63,8 @@ const NPUTF8 * const LibvlcRootNPObject::propertyNames[] =
"video"
,
};
const
int
LibvlcRootNPObject
::
propertyCount
=
sizeof
(
LibvlcRootNPObject
::
propertyNames
)
/
sizeof
(
NPUTF8
*
);
enum
LibvlcRootNPObjectPropertyIds
{
ID_audio
=
0
,
...
...
@@ -77,8 +73,6 @@ enum LibvlcRootNPObjectPropertyIds
ID_video
,
};
const
int
LibvlcRootNPObject
::
propertyCount
=
sizeof
(
LibvlcRootNPObject
::
propertyNames
)
/
sizeof
(
NPUTF8
*
);
RuntimeNPObject
::
InvokeResult
LibvlcRootNPObject
::
getProperty
(
int
index
,
NPVariant
&
result
)
{
switch
(
index
)
...
...
@@ -116,14 +110,14 @@ const NPUTF8 * const LibvlcAudioNPObject::propertyNames[] =
"volume"
,
};
const
int
LibvlcAudioNPObject
::
propertyCount
=
sizeof
(
LibvlcAudioNPObject
::
propertyNames
)
/
sizeof
(
NPUTF8
*
);
enum
LibvlcAudioNPObjectPropertyIds
{
ID_mute
,
ID_volume
,
};
const
int
LibvlcAudioNPObject
::
propertyCount
=
sizeof
(
LibvlcAudioNPObject
::
propertyNames
)
/
sizeof
(
NPUTF8
*
);
RuntimeNPObject
::
InvokeResult
LibvlcAudioNPObject
::
getProperty
(
int
index
,
NPVariant
&
result
)
{
VlcPlugin
*
p_plugin
=
reinterpret_cast
<
VlcPlugin
*>
(
_instance
->
pdata
);
...
...
@@ -211,13 +205,13 @@ const NPUTF8 * const LibvlcAudioNPObject::methodNames[] =
"togglemute"
,
};
const
int
LibvlcAudioNPObject
::
methodCount
=
sizeof
(
LibvlcAudioNPObject
::
methodNames
)
/
sizeof
(
NPUTF8
*
);
enum
LibvlcAudioNPObjectMethodIds
{
ID_togglemute
,
};
const
int
LibvlcAudioNPObject
::
methodCount
=
sizeof
(
LibvlcAudioNPObject
::
methodNames
)
/
sizeof
(
NPUTF8
*
);
RuntimeNPObject
::
InvokeResult
LibvlcAudioNPObject
::
invoke
(
int
index
,
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
&
result
)
{
VlcPlugin
*
p_plugin
=
reinterpret_cast
<
VlcPlugin
*>
(
_instance
->
pdata
);
...
...
@@ -265,6 +259,8 @@ const NPUTF8 * const LibvlcInputNPObject::propertyNames[] =
"hasvout"
,
};
const
int
LibvlcInputNPObject
::
propertyCount
=
sizeof
(
LibvlcInputNPObject
::
propertyNames
)
/
sizeof
(
NPUTF8
*
);
enum
LibvlcInputNPObjectPropertyIds
{
ID_length
,
...
...
@@ -274,8 +270,6 @@ enum LibvlcInputNPObjectPropertyIds
ID_hasvout
,
};
const
int
LibvlcInputNPObject
::
propertyCount
=
sizeof
(
LibvlcInputNPObject
::
propertyNames
)
/
sizeof
(
NPUTF8
*
);
RuntimeNPObject
::
InvokeResult
LibvlcInputNPObject
::
getProperty
(
int
index
,
NPVariant
&
result
)
{
VlcPlugin
*
p_plugin
=
reinterpret_cast
<
VlcPlugin
*>
(
_instance
->
pdata
);
...
...
@@ -449,14 +443,14 @@ const NPUTF8 * const LibvlcPlaylistNPObject::propertyNames[] =
"isplaying"
,
};
const
int
LibvlcPlaylistNPObject
::
propertyCount
=
sizeof
(
LibvlcPlaylistNPObject
::
propertyNames
)
/
sizeof
(
NPUTF8
*
);
enum
LibvlcPlaylistNPObjectPropertyIds
{
ID_itemscount
,
ID_isplaying
,
};
const
int
LibvlcPlaylistNPObject
::
propertyCount
=
sizeof
(
LibvlcPlaylistNPObject
::
propertyNames
)
/
sizeof
(
NPUTF8
*
);
RuntimeNPObject
::
InvokeResult
LibvlcPlaylistNPObject
::
getProperty
(
int
index
,
NPVariant
&
result
)
{
VlcPlugin
*
p_plugin
=
reinterpret_cast
<
VlcPlugin
*>
(
_instance
->
pdata
);
...
...
@@ -508,6 +502,8 @@ const NPUTF8 * const LibvlcPlaylistNPObject::methodNames[] =
"deleteitem"
};
const
int
LibvlcPlaylistNPObject
::
methodCount
=
sizeof
(
LibvlcPlaylistNPObject
::
methodNames
)
/
sizeof
(
NPUTF8
*
);
enum
LibvlcPlaylistNPObjectMethodIds
{
ID_add
,
...
...
@@ -520,8 +516,6 @@ enum LibvlcPlaylistNPObjectMethodIds
ID_deleteitem
,
};
const
int
LibvlcPlaylistNPObject
::
methodCount
=
sizeof
(
LibvlcPlaylistNPObject
::
methodNames
)
/
sizeof
(
NPUTF8
*
);
RuntimeNPObject
::
InvokeResult
LibvlcPlaylistNPObject
::
invoke
(
int
index
,
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
&
result
)
{
VlcPlugin
*
p_plugin
=
reinterpret_cast
<
VlcPlugin
*>
(
_instance
->
pdata
);
...
...
@@ -534,21 +528,18 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
{
case
ID_add
:
{
char
*
url
=
NULL
;
char
*
name
=
NULL
;
int
i_options
=
0
;
char
**
ppsz_options
=
NULL
;
if
(
(
argCount
<
1
)
||
(
argCount
>
3
)
)
return
INVOKERESULT_NO_SUCH_METHOD
;
char
*
url
=
NULL
;
// grab URL
if
(
NPVARIANT_IS_STRING
(
args
[
0
])
)
{
char
*
s
=
stringValue
(
NPVARIANT_TO_STRING
(
args
[
0
]));
if
(
s
)
{
char
*
url
=
p_plugin
->
getAbsoluteURL
(
s
);
url
=
p_plugin
->
getAbsoluteURL
(
s
);
delete
s
;
if
(
!
url
)
// what happened ?
...
...
@@ -560,6 +551,8 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
else
return
INVOKERESULT_NO_SUCH_METHOD
;
char
*
name
=
NULL
;
// grab name if available
if
(
argCount
>
1
)
{
...
...
@@ -575,6 +568,9 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
return
INVOKERESULT_NO_SUCH_METHOD
;
}
int
i_options
=
0
;
char
**
ppsz_options
=
NULL
;
// grab options if available
if
(
argCount
>
2
)
{
...
...
@@ -584,12 +580,12 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
}
else
if
(
NPVARIANT_IS_STRING
(
args
[
2
])
)
{
parseOptions
(
NPVARIANT_TO_STRING
(
args
[
0
]),
&
i_options
,
&
ppsz_options
);
parseOptions
(
NPVARIANT_TO_STRING
(
args
[
2
]),
&
i_options
,
&
ppsz_options
);
}
else
if
(
NPVARIANT_IS_OBJECT
(
args
[
3
])
)
else
if
(
NPVARIANT_IS_OBJECT
(
args
[
2
])
)
{
parseOptions
(
NPVARIANT_TO_OBJECT
(
args
[
0
]),
&
i_options
,
&
ppsz_options
);
parseOptions
(
NPVARIANT_TO_OBJECT
(
args
[
2
]),
&
i_options
,
&
ppsz_options
);
}
}
...
...
@@ -603,9 +599,11 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
delete
name
;
for
(
int
i
=
0
;
i
<
i_options
;
++
i
)
{
delete
ppsz_options
[
i
];
if
(
ppsz_options
[
i
]
)
free
(
ppsz_options
[
i
]);
}
delete
ppsz_options
;
if
(
ppsz_options
)
free
(
ppsz_options
);
if
(
libvlc_exception_raised
(
&
ex
)
)
{
NPN_SetException
(
this
,
libvlc_exception_get_message
(
&
ex
));
...
...
@@ -762,7 +760,7 @@ void LibvlcPlaylistNPObject::parseOptions(const NPString &s, int *i_options, cha
{
// skip leading blanks
while
(
(
val
<
end
)
&&
((
*
val
==
' '
)
||
(
*
val
!
=
'\t'
))
)
&&
((
*
val
==
' '
)
||
(
*
val
=
=
'\t'
))
)
++
val
;
char
*
start
=
val
;
...
...
@@ -813,8 +811,8 @@ void LibvlcPlaylistNPObject::parseOptions(const NPString &s, int *i_options, cha
void
LibvlcPlaylistNPObject
::
parseOptions
(
NPObject
*
obj
,
int
*
i_options
,
char
***
ppsz_options
)
{
NPIdentifier
name
=
NPN_GetStringIdentifier
(
"length"
);
/* we are expecting to have a Javascript Array object */
NPIdentifier
name
=
NPN_GetStringIdentifier
(
"length"
);
if
(
NPN_HasProperty
(
_instance
,
obj
,
name
)
)
{
NPVariant
value
;
...
...
@@ -822,6 +820,7 @@ void LibvlcPlaylistNPObject::parseOptions(NPObject *obj, int *i_options, char***
{
int
count
=
numberValue
(
value
);
NPN_ReleaseVariantValue
(
&
value
);
if
(
count
)
{
long
capacity
=
16
;
...
...
mozilla/control/npolibvlc.h
View file @
dfdc294e
/*****************************************************************************
*
vlc.h: a VLC plugin for Mozilla
*
npolibvlc.h: official Javascript APIs
*****************************************************************************
* Copyright (C) 2002-2005 the VideoLAN team
* $Id: vlcruntime.h 14466 2006-02-22 23:34:54Z dionoea $
* Copyright (C) 2002-2006 the VideoLAN team
*
* Authors: Damien Fouilleul <damien.fouilleul@laposte.net>
*
...
...
@@ -29,13 +28,12 @@
class
LibvlcRootNPObject
:
public
RuntimeNPObject
{
public:
LibvlcRootNPObject
(
NPP
instance
,
const
NPClass
*
aClass
);
virtual
~
LibvlcRootNPObject
();
protected:
friend
class
RuntimeNPClass
<
LibvlcRootNPObject
>
;
LibvlcRootNPObject
(
NPP
instance
,
const
NPClass
*
aClass
);
virtual
~
LibvlcRootNPObject
();
static
const
int
propertyCount
;
static
const
NPUTF8
*
const
propertyNames
[];
...
...
@@ -52,12 +50,11 @@ protected:
class
LibvlcAudioNPObject
:
public
RuntimeNPObject
{
p
ublic
:
p
rotected
:
LibvlcAudioNPObject
(
NPP
instance
,
const
NPClass
*
aClass
)
:
RuntimeNPObject
(
instance
,
aClass
)
{};
virtual
~
LibvlcAudioNPObject
()
{};
protected:
friend
class
RuntimeNPClass
<
LibvlcAudioNPObject
>
;
static
const
int
propertyCount
;
...
...
@@ -74,15 +71,14 @@ protected:
class
LibvlcInputNPObject
:
public
RuntimeNPObject
{
public:
protected:
friend
class
RuntimeNPClass
<
LibvlcInputNPObject
>
;
LibvlcInputNPObject
(
NPP
instance
,
const
NPClass
*
aClass
)
:
RuntimeNPObject
(
instance
,
aClass
)
{};
virtual
~
LibvlcInputNPObject
()
{};
protected:
friend
class
RuntimeNPClass
<
LibvlcInputNPObject
>
;
static
const
int
propertyCount
;
static
const
NPUTF8
*
const
propertyNames
[];
...
...
@@ -95,14 +91,13 @@ protected:
class
LibvlcPlaylistNPObject
:
public
RuntimeNPObject
{
public:
protected:
friend
class
RuntimeNPClass
<
LibvlcPlaylistNPObject
>
;
LibvlcPlaylistNPObject
(
NPP
instance
,
const
NPClass
*
aClass
)
:
RuntimeNPObject
(
instance
,
aClass
)
{};
virtual
~
LibvlcPlaylistNPObject
()
{};
protected:
friend
class
RuntimeNPClass
<
LibvlcPlaylistNPObject
>
;
static
const
int
propertyCount
;
static
const
NPUTF8
*
const
propertyNames
[];
...
...
@@ -119,14 +114,13 @@ protected:
class
LibvlcVideoNPObject
:
public
RuntimeNPObject
{
public:
protected:
friend
class
RuntimeNPClass
<
LibvlcVideoNPObject
>
;
LibvlcVideoNPObject
(
NPP
instance
,
const
NPClass
*
aClass
)
:
RuntimeNPObject
(
instance
,
aClass
)
{};
virtual
~
LibvlcVideoNPObject
()
{};
protected:
friend
class
RuntimeNPClass
<
LibvlcVideoNPObject
>
;
static
const
int
propertyCount
;
static
const
NPUTF8
*
const
propertyNames
[];
...
...
@@ -137,6 +131,5 @@ protected:
static
const
NPUTF8
*
const
methodNames
[];
InvokeResult
invoke
(
int
index
,
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
&
result
);
};
mozilla/control/nporuntime.h
View file @
dfdc294e
/*****************************************************************************
* runtime.h: a VLC plugin for Mozilla
* runtime.cpp: support for NPRuntime API for Netscape Script-able plugins
* FYI: http://www.mozilla.org/projects/plugins/npruntime.html
*****************************************************************************
* Copyright (C) 2002-2005 the VideoLAN team
* $Id: RuntimeNPObject.h 14466 2006-02-22 23:34:54Z dionoea $
...
...
@@ -31,9 +32,21 @@
#include <npapi.h>
#include <npruntime.h>
static
void
RuntimeNPClassDeallocate
(
NPObject
*
npobj
);
static
void
RuntimeNPClassInvalidate
(
NPObject
*
npobj
);
static
bool
RuntimeNPClassInvokeDefault
(
NPObject
*
npobj
,
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
*
result
);
class
RuntimeNPObject
:
public
NPObject
{
public:
/*
** utility functions
*/
static
bool
isNumberValue
(
const
NPVariant
&
v
)
{
return
NPVARIANT_IS_INT32
(
v
)
...
...
@@ -55,6 +68,8 @@ public:
static
char
*
stringValue
(
const
NPString
&
v
);
static
char
*
stringValue
(
const
NPVariant
&
v
);
protected:
RuntimeNPObject
(
NPP
instance
,
const
NPClass
*
aClass
)
:
_instance
(
instance
)
{
...
...
@@ -63,12 +78,6 @@ public:
};
virtual
~
RuntimeNPObject
()
{};
/*
** utility functions
*/
protected:
enum
InvokeResult
{
INVOKERESULT_NO_ERROR
=
0
,
/* returns no error */
...
...
@@ -79,17 +88,18 @@ protected:
INVOKERESULT_OUT_OF_MEMORY
=
5
,
/* throws out of memory */
};
template
<
class
RuntimeNPObject
>
friend
void
RuntimeNPClassInvalidate
(
NPObject
*
npobj
);
friend
void
RuntimeNPClassDeallocate
(
NPObject
*
npobj
);
friend
void
RuntimeNPClassInvalidate
(
NPObject
*
npobj
);
template
<
class
RuntimeNPObject
>
friend
bool
RuntimeNPClassGetProperty
(
NPObject
*
npobj
,
NPIdentifier
name
,
NPVariant
*
result
);
template
<
class
RuntimeNPObject
>
friend
bool
RuntimeNPClassSetProperty
(
NPObject
*
npobj
,
NPIdentifier
name
,
const
NPVariant
*
value
);
template
<
class
RuntimeNPObject
>
friend
bool
RuntimeNPClassRemoveProperty
(
NPObject
*
npobj
,
NPIdentifier
name
);
template
<
class
RuntimeNPObject
>
friend
bool
RuntimeNPClassInvoke
(
NPObject
*
npobj
,
NPIdentifier
name
,
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
*
result
);
template
<
class
RuntimeNPObject
>
friend
bool
RuntimeNPClassInvokeDefault
(
NPObject
*
npobj
,
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
*
result
);
friend
bool
RuntimeNPClassInvokeDefault
(
NPObject
*
npobj
,
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
*
result
);
virtual
InvokeResult
getProperty
(
int
index
,
NPVariant
&
result
);
virtual
InvokeResult
setProperty
(
int
index
,
const
NPVariant
&
value
);
...
...
@@ -105,12 +115,25 @@ protected:
template
<
class
T
>
class
RuntimeNPClass
:
public
NPClass
{
public:
static
NPClass
*
getClass
()
{
static
NPClass
*
singleton
=
new
RuntimeNPClass
<
T
>
;
return
singleton
;
}
protected:
RuntimeNPClass
();
virtual
~
RuntimeNPClass
();
/*template <class T
> friend NPObject *RuntimeNPClassAllocate(NPP instance, NPClass *aClass);
template
<
class
RuntimeNPObject
>
friend
NPObject
*
RuntimeNPClassAllocate
(
NPP
instance
,
NPClass
*
aClass
);
template
<
class
RuntimeNPObject
>
friend
bool
RuntimeNPClassHasMethod
(
NPObject
*
npobj
,
NPIdentifier
name
);
template <class RuntimeNPObject> friend bool RuntimeNPClassHasProperty(NPObject *npobj, NPIdentifier name);*/
template
<
class
RuntimeNPObject
>
friend
bool
RuntimeNPClassHasProperty
(
NPObject
*
npobj
,
NPIdentifier
name
);
template
<
class
RuntimeNPObject
>
friend
bool
RuntimeNPClassGetProperty
(
NPObject
*
npobj
,
NPIdentifier
name
,
NPVariant
*
result
);
template
<
class
RuntimeNPObject
>
friend
bool
RuntimeNPClassSetProperty
(
NPObject
*
npobj
,
NPIdentifier
name
,
const
NPVariant
*
value
);
template
<
class
RuntimeNPObject
>
friend
bool
RuntimeNPClassRemoveProperty
(
NPObject
*
npobj
,
NPIdentifier
name
);
template
<
class
RuntimeNPObject
>
friend
bool
RuntimeNPClassInvoke
(
NPObject
*
npobj
,
NPIdentifier
name
,
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
*
result
);
RuntimeNPObject
*
create
(
NPP
instance
)
const
;
...
...
@@ -129,14 +152,12 @@ static NPObject *RuntimeNPClassAllocate(NPP instance, NPClass *aClass)
return
(
NPObject
*
)
vClass
->
create
(
instance
);
}
template
<
class
T
>
static
void
RuntimeNPClassDeallocate
(
NPObject
*
npobj
)
{
RuntimeNPObject
*
vObj
=
static_cast
<
RuntimeNPObject
*>
(
npobj
);
delete
vObj
;
}
template
<
class
T
>
static
void
RuntimeNPClassInvalidate
(
NPObject
*
npobj
)
{
RuntimeNPObject
*
vObj
=
static_cast
<
RuntimeNPObject
*>
(
npobj
);
...
...
@@ -212,7 +233,6 @@ static bool RuntimeNPClassInvoke(NPObject *npobj, NPIdentifier name,
return
false
;
}
template
<
class
T
>
static
bool
RuntimeNPClassInvokeDefault
(
NPObject
*
npobj
,
const
NPVariant
*
args
,
uint32_t
argCount
,
...
...
@@ -245,16 +265,16 @@ RuntimeNPClass<T>::RuntimeNPClass()
// fill in NPClass structure
structVersion
=
NP_CLASS_STRUCT_VERSION
;
allocate
=
RuntimeNPClassAllocate
<
T
>
;
deallocate
=
RuntimeNPClassDeallocate
<
T
>
;
invalidate
=
RuntimeNPClassInvalidate
<
T
>
;
hasMethod
=
RuntimeNPClassHasMethod
<
T
>
;
invoke
=
RuntimeNPClassInvoke
<
T
>
;
invokeDefault
=
RuntimeNPClassInvokeDefault
<
T
>
;
hasProperty
=
RuntimeNPClassHasProperty
<
T
>
;
getProperty
=
RuntimeNPClassGetProperty
<
T
>
;
setProperty
=
RuntimeNPClassSetProperty
<
T
>
;
removeProperty
=
RuntimeNPClassRemoveProperty
<
T
>
;
allocate
=
&
RuntimeNPClassAllocate
<
T
>
;
deallocate
=
&
RuntimeNPClassDeallocate
;
invalidate
=
&
RuntimeNPClassInvalidate
;
hasMethod
=
&
RuntimeNPClassHasMethod
<
T
>
;
invoke
=
&
RuntimeNPClassInvoke
<
T
>
;
invokeDefault
=
&
RuntimeNPClassInvokeDefault
;
hasProperty
=
&
RuntimeNPClassHasProperty
<
T
>
;
getProperty
=
&
RuntimeNPClassGetProperty
<
T
>
;
setProperty
=
&
RuntimeNPClassSetProperty
<
T
>
;
removeProperty
=
&
RuntimeNPClassRemoveProperty
<
T
>
;
}
template
<
class
T
>
...
...
mozilla/control/npovlc.cpp
View file @
dfdc294e
This diff is collapsed.
Click to expand it.
mozilla/control/npovlc.h
View file @
dfdc294e
/*****************************************************************************
*
vlc.h: a VLC plugin for Mozilla
*
npovlc.h: deprecated APIs implemented in late XPCOM interface
*****************************************************************************
* Copyright (C) 2002-2005 the VideoLAN team
* $Id: vlcruntime.h 14466 2006-02-22 23:34:54Z dionoea $
* Copyright (C) 2002-2006 the VideoLAN team
*
* Authors: Damien Fouilleul <damien.fouilleul@laposte.net>
*
...
...
@@ -29,14 +28,13 @@
class
VlcNPObject
:
public
RuntimeNPObject
{
public:
protected:
friend
class
RuntimeNPClass
<
VlcNPObject
>
;
VlcNPObject
(
NPP
instance
,
const
NPClass
*
aClass
)
:
RuntimeNPObject
(
instance
,
aClass
)
{};
virtual
~
VlcNPObject
()
{};
protected:
friend
class
RuntimeNPClass
<
VlcNPObject
>
;
static
const
int
propertyCount
;
static
const
NPUTF8
*
const
propertyNames
[];
...
...
mozilla/test.html
0 → 100644
View file @
dfdc294e
<HTML>
<TITLE>
VLC Mozilla plugin test page
</TITLE>
<BODY>
<TABLE>
<TR><TD
colspan=
"2"
>
MRL:
<INPUT
size=
"90"
id=
"targetTextField"
value=
""
>
<INPUT
type=
submit
value=
"Go"
onClick=
"doGo(document.getElementById('targetTextField').value);"
>
</TD></TR>
<TR><TD
colspan=
"2"
>
<EMBED
type=
"application/x-vlc-plugin"
pluginspage=
"http://www.videolan.org/"
version=
"VideoLAN.VLCPlugin.2"
width=
"640"
height=
"480"
id=
"vlc"
>
</EMBED>
</TD></TR>
</TD><TD
width=
"15%"
>
<DIV
id=
"info"
style=
"text-align:center"
>
-:--:--/-:--:--
</DIV>
</TD></TR>
<TR><TD
colspan=
"2"
>
<INPUT
type=
button
id=
"PlayOrPause"
value=
" Play "
onClick=
'doPlayOrPause()'
>
<INPUT
type=
button
value=
"Stop"
onClick=
'document.vlc.playlist.stop();'
>
<INPUT
type=
button
value=
" << "
onClick=
'document.vlc.playlist.playSlower();'
>
<INPUT
type=
button
value=
" >> "
onClick=
'document.vlc.playlist.playFaster();'
>
<INPUT
type=
button
value=
"Show"
onClick=
'document.vlc.visible = true;'
>
<INPUT
type=
button
value=
"Hide"
onClick=
'document.vlc.visible = false;'
>
<INPUT
type=
button
value=
"Version"
onClick=
'alert(document.vlc.VersionInfo);'
>
<SPAN
style=
"text-align:center"
>
Volume:
</SPAN>
<INPUT
type=
button
value=
" - "
onClick=
'updateVolume(-10)'
>
<SPAN
id=
"volumeTextField"
style=
"text-align: center"
>
--
</SPAN>
<INPUT
type=
button
value=
" + "
onClick=
'updateVolume(+10)'
>
<INPUT
type=
button
value=
"Mute"
onClick=
'document.vlc.audio.togglemute();'
>
</TD>
</TR>
</TABLE>
<SCRIPT
LANGUAGE=
"Javascript"
>
<!--
var timerId = 0;
function updateVolume(deltaVol)
{
var plugin = document.getElementById('vlc');
plugin.audio.volume += deltaVol;
volumeTextField.innerText = plugin.audio.volume+"%";
};
function formatTime(timeVal)
{
var timeHour = timeVal;
var timeSec = timeHour % 60;
if( timeSec < 10 )
timeSec = '0'+timeSec;
timeHour = (timeHour - timeSec)/60;
var timeMin = timeHour % 60;
if( timeMin < 10 )
timeMin = '0'+timeMin;
timeHour = (timeHour - timeMin)/60;
if( timeHour > 0 )
return timeHour+":"+timeMin+":"+timeSec;
else
return timeMin+":"+timeSec;
};
function onPlay()
{
document.getElementById("PlayOrPause").value = "Pause";
};
function onPause()
{
document.getElementById("PlayOrPause").value = " Play ";
};
function onStop()
{
info.innerText = "-:--:--/-:--:--";
document.getElementById("PlayOrPause").value = " Play ";
};
var liveFeedText = new Array("Live", "((Live))", "(( Live ))", "(( Live ))");
var liveFeedRoll = 0;
function doUpdate()
{
if( vlc.playlist.isplaying )
{
if( vlc.input.length > 0 )
{
// seekable stream
info.innerText = formatTime(vlc.input.time/1000)+"/"+formatTime(vlc.input.length/1000);
document.getElementById("PlayOrPause").Enabled = true;
}
else {
liveFeedRoll = liveFeedRoll & 3;
info.innerText = liveFeedText[liveFeedRoll++];
}
timerId = setTimeout("doUpdate()", 1000);
}
else
{
onStop();
timerId = 0;
}
};
function doGo(targetURL)
{
var options = new Array(":vout-filter=deinterlace", ":deinterlace-mode=linear");
document.vlc.playlist.add(targetURL, null, options);
};
function doPlayOrPause()
{
if( document.vlc.playlist.isplaying )
{
document.vlc.playlist.pause();
}
else
{
document.vlc.playlist.play();
}
};
function vlcPlayEvent()
{
if( ! timerId )
{
timerId = setTimeout("doUpdate()", 1000);
}
onPlay();
};
function vlcPauseEvent()
{
if( timerId )
{
clearTimeout(timerId)
timerId = 0;
}
onPause();
};
function vlcStopEvent()
{
if( timerId )
{
clearTimeout(timerId)
timerId = 0;
}
onStop();
};
//-->
</SCRIPT>
</BODY>
</HTML>
mozilla/vlcplugin.cpp
View file @
dfdc294e
...
...
@@ -99,6 +99,10 @@ NPError VlcPlugin::init(int argc, char* const argn[], char* const argv[])
RegCloseKey
(
h_key
);
}
ppsz_argv
[
ppsz_argc
++
]
=
"--no-one-instance"
;
#if 0
ppsz_argv[ppsz_argc++] = "--fast-mutex";
ppsz_argv[ppsz_argc++] = "--win9x-cv-method=1";
#endif
#endif
/* XP_MACOSX */
...
...
@@ -152,9 +156,9 @@ NPError VlcPlugin::init(int argc, char* const argn[], char* const argv[])
}
}
else
if
(
!
strcmp
(
argn
[
i
],
"version"
)
)
{
version
=
argv
[
i
];
}
{
version
=
argv
[
i
];
}
}
libvlc_instance
=
libvlc_new
(
ppsz_argc
,
ppsz_argv
,
NULL
);
...
...
@@ -209,13 +213,13 @@ NPError VlcPlugin::init(int argc, char* const argn[], char* const argv[])
/* assign plugin script root class */
if
(
(
NULL
!=
version
)
&&
(
!
strcmp
(
version
,
"VideoLAN.VLCPlugin.2"
))
)
{
/* new APIs */
scriptClass
=
new
RuntimeNPClass
<
LibvlcRootNPObject
>
();
/* new APIs */
scriptClass
=
RuntimeNPClass
<
LibvlcRootNPObject
>::
getClass
();
}
else
{
/* legacy APIs */
scriptClass
=
new
RuntimeNPClass
<
VlcNPObject
>
();
/* legacy APIs */
scriptClass
=
RuntimeNPClass
<
VlcNPObject
>::
getClass
();
}
return
NPERR_NO_ERROR
;
...
...
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