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
310dfdca
Commit
310dfdca
authored
Aug 28, 2006
by
Damien Fouilleul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- formating
- javascript fixes
parent
2454f03d
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
335 additions
and
151 deletions
+335
-151
mozilla/control/npolibvlc.cpp
mozilla/control/npolibvlc.cpp
+251
-69
mozilla/control/npolibvlc.h
mozilla/control/npolibvlc.h
+14
-11
mozilla/control/nporuntime.cpp
mozilla/control/nporuntime.cpp
+26
-5
mozilla/control/nporuntime.h
mozilla/control/nporuntime.h
+11
-8
mozilla/control/npovlc.cpp
mozilla/control/npovlc.cpp
+32
-57
mozilla/control/npovlc.h
mozilla/control/npovlc.h
+1
-1
No files found.
mozilla/control/npolibvlc.cpp
View file @
310dfdca
...
@@ -79,21 +79,21 @@ enum LibvlcRootNPObjectPropertyIds
...
@@ -79,21 +79,21 @@ enum LibvlcRootNPObjectPropertyIds
const
int
LibvlcRootNPObject
::
propertyCount
=
sizeof
(
LibvlcRootNPObject
::
propertyNames
)
/
sizeof
(
NPUTF8
*
);
const
int
LibvlcRootNPObject
::
propertyCount
=
sizeof
(
LibvlcRootNPObject
::
propertyNames
)
/
sizeof
(
NPUTF8
*
);
RuntimeNPObject
::
InvokeResult
LibvlcRootNPObject
::
getProperty
(
int
index
,
NPVariant
*
result
)
RuntimeNPObject
::
InvokeResult
LibvlcRootNPObject
::
getProperty
(
int
index
,
NPVariant
&
result
)
{
{
switch
(
index
)
switch
(
index
)
{
{
case
ID_audio
:
case
ID_audio
:
OBJECT_TO_NPVARIANT
(
NPN_RetainObject
(
audioObj
),
*
result
);
OBJECT_TO_NPVARIANT
(
NPN_RetainObject
(
audioObj
),
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
case
ID_input
:
case
ID_input
:
OBJECT_TO_NPVARIANT
(
NPN_RetainObject
(
inputObj
),
*
result
);
OBJECT_TO_NPVARIANT
(
NPN_RetainObject
(
inputObj
),
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
case
ID_playlist
:
case
ID_playlist
:
OBJECT_TO_NPVARIANT
(
NPN_RetainObject
(
playlistObj
),
*
result
);
OBJECT_TO_NPVARIANT
(
NPN_RetainObject
(
playlistObj
),
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
case
ID_video
:
case
ID_video
:
OBJECT_TO_NPVARIANT
(
NPN_RetainObject
(
videoObj
),
*
result
);
OBJECT_TO_NPVARIANT
(
NPN_RetainObject
(
videoObj
),
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
return
INVOKERESULT_GENERIC_ERROR
;
return
INVOKERESULT_GENERIC_ERROR
;
...
@@ -124,7 +124,7 @@ enum LibvlcAudioNPObjectPropertyIds
...
@@ -124,7 +124,7 @@ enum LibvlcAudioNPObjectPropertyIds
const
int
LibvlcAudioNPObject
::
propertyCount
=
sizeof
(
LibvlcAudioNPObject
::
propertyNames
)
/
sizeof
(
NPUTF8
*
);
const
int
LibvlcAudioNPObject
::
propertyCount
=
sizeof
(
LibvlcAudioNPObject
::
propertyNames
)
/
sizeof
(
NPUTF8
*
);
RuntimeNPObject
::
InvokeResult
LibvlcAudioNPObject
::
getProperty
(
int
index
,
NPVariant
*
result
)
RuntimeNPObject
::
InvokeResult
LibvlcAudioNPObject
::
getProperty
(
int
index
,
NPVariant
&
result
)
{
{
VlcPlugin
*
p_plugin
=
reinterpret_cast
<
VlcPlugin
*>
(
_instance
->
pdata
);
VlcPlugin
*
p_plugin
=
reinterpret_cast
<
VlcPlugin
*>
(
_instance
->
pdata
);
if
(
p_plugin
)
if
(
p_plugin
)
...
@@ -143,7 +143,7 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::getProperty(int index, NPVari
...
@@ -143,7 +143,7 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::getProperty(int index, NPVari
libvlc_exception_clear
(
&
ex
);
libvlc_exception_clear
(
&
ex
);
return
INVOKERESULT_GENERIC_ERROR
;
return
INVOKERESULT_GENERIC_ERROR
;
}
}
BOOLEAN_TO_NPVARIANT
(
muted
,
*
result
);
BOOLEAN_TO_NPVARIANT
(
muted
,
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
case
ID_volume
:
case
ID_volume
:
...
@@ -155,7 +155,7 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::getProperty(int index, NPVari
...
@@ -155,7 +155,7 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::getProperty(int index, NPVari
libvlc_exception_clear
(
&
ex
);
libvlc_exception_clear
(
&
ex
);
return
INVOKERESULT_GENERIC_ERROR
;
return
INVOKERESULT_GENERIC_ERROR
;
}
}
INT32_TO_NPVARIANT
(
volume
,
*
result
);
INT32_TO_NPVARIANT
(
volume
,
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
}
}
...
@@ -163,7 +163,7 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::getProperty(int index, NPVari
...
@@ -163,7 +163,7 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::getProperty(int index, NPVari
return
INVOKERESULT_GENERIC_ERROR
;
return
INVOKERESULT_GENERIC_ERROR
;
}
}
RuntimeNPObject
::
InvokeResult
LibvlcAudioNPObject
::
setProperty
(
int
index
,
const
NPVariant
*
value
)
RuntimeNPObject
::
InvokeResult
LibvlcAudioNPObject
::
setProperty
(
int
index
,
const
NPVariant
&
value
)
{
{
VlcPlugin
*
p_plugin
=
reinterpret_cast
<
VlcPlugin
*>
(
_instance
->
pdata
);
VlcPlugin
*
p_plugin
=
reinterpret_cast
<
VlcPlugin
*>
(
_instance
->
pdata
);
if
(
p_plugin
)
if
(
p_plugin
)
...
@@ -174,10 +174,10 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::setProperty(int index, const
...
@@ -174,10 +174,10 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::setProperty(int index, const
switch
(
index
)
switch
(
index
)
{
{
case
ID_mute
:
case
ID_mute
:
if
(
NPVARIANT_IS_BOOLEAN
(
*
value
)
)
if
(
NPVARIANT_IS_BOOLEAN
(
value
)
)
{
{
libvlc_audio_set_mute
(
p_plugin
->
getVLC
(),
libvlc_audio_set_mute
(
p_plugin
->
getVLC
(),
NPVARIANT_TO_BOOLEAN
(
*
value
),
&
ex
);
NPVARIANT_TO_BOOLEAN
(
value
),
&
ex
);
if
(
libvlc_exception_raised
(
&
ex
)
)
if
(
libvlc_exception_raised
(
&
ex
)
)
{
{
NPN_SetException
(
this
,
libvlc_exception_get_message
(
&
ex
));
NPN_SetException
(
this
,
libvlc_exception_get_message
(
&
ex
));
...
@@ -188,10 +188,10 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::setProperty(int index, const
...
@@ -188,10 +188,10 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::setProperty(int index, const
}
}
return
INVOKERESULT_INVALID_VALUE
;
return
INVOKERESULT_INVALID_VALUE
;
case
ID_volume
:
case
ID_volume
:
if
(
isNumberValue
(
*
value
)
)
if
(
isNumberValue
(
value
)
)
{
{
libvlc_audio_set_volume
(
p_plugin
->
getVLC
(),
libvlc_audio_set_volume
(
p_plugin
->
getVLC
(),
numberValue
(
*
value
),
&
ex
);
numberValue
(
value
),
&
ex
);
if
(
libvlc_exception_raised
(
&
ex
)
)
if
(
libvlc_exception_raised
(
&
ex
)
)
{
{
NPN_SetException
(
this
,
libvlc_exception_get_message
(
&
ex
));
NPN_SetException
(
this
,
libvlc_exception_get_message
(
&
ex
));
...
@@ -218,7 +218,7 @@ enum LibvlcAudioNPObjectMethodIds
...
@@ -218,7 +218,7 @@ enum LibvlcAudioNPObjectMethodIds
const
int
LibvlcAudioNPObject
::
methodCount
=
sizeof
(
LibvlcAudioNPObject
::
methodNames
)
/
sizeof
(
NPUTF8
*
);
const
int
LibvlcAudioNPObject
::
methodCount
=
sizeof
(
LibvlcAudioNPObject
::
methodNames
)
/
sizeof
(
NPUTF8
*
);
RuntimeNPObject
::
InvokeResult
LibvlcAudioNPObject
::
invoke
(
int
index
,
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
*
result
)
RuntimeNPObject
::
InvokeResult
LibvlcAudioNPObject
::
invoke
(
int
index
,
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
&
result
)
{
{
VlcPlugin
*
p_plugin
=
reinterpret_cast
<
VlcPlugin
*>
(
_instance
->
pdata
);
VlcPlugin
*
p_plugin
=
reinterpret_cast
<
VlcPlugin
*>
(
_instance
->
pdata
);
if
(
p_plugin
)
if
(
p_plugin
)
...
@@ -240,7 +240,7 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::invoke(int index, const NPVar
...
@@ -240,7 +240,7 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::invoke(int index, const NPVar
}
}
else
else
{
{
VOID_TO_NPVARIANT
(
*
result
);
VOID_TO_NPVARIANT
(
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
}
}
...
@@ -276,7 +276,7 @@ enum LibvlcInputNPObjectPropertyIds
...
@@ -276,7 +276,7 @@ enum LibvlcInputNPObjectPropertyIds
const
int
LibvlcInputNPObject
::
propertyCount
=
sizeof
(
LibvlcInputNPObject
::
propertyNames
)
/
sizeof
(
NPUTF8
*
);
const
int
LibvlcInputNPObject
::
propertyCount
=
sizeof
(
LibvlcInputNPObject
::
propertyNames
)
/
sizeof
(
NPUTF8
*
);
RuntimeNPObject
::
InvokeResult
LibvlcInputNPObject
::
getProperty
(
int
index
,
NPVariant
*
result
)
RuntimeNPObject
::
InvokeResult
LibvlcInputNPObject
::
getProperty
(
int
index
,
NPVariant
&
result
)
{
{
VlcPlugin
*
p_plugin
=
reinterpret_cast
<
VlcPlugin
*>
(
_instance
->
pdata
);
VlcPlugin
*
p_plugin
=
reinterpret_cast
<
VlcPlugin
*>
(
_instance
->
pdata
);
if
(
p_plugin
)
if
(
p_plugin
)
...
@@ -304,7 +304,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
...
@@ -304,7 +304,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
libvlc_exception_clear
(
&
ex
);
libvlc_exception_clear
(
&
ex
);
return
INVOKERESULT_GENERIC_ERROR
;
return
INVOKERESULT_GENERIC_ERROR
;
}
}
DOUBLE_TO_NPVARIANT
(
val
,
*
result
);
DOUBLE_TO_NPVARIANT
(
val
,
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
case
ID_position
:
case
ID_position
:
...
@@ -317,7 +317,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
...
@@ -317,7 +317,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
libvlc_exception_clear
(
&
ex
);
libvlc_exception_clear
(
&
ex
);
return
INVOKERESULT_GENERIC_ERROR
;
return
INVOKERESULT_GENERIC_ERROR
;
}
}
DOUBLE_TO_NPVARIANT
(
val
,
*
result
);
DOUBLE_TO_NPVARIANT
(
val
,
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
case
ID_time
:
case
ID_time
:
...
@@ -330,7 +330,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
...
@@ -330,7 +330,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
libvlc_exception_clear
(
&
ex
);
libvlc_exception_clear
(
&
ex
);
return
INVOKERESULT_GENERIC_ERROR
;
return
INVOKERESULT_GENERIC_ERROR
;
}
}
DOUBLE_TO_NPVARIANT
(
val
,
*
result
);
DOUBLE_TO_NPVARIANT
(
val
,
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
case
ID_fps
:
case
ID_fps
:
...
@@ -343,7 +343,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
...
@@ -343,7 +343,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
libvlc_exception_clear
(
&
ex
);
libvlc_exception_clear
(
&
ex
);
return
INVOKERESULT_GENERIC_ERROR
;
return
INVOKERESULT_GENERIC_ERROR
;
}
}
DOUBLE_TO_NPVARIANT
(
val
,
*
result
);
DOUBLE_TO_NPVARIANT
(
val
,
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
case
ID_hasvout
:
case
ID_hasvout
:
...
@@ -356,7 +356,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
...
@@ -356,7 +356,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
libvlc_exception_clear
(
&
ex
);
libvlc_exception_clear
(
&
ex
);
return
INVOKERESULT_GENERIC_ERROR
;
return
INVOKERESULT_GENERIC_ERROR
;
}
}
BOOLEAN_TO_NPVARIANT
(
val
,
*
result
);
BOOLEAN_TO_NPVARIANT
(
val
,
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
}
}
...
@@ -365,7 +365,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
...
@@ -365,7 +365,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
return
INVOKERESULT_GENERIC_ERROR
;
return
INVOKERESULT_GENERIC_ERROR
;
}
}
RuntimeNPObject
::
InvokeResult
LibvlcInputNPObject
::
setProperty
(
int
index
,
const
NPVariant
*
value
)
RuntimeNPObject
::
InvokeResult
LibvlcInputNPObject
::
setProperty
(
int
index
,
const
NPVariant
&
value
)
{
{
VlcPlugin
*
p_plugin
=
reinterpret_cast
<
VlcPlugin
*>
(
_instance
->
pdata
);
VlcPlugin
*
p_plugin
=
reinterpret_cast
<
VlcPlugin
*>
(
_instance
->
pdata
);
if
(
p_plugin
)
if
(
p_plugin
)
...
@@ -385,13 +385,13 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::setProperty(int index, const
...
@@ -385,13 +385,13 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::setProperty(int index, const
{
{
case
ID_position
:
case
ID_position
:
{
{
if
(
!
NPVARIANT_IS_DOUBLE
(
*
value
)
)
if
(
!
NPVARIANT_IS_DOUBLE
(
value
)
)
{
{
libvlc_input_free
(
p_input
);
libvlc_input_free
(
p_input
);
return
INVOKERESULT_INVALID_VALUE
;
return
INVOKERESULT_INVALID_VALUE
;
}
}
float
val
=
(
float
)
NPVARIANT_TO_DOUBLE
(
*
value
);
float
val
=
(
float
)
NPVARIANT_TO_DOUBLE
(
value
);
libvlc_input_set_position
(
p_input
,
val
,
&
ex
);
libvlc_input_set_position
(
p_input
,
val
,
&
ex
);
libvlc_input_free
(
p_input
);
libvlc_input_free
(
p_input
);
if
(
libvlc_exception_raised
(
&
ex
)
)
if
(
libvlc_exception_raised
(
&
ex
)
)
...
@@ -405,10 +405,10 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::setProperty(int index, const
...
@@ -405,10 +405,10 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::setProperty(int index, const
case
ID_time
:
case
ID_time
:
{
{
vlc_int64_t
val
;
vlc_int64_t
val
;
if
(
NPVARIANT_IS_INT32
(
*
value
)
)
if
(
NPVARIANT_IS_INT32
(
value
)
)
val
=
(
vlc_int64_t
)
NPVARIANT_TO_INT32
(
*
value
);
val
=
(
vlc_int64_t
)
NPVARIANT_TO_INT32
(
value
);
else
if
(
NPVARIANT_IS_DOUBLE
(
*
value
)
)
else
if
(
NPVARIANT_IS_DOUBLE
(
value
)
)
val
=
(
vlc_int64_t
)
NPVARIANT_TO_DOUBLE
(
*
value
);
val
=
(
vlc_int64_t
)
NPVARIANT_TO_DOUBLE
(
value
);
else
else
{
{
libvlc_input_free
(
p_input
);
libvlc_input_free
(
p_input
);
...
@@ -457,7 +457,7 @@ enum LibvlcPlaylistNPObjectPropertyIds
...
@@ -457,7 +457,7 @@ enum LibvlcPlaylistNPObjectPropertyIds
const
int
LibvlcPlaylistNPObject
::
propertyCount
=
sizeof
(
LibvlcPlaylistNPObject
::
propertyNames
)
/
sizeof
(
NPUTF8
*
);
const
int
LibvlcPlaylistNPObject
::
propertyCount
=
sizeof
(
LibvlcPlaylistNPObject
::
propertyNames
)
/
sizeof
(
NPUTF8
*
);
RuntimeNPObject
::
InvokeResult
LibvlcPlaylistNPObject
::
getProperty
(
int
index
,
NPVariant
*
result
)
RuntimeNPObject
::
InvokeResult
LibvlcPlaylistNPObject
::
getProperty
(
int
index
,
NPVariant
&
result
)
{
{
VlcPlugin
*
p_plugin
=
reinterpret_cast
<
VlcPlugin
*>
(
_instance
->
pdata
);
VlcPlugin
*
p_plugin
=
reinterpret_cast
<
VlcPlugin
*>
(
_instance
->
pdata
);
if
(
p_plugin
)
if
(
p_plugin
)
...
@@ -476,7 +476,7 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::getProperty(int index, NPV
...
@@ -476,7 +476,7 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::getProperty(int index, NPV
libvlc_exception_clear
(
&
ex
);
libvlc_exception_clear
(
&
ex
);
return
INVOKERESULT_GENERIC_ERROR
;
return
INVOKERESULT_GENERIC_ERROR
;
}
}
INT32_TO_NPVARIANT
(
val
,
*
result
);
INT32_TO_NPVARIANT
(
val
,
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
case
ID_isplaying
:
case
ID_isplaying
:
...
@@ -488,7 +488,7 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::getProperty(int index, NPV
...
@@ -488,7 +488,7 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::getProperty(int index, NPV
libvlc_exception_clear
(
&
ex
);
libvlc_exception_clear
(
&
ex
);
return
INVOKERESULT_GENERIC_ERROR
;
return
INVOKERESULT_GENERIC_ERROR
;
}
}
BOOLEAN_TO_NPVARIANT
(
val
,
*
result
);
BOOLEAN_TO_NPVARIANT
(
val
,
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
}
}
...
@@ -522,7 +522,7 @@ enum LibvlcPlaylistNPObjectMethodIds
...
@@ -522,7 +522,7 @@ enum LibvlcPlaylistNPObjectMethodIds
const
int
LibvlcPlaylistNPObject
::
methodCount
=
sizeof
(
LibvlcPlaylistNPObject
::
methodNames
)
/
sizeof
(
NPUTF8
*
);
const
int
LibvlcPlaylistNPObject
::
methodCount
=
sizeof
(
LibvlcPlaylistNPObject
::
methodNames
)
/
sizeof
(
NPUTF8
*
);
RuntimeNPObject
::
InvokeResult
LibvlcPlaylistNPObject
::
invoke
(
int
index
,
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
*
result
)
RuntimeNPObject
::
InvokeResult
LibvlcPlaylistNPObject
::
invoke
(
int
index
,
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
&
result
)
{
{
VlcPlugin
*
p_plugin
=
reinterpret_cast
<
VlcPlugin
*>
(
_instance
->
pdata
);
VlcPlugin
*
p_plugin
=
reinterpret_cast
<
VlcPlugin
*>
(
_instance
->
pdata
);
if
(
p_plugin
)
if
(
p_plugin
)
...
@@ -533,23 +533,79 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
...
@@ -533,23 +533,79 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
switch
(
index
)
switch
(
index
)
{
{
case
ID_add
:
case
ID_add
:
if
(
(
argCount
==
1
)
&&
NPVARIANT_IS_STRING
(
args
[
0
])
)
{
{
const
NPString
&
name
=
NPVARIANT_TO_STRING
(
args
[
0
]);
char
*
url
=
NULL
;
NPUTF8
*
s
=
new
NPUTF8
[
name
.
utf8length
+
1
];
char
*
name
=
NULL
;
int
i_options
=
0
;
char
**
ppsz_options
=
NULL
;
if
(
(
argCount
<
1
)
||
(
argCount
>
3
)
)
return
INVOKERESULT_NO_SUCH_METHOD
;
// grab URL
if
(
NPVARIANT_IS_STRING
(
args
[
0
])
)
{
char
*
s
=
stringValue
(
NPVARIANT_TO_STRING
(
args
[
0
]));
if
(
s
)
if
(
s
)
{
{
strncpy
(
s
,
name
.
utf8characters
,
name
.
utf8length
);
s
[
name
.
utf8length
]
=
'\0'
;
char
*
url
=
p_plugin
->
getAbsoluteURL
(
s
);
char
*
url
=
p_plugin
->
getAbsoluteURL
(
s
);
delete
s
;
delete
s
;
if
(
!
url
)
if
(
!
url
)
// what happened ?
// what happened ?
return
INVOKERESULT_GENERIC_ERROR
;
return
INVOKERESULT_GENERIC_ERROR
;
}
else
return
INVOKERESULT_OUT_OF_MEMORY
;
}
else
return
INVOKERESULT_NO_SUCH_METHOD
;
int
item
=
libvlc_playlist_add
(
p_plugin
->
getVLC
(),
url
,
NULL
,
&
ex
);
// grab name if available
free
(
url
);
if
(
argCount
>
1
)
{
if
(
NPVARIANT_IS_NULL
(
args
[
1
])
)
{
// do nothing
}
else
if
(
NPVARIANT_IS_STRING
(
args
[
1
])
)
{
name
=
stringValue
(
NPVARIANT_TO_STRING
(
args
[
0
]));
}
else
return
INVOKERESULT_NO_SUCH_METHOD
;
}
// grab options if available
if
(
argCount
>
2
)
{
if
(
NPVARIANT_IS_NULL
(
args
[
2
])
)
{
// do nothing
}
else
if
(
NPVARIANT_IS_STRING
(
args
[
2
])
)
{
parseOptions
(
NPVARIANT_TO_STRING
(
args
[
0
]),
&
i_options
,
&
ppsz_options
);
}
else
if
(
NPVARIANT_IS_OBJECT
(
args
[
3
])
)
{
parseOptions
(
NPVARIANT_TO_OBJECT
(
args
[
0
]),
&
i_options
,
&
ppsz_options
);
}
}
int
item
=
libvlc_playlist_add_extended
(
p_plugin
->
getVLC
(),
url
,
name
,
i_options
,
const_cast
<
const
char
**>
(
ppsz_options
),
&
ex
);
delete
url
;
delete
name
;
for
(
int
i
=
0
;
i
<
i_options
;
++
i
)
{
delete
ppsz_options
[
i
];
}
delete
ppsz_options
;
if
(
libvlc_exception_raised
(
&
ex
)
)
if
(
libvlc_exception_raised
(
&
ex
)
)
{
{
NPN_SetException
(
this
,
libvlc_exception_get_message
(
&
ex
));
NPN_SetException
(
this
,
libvlc_exception_get_message
(
&
ex
));
...
@@ -558,14 +614,10 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
...
@@ -558,14 +614,10 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
}
}
else
else
{
{
INT32_TO_NPVARIANT
(
item
,
*
result
);
INT32_TO_NPVARIANT
(
item
,
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
}
}
else
return
INVOKERESULT_OUT_OF_MEMORY
;
}
return
INVOKERESULT_NO_SUCH_METHOD
;
case
ID_play
:
case
ID_play
:
if
(
argCount
==
0
)
if
(
argCount
==
0
)
{
{
...
@@ -578,7 +630,7 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
...
@@ -578,7 +630,7 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
}
}
else
else
{
{
VOID_TO_NPVARIANT
(
*
result
);
VOID_TO_NPVARIANT
(
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
}
}
...
@@ -595,7 +647,7 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
...
@@ -595,7 +647,7 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
}
}
else
else
{
{
VOID_TO_NPVARIANT
(
*
result
);
VOID_TO_NPVARIANT
(
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
}
}
...
@@ -612,7 +664,7 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
...
@@ -612,7 +664,7 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
}
}
else
else
{
{
VOID_TO_NPVARIANT
(
*
result
);
VOID_TO_NPVARIANT
(
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
}
}
...
@@ -629,7 +681,7 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
...
@@ -629,7 +681,7 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
}
}
else
else
{
{
VOID_TO_NPVARIANT
(
*
result
);
VOID_TO_NPVARIANT
(
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
}
}
...
@@ -646,7 +698,7 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
...
@@ -646,7 +698,7 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
}
}
else
else
{
{
VOID_TO_NPVARIANT
(
*
result
);
VOID_TO_NPVARIANT
(
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
}
}
...
@@ -663,7 +715,7 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
...
@@ -663,7 +715,7 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
}
}
else
else
{
{
VOID_TO_NPVARIANT
(
*
result
);
VOID_TO_NPVARIANT
(
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
}
}
...
@@ -680,7 +732,7 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
...
@@ -680,7 +732,7 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
}
}
else
else
{
{
VOID_TO_NPVARIANT
(
*
result
);
VOID_TO_NPVARIANT
(
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
}
}
...
@@ -692,6 +744,136 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
...
@@ -692,6 +744,136 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
return
INVOKERESULT_GENERIC_ERROR
;
return
INVOKERESULT_GENERIC_ERROR
;
}
}
void
LibvlcPlaylistNPObject
::
parseOptions
(
const
NPString
&
s
,
int
*
i_options
,
char
***
ppsz_options
)
{
if
(
s
.
utf8length
)
{
char
*
val
=
stringValue
(
s
);
if
(
val
)
{
long
capacity
=
16
;
char
**
options
=
(
char
**
)
malloc
(
capacity
*
sizeof
(
char
*
));
if
(
options
)
{
int
nOptions
=
0
;
char
*
end
=
val
+
s
.
utf8length
;
while
(
val
<
end
)
{
// skip leading blanks
while
(
(
val
<
end
)
&&
((
*
val
==
' '
)
||
(
*
val
!=
'\t'
))
)
++
val
;
char
*
start
=
val
;
// skip till we get a blank character
while
(
(
val
<
end
)
&&
(
*
val
!=
' '
)
&&
(
*
val
!=
'\t'
)
)
{
char
c
=
*
(
val
++
);
if
(
(
'\''
==
c
)
||
(
'"'
==
c
)
)
{
// skip till end of string
while
(
(
val
<
end
)
&&
(
*
(
val
++
)
!=
c
)
);
}
}
if
(
val
>
start
)
{
if
(
nOptions
==
capacity
)
{
capacity
+=
16
;
char
**
moreOptions
=
(
char
**
)
realloc
(
options
,
capacity
*
sizeof
(
char
*
));
if
(
!
moreOptions
)
{
/* failed to allocate more memory */
delete
val
;
/* return what we got so far */
*
i_options
=
nOptions
;
*
ppsz_options
=
options
;
break
;
}
options
=
moreOptions
;
}
*
(
val
++
)
=
'\0'
;
options
[
nOptions
++
]
=
strdup
(
start
);
}
else
// must be end of string
break
;
}
*
i_options
=
nOptions
;
*
ppsz_options
=
options
;
}
delete
val
;
}
}
}
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 */
if
(
NPN_HasProperty
(
_instance
,
obj
,
name
)
)
{
NPVariant
value
;
if
(
NPN_GetProperty
(
_instance
,
obj
,
name
,
&
value
)
)
{
int
count
=
numberValue
(
value
);
NPN_ReleaseVariantValue
(
&
value
);
if
(
count
)
{
long
capacity
=
16
;
char
**
options
=
(
char
**
)
malloc
(
capacity
*
sizeof
(
char
*
));
if
(
options
)
{
int
nOptions
=
0
;
while
(
nOptions
<
count
)
{
name
=
NPN_GetIntIdentifier
(
nOptions
);
if
(
!
NPN_HasProperty
(
_instance
,
obj
,
name
)
)
/* return what we got so far */
break
;
if
(
!
NPN_GetProperty
(
_instance
,
obj
,
name
,
&
value
)
)
/* return what we got so far */
break
;
if
(
!
NPVARIANT_IS_STRING
(
value
)
)
{
/* return what we got so far */
NPN_ReleaseVariantValue
(
&
value
);
break
;
}
if
(
nOptions
==
capacity
)
{
capacity
+=
16
;
char
**
moreOptions
=
(
char
**
)
realloc
(
options
,
capacity
*
sizeof
(
char
*
));
if
(
!
moreOptions
)
{
/* failed to allocate more memory */
NPN_ReleaseVariantValue
(
&
value
);
/* return what we got so far */
*
i_options
=
nOptions
;
*
ppsz_options
=
options
;
break
;
}
options
=
moreOptions
;
}
options
[
nOptions
++
]
=
stringValue
(
value
);
}
*
i_options
=
nOptions
;
*
ppsz_options
=
options
;
}
}
}
}
}
/*
/*
** implementation of libvlc video object
** implementation of libvlc video object
*/
*/
...
@@ -712,7 +894,7 @@ enum LibvlcVideoNPObjectPropertyIds
...
@@ -712,7 +894,7 @@ enum LibvlcVideoNPObjectPropertyIds
const
int
LibvlcVideoNPObject
::
propertyCount
=
sizeof
(
LibvlcVideoNPObject
::
propertyNames
)
/
sizeof
(
NPUTF8
*
);
const
int
LibvlcVideoNPObject
::
propertyCount
=
sizeof
(
LibvlcVideoNPObject
::
propertyNames
)
/
sizeof
(
NPUTF8
*
);
RuntimeNPObject
::
InvokeResult
LibvlcVideoNPObject
::
getProperty
(
int
index
,
NPVariant
*
result
)
RuntimeNPObject
::
InvokeResult
LibvlcVideoNPObject
::
getProperty
(
int
index
,
NPVariant
&
result
)
{
{
VlcPlugin
*
p_plugin
=
reinterpret_cast
<
VlcPlugin
*>
(
_instance
->
pdata
);
VlcPlugin
*
p_plugin
=
reinterpret_cast
<
VlcPlugin
*>
(
_instance
->
pdata
);
if
(
p_plugin
)
if
(
p_plugin
)
...
@@ -740,7 +922,7 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::getProperty(int index, NPVari
...
@@ -740,7 +922,7 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::getProperty(int index, NPVari
libvlc_exception_clear
(
&
ex
);
libvlc_exception_clear
(
&
ex
);
return
INVOKERESULT_GENERIC_ERROR
;
return
INVOKERESULT_GENERIC_ERROR
;
}
}
BOOLEAN_TO_NPVARIANT
(
val
,
*
result
);
BOOLEAN_TO_NPVARIANT
(
val
,
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
case
ID_height
:
case
ID_height
:
...
@@ -753,7 +935,7 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::getProperty(int index, NPVari
...
@@ -753,7 +935,7 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::getProperty(int index, NPVari
libvlc_exception_clear
(
&
ex
);
libvlc_exception_clear
(
&
ex
);
return
INVOKERESULT_GENERIC_ERROR
;
return
INVOKERESULT_GENERIC_ERROR
;
}
}
INT32_TO_NPVARIANT
(
val
,
*
result
);
INT32_TO_NPVARIANT
(
val
,
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
case
ID_width
:
case
ID_width
:
...
@@ -766,7 +948,7 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::getProperty(int index, NPVari
...
@@ -766,7 +948,7 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::getProperty(int index, NPVari
libvlc_exception_clear
(
&
ex
);
libvlc_exception_clear
(
&
ex
);
return
INVOKERESULT_GENERIC_ERROR
;
return
INVOKERESULT_GENERIC_ERROR
;
}
}
INT32_TO_NPVARIANT
(
val
,
*
result
);
INT32_TO_NPVARIANT
(
val
,
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
}
}
...
@@ -775,7 +957,7 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::getProperty(int index, NPVari
...
@@ -775,7 +957,7 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::getProperty(int index, NPVari
return
INVOKERESULT_GENERIC_ERROR
;
return
INVOKERESULT_GENERIC_ERROR
;
}
}
RuntimeNPObject
::
InvokeResult
LibvlcVideoNPObject
::
setProperty
(
int
index
,
const
NPVariant
*
value
)
RuntimeNPObject
::
InvokeResult
LibvlcVideoNPObject
::
setProperty
(
int
index
,
const
NPVariant
&
value
)
{
{
VlcPlugin
*
p_plugin
=
reinterpret_cast
<
VlcPlugin
*>
(
_instance
->
pdata
);
VlcPlugin
*
p_plugin
=
reinterpret_cast
<
VlcPlugin
*>
(
_instance
->
pdata
);
if
(
p_plugin
)
if
(
p_plugin
)
...
@@ -795,13 +977,13 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::setProperty(int index, const
...
@@ -795,13 +977,13 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::setProperty(int index, const
{
{
case
ID_fullscreen
:
case
ID_fullscreen
:
{
{
if
(
!
NPVARIANT_IS_BOOLEAN
(
*
value
)
)
if
(
!
NPVARIANT_IS_BOOLEAN
(
value
)
)
{
{
libvlc_input_free
(
p_input
);
libvlc_input_free
(
p_input
);
return
INVOKERESULT_INVALID_VALUE
;
return
INVOKERESULT_INVALID_VALUE
;
}
}
int
val
=
NPVARIANT_TO_BOOLEAN
(
*
value
);
int
val
=
NPVARIANT_TO_BOOLEAN
(
value
);
libvlc_set_fullscreen
(
p_input
,
val
,
&
ex
);
libvlc_set_fullscreen
(
p_input
,
val
,
&
ex
);
libvlc_input_free
(
p_input
);
libvlc_input_free
(
p_input
);
if
(
libvlc_exception_raised
(
&
ex
)
)
if
(
libvlc_exception_raised
(
&
ex
)
)
...
@@ -830,7 +1012,7 @@ enum LibvlcVideoNPObjectMethodIds
...
@@ -830,7 +1012,7 @@ enum LibvlcVideoNPObjectMethodIds
const
int
LibvlcVideoNPObject
::
methodCount
=
sizeof
(
LibvlcVideoNPObject
::
methodNames
)
/
sizeof
(
NPUTF8
*
);
const
int
LibvlcVideoNPObject
::
methodCount
=
sizeof
(
LibvlcVideoNPObject
::
methodNames
)
/
sizeof
(
NPUTF8
*
);
RuntimeNPObject
::
InvokeResult
LibvlcVideoNPObject
::
invoke
(
int
index
,
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
*
result
)
RuntimeNPObject
::
InvokeResult
LibvlcVideoNPObject
::
invoke
(
int
index
,
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
&
result
)
{
{
VlcPlugin
*
p_plugin
=
reinterpret_cast
<
VlcPlugin
*>
(
_instance
->
pdata
);
VlcPlugin
*
p_plugin
=
reinterpret_cast
<
VlcPlugin
*>
(
_instance
->
pdata
);
if
(
p_plugin
)
if
(
p_plugin
)
...
@@ -861,7 +1043,7 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::invoke(int index, const NPVar
...
@@ -861,7 +1043,7 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::invoke(int index, const NPVar
}
}
else
else
{
{
VOID_TO_NPVARIANT
(
*
result
);
VOID_TO_NPVARIANT
(
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
}
}
...
...
mozilla/control/npolibvlc.h
View file @
310dfdca
...
@@ -39,7 +39,7 @@ protected:
...
@@ -39,7 +39,7 @@ protected:
static
const
int
propertyCount
;
static
const
int
propertyCount
;
static
const
NPUTF8
*
const
propertyNames
[];
static
const
NPUTF8
*
const
propertyNames
[];
InvokeResult
getProperty
(
int
index
,
NPVariant
*
result
);
InvokeResult
getProperty
(
int
index
,
NPVariant
&
result
);
static
const
int
methodCount
;
static
const
int
methodCount
;
static
const
NPUTF8
*
const
methodNames
[];
static
const
NPUTF8
*
const
methodNames
[];
...
@@ -63,13 +63,13 @@ protected:
...
@@ -63,13 +63,13 @@ protected:
static
const
int
propertyCount
;
static
const
int
propertyCount
;
static
const
NPUTF8
*
const
propertyNames
[];
static
const
NPUTF8
*
const
propertyNames
[];
InvokeResult
getProperty
(
int
index
,
NPVariant
*
result
);
InvokeResult
getProperty
(
int
index
,
NPVariant
&
result
);
InvokeResult
setProperty
(
int
index
,
const
NPVariant
*
value
);
InvokeResult
setProperty
(
int
index
,
const
NPVariant
&
value
);
static
const
int
methodCount
;
static
const
int
methodCount
;
static
const
NPUTF8
*
const
methodNames
[];
static
const
NPUTF8
*
const
methodNames
[];
InvokeResult
invoke
(
int
index
,
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
*
result
);
InvokeResult
invoke
(
int
index
,
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
&
result
);
};
};
class
LibvlcInputNPObject
:
public
RuntimeNPObject
class
LibvlcInputNPObject
:
public
RuntimeNPObject
...
@@ -86,8 +86,8 @@ protected:
...
@@ -86,8 +86,8 @@ protected:
static
const
int
propertyCount
;
static
const
int
propertyCount
;
static
const
NPUTF8
*
const
propertyNames
[];
static
const
NPUTF8
*
const
propertyNames
[];
InvokeResult
getProperty
(
int
index
,
NPVariant
*
result
);
InvokeResult
getProperty
(
int
index
,
NPVariant
&
result
);
InvokeResult
setProperty
(
int
index
,
const
NPVariant
*
value
);
InvokeResult
setProperty
(
int
index
,
const
NPVariant
&
value
);
static
const
int
methodCount
;
static
const
int
methodCount
;
static
const
NPUTF8
*
const
methodNames
[];
static
const
NPUTF8
*
const
methodNames
[];
...
@@ -106,12 +106,15 @@ protected:
...
@@ -106,12 +106,15 @@ protected:
static
const
int
propertyCount
;
static
const
int
propertyCount
;
static
const
NPUTF8
*
const
propertyNames
[];
static
const
NPUTF8
*
const
propertyNames
[];
InvokeResult
getProperty
(
int
index
,
NPVariant
*
result
);
InvokeResult
getProperty
(
int
index
,
NPVariant
&
result
);
static
const
int
methodCount
;
static
const
int
methodCount
;
static
const
NPUTF8
*
const
methodNames
[];
static
const
NPUTF8
*
const
methodNames
[];
InvokeResult
invoke
(
int
index
,
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
*
result
);
InvokeResult
invoke
(
int
index
,
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
&
result
);
void
parseOptions
(
const
NPString
&
s
,
int
*
i_options
,
char
***
ppsz_options
);
void
parseOptions
(
NPObject
*
obj
,
int
*
i_options
,
char
***
ppsz_options
);
};
};
class
LibvlcVideoNPObject
:
public
RuntimeNPObject
class
LibvlcVideoNPObject
:
public
RuntimeNPObject
...
@@ -127,13 +130,13 @@ protected:
...
@@ -127,13 +130,13 @@ protected:
static
const
int
propertyCount
;
static
const
int
propertyCount
;
static
const
NPUTF8
*
const
propertyNames
[];
static
const
NPUTF8
*
const
propertyNames
[];
InvokeResult
getProperty
(
int
index
,
NPVariant
*
result
);
InvokeResult
getProperty
(
int
index
,
NPVariant
&
result
);
InvokeResult
setProperty
(
int
index
,
const
NPVariant
*
value
);
InvokeResult
setProperty
(
int
index
,
const
NPVariant
&
value
);
static
const
int
methodCount
;
static
const
int
methodCount
;
static
const
NPUTF8
*
const
methodNames
[];
static
const
NPUTF8
*
const
methodNames
[];
InvokeResult
invoke
(
int
index
,
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
*
result
);
InvokeResult
invoke
(
int
index
,
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
&
result
);
};
};
mozilla/control/nporuntime.cpp
View file @
310dfdca
...
@@ -35,13 +35,34 @@
...
@@ -35,13 +35,34 @@
#include "nporuntime.h"
#include "nporuntime.h"
#include "vlcplugin.h"
#include "vlcplugin.h"
RuntimeNPObject
::
InvokeResult
RuntimeNPObject
::
getProperty
(
int
index
,
NPVariant
*
result
)
char
*
RuntimeNPObject
::
stringValue
(
const
NPString
&
s
)
{
NPUTF8
*
val
=
new
NPUTF8
[
s
.
utf8length
+
1
];
if
(
val
)
{
strncpy
(
val
,
s
.
utf8characters
,
s
.
utf8length
);
val
[
s
.
utf8length
]
=
'\0'
;
}
return
val
;
}
char
*
RuntimeNPObject
::
stringValue
(
const
NPVariant
&
v
)
{
char
*
s
=
NULL
;
if
(
NPVARIANT_IS_STRING
(
v
)
)
{
return
stringValue
(
NPVARIANT_TO_STRING
(
v
));
}
return
s
;
}
RuntimeNPObject
::
InvokeResult
RuntimeNPObject
::
getProperty
(
int
index
,
NPVariant
&
result
)
{
{
/* default behaviour */
/* default behaviour */
return
INVOKERESULT_GENERIC_ERROR
;
return
INVOKERESULT_GENERIC_ERROR
;
}
}
RuntimeNPObject
::
InvokeResult
RuntimeNPObject
::
setProperty
(
int
index
,
const
NPVariant
*
value
)
RuntimeNPObject
::
InvokeResult
RuntimeNPObject
::
setProperty
(
int
index
,
const
NPVariant
&
value
)
{
{
/* default behaviour */
/* default behaviour */
return
INVOKERESULT_GENERIC_ERROR
;
return
INVOKERESULT_GENERIC_ERROR
;
...
@@ -53,16 +74,16 @@ RuntimeNPObject::InvokeResult RuntimeNPObject::removeProperty(int index)
...
@@ -53,16 +74,16 @@ RuntimeNPObject::InvokeResult RuntimeNPObject::removeProperty(int index)
return
INVOKERESULT_GENERIC_ERROR
;
return
INVOKERESULT_GENERIC_ERROR
;
}
}
RuntimeNPObject
::
InvokeResult
RuntimeNPObject
::
invoke
(
int
index
,
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
*
result
)
RuntimeNPObject
::
InvokeResult
RuntimeNPObject
::
invoke
(
int
index
,
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
&
result
)
{
{
/* default beahviour */
/* default beahviour */
return
INVOKERESULT_GENERIC_ERROR
;
return
INVOKERESULT_GENERIC_ERROR
;
}
}
RuntimeNPObject
::
InvokeResult
RuntimeNPObject
::
invokeDefault
(
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
*
result
)
RuntimeNPObject
::
InvokeResult
RuntimeNPObject
::
invokeDefault
(
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
&
result
)
{
{
/* return void */
/* return void */
VOID_TO_NPVARIANT
(
*
result
);
VOID_TO_NPVARIANT
(
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
...
...
mozilla/control/nporuntime.h
View file @
310dfdca
...
@@ -52,6 +52,9 @@ public:
...
@@ -52,6 +52,9 @@ public:
}
}
};
};
static
char
*
stringValue
(
const
NPString
&
v
);
static
char
*
stringValue
(
const
NPVariant
&
v
);
RuntimeNPObject
(
NPP
instance
,
const
NPClass
*
aClass
)
:
RuntimeNPObject
(
NPP
instance
,
const
NPClass
*
aClass
)
:
_instance
(
instance
)
_instance
(
instance
)
{
{
...
@@ -88,11 +91,11 @@ protected:
...
@@ -88,11 +91,11 @@ protected:
uint32_t
argCount
,
uint32_t
argCount
,
NPVariant
*
result
);
NPVariant
*
result
);
virtual
InvokeResult
getProperty
(
int
index
,
NPVariant
*
result
);
virtual
InvokeResult
getProperty
(
int
index
,
NPVariant
&
result
);
virtual
InvokeResult
setProperty
(
int
index
,
const
NPVariant
*
value
);
virtual
InvokeResult
setProperty
(
int
index
,
const
NPVariant
&
value
);
virtual
InvokeResult
removeProperty
(
int
index
);
virtual
InvokeResult
removeProperty
(
int
index
);
virtual
InvokeResult
invoke
(
int
index
,
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
*
result
);
virtual
InvokeResult
invoke
(
int
index
,
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
&
result
);
virtual
InvokeResult
invokeDefault
(
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
*
result
);
virtual
InvokeResult
invokeDefault
(
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
&
result
);
bool
returnInvokeResult
(
InvokeResult
result
);
bool
returnInvokeResult
(
InvokeResult
result
);
...
@@ -162,7 +165,7 @@ static bool RuntimeNPClassGetProperty(NPObject *npobj, NPIdentifier name, NPVari
...
@@ -162,7 +165,7 @@ static bool RuntimeNPClassGetProperty(NPObject *npobj, NPIdentifier name, NPVari
if
(
index
!=
-
1
)
if
(
index
!=
-
1
)
{
{
RuntimeNPObject
*
vObj
=
static_cast
<
RuntimeNPObject
*>
(
npobj
);
RuntimeNPObject
*
vObj
=
static_cast
<
RuntimeNPObject
*>
(
npobj
);
return
vObj
->
returnInvokeResult
(
vObj
->
getProperty
(
index
,
result
));
return
vObj
->
returnInvokeResult
(
vObj
->
getProperty
(
index
,
*
result
));
}
}
return
false
;
return
false
;
}
}
...
@@ -175,7 +178,7 @@ static bool RuntimeNPClassSetProperty(NPObject *npobj, NPIdentifier name, const
...
@@ -175,7 +178,7 @@ static bool RuntimeNPClassSetProperty(NPObject *npobj, NPIdentifier name, const
if
(
index
!=
-
1
)
if
(
index
!=
-
1
)
{
{
RuntimeNPObject
*
vObj
=
static_cast
<
RuntimeNPObject
*>
(
npobj
);
RuntimeNPObject
*
vObj
=
static_cast
<
RuntimeNPObject
*>
(
npobj
);
return
vObj
->
returnInvokeResult
(
vObj
->
setProperty
(
index
,
value
));
return
vObj
->
returnInvokeResult
(
vObj
->
setProperty
(
index
,
*
value
));
}
}
return
false
;
return
false
;
}
}
...
@@ -203,7 +206,7 @@ static bool RuntimeNPClassInvoke(NPObject *npobj, NPIdentifier name,
...
@@ -203,7 +206,7 @@ static bool RuntimeNPClassInvoke(NPObject *npobj, NPIdentifier name,
if
(
index
!=
-
1
)
if
(
index
!=
-
1
)
{
{
RuntimeNPObject
*
vObj
=
static_cast
<
RuntimeNPObject
*>
(
npobj
);
RuntimeNPObject
*
vObj
=
static_cast
<
RuntimeNPObject
*>
(
npobj
);
return
vObj
->
returnInvokeResult
(
vObj
->
invoke
(
index
,
args
,
argCount
,
result
));
return
vObj
->
returnInvokeResult
(
vObj
->
invoke
(
index
,
args
,
argCount
,
*
result
));
}
}
return
false
;
return
false
;
...
@@ -216,7 +219,7 @@ static bool RuntimeNPClassInvokeDefault(NPObject *npobj,
...
@@ -216,7 +219,7 @@ static bool RuntimeNPClassInvokeDefault(NPObject *npobj,
NPVariant
*
result
)
NPVariant
*
result
)
{
{
RuntimeNPObject
*
vObj
=
static_cast
<
RuntimeNPObject
*>
(
npobj
);
RuntimeNPObject
*
vObj
=
static_cast
<
RuntimeNPObject
*>
(
npobj
);
return
vObj
->
returnInvokeResult
(
vObj
->
invokeDefault
(
args
,
argCount
,
result
));
return
vObj
->
returnInvokeResult
(
vObj
->
invokeDefault
(
args
,
argCount
,
*
result
));
}
}
template
<
class
T
>
template
<
class
T
>
...
...
mozilla/control/npovlc.cpp
View file @
310dfdca
...
@@ -102,7 +102,7 @@ enum VlcNPObjectMethodIds
...
@@ -102,7 +102,7 @@ enum VlcNPObjectMethodIds
const
int
VlcNPObject
::
methodCount
=
sizeof
(
VlcNPObject
::
methodNames
)
/
sizeof
(
NPUTF8
*
);
const
int
VlcNPObject
::
methodCount
=
sizeof
(
VlcNPObject
::
methodNames
)
/
sizeof
(
NPUTF8
*
);
RuntimeNPObject
::
InvokeResult
VlcNPObject
::
invoke
(
int
index
,
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
*
result
)
RuntimeNPObject
::
InvokeResult
VlcNPObject
::
invoke
(
int
index
,
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
&
result
)
{
{
VlcPlugin
*
p_plugin
=
reinterpret_cast
<
VlcPlugin
*>
(
_instance
->
pdata
);
VlcPlugin
*
p_plugin
=
reinterpret_cast
<
VlcPlugin
*>
(
_instance
->
pdata
);
if
(
p_plugin
)
if
(
p_plugin
)
...
@@ -124,7 +124,7 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
...
@@ -124,7 +124,7 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
}
}
else
else
{
{
VOID_TO_NPVARIANT
(
*
result
);
VOID_TO_NPVARIANT
(
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
}
}
...
@@ -141,7 +141,7 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
...
@@ -141,7 +141,7 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
}
}
else
else
{
{
VOID_TO_NPVARIANT
(
*
result
);
VOID_TO_NPVARIANT
(
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
}
}
...
@@ -158,7 +158,7 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
...
@@ -158,7 +158,7 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
}
}
else
else
{
{
VOID_TO_NPVARIANT
(
*
result
);
VOID_TO_NPVARIANT
(
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
}
}
...
@@ -179,7 +179,7 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
...
@@ -179,7 +179,7 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
}
}
else
else
{
{
VOID_TO_NPVARIANT
(
*
result
);
VOID_TO_NPVARIANT
(
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
}
}
...
@@ -207,7 +207,7 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
...
@@ -207,7 +207,7 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
}
}
else
else
{
{
VOID_TO_NPVARIANT
(
*
result
);
VOID_TO_NPVARIANT
(
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
}
}
...
@@ -224,7 +224,7 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
...
@@ -224,7 +224,7 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
}
}
else
else
{
{
INT32_TO_NPVARIANT
(
val
,
*
result
);
INT32_TO_NPVARIANT
(
val
,
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
}
}
...
@@ -241,7 +241,7 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
...
@@ -241,7 +241,7 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
}
}
else
else
{
{
VOID_TO_NPVARIANT
(
*
result
);
VOID_TO_NPVARIANT
(
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
}
}
...
@@ -249,18 +249,15 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
...
@@ -249,18 +249,15 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
case
ID_get_int_variable
:
case
ID_get_int_variable
:
if
(
(
argCount
==
1
)
&&
NPVARIANT_IS_STRING
(
args
[
0
])
)
if
(
(
argCount
==
1
)
&&
NPVARIANT_IS_STRING
(
args
[
0
])
)
{
{
const
NPString
&
name
=
NPVARIANT_TO_STRING
(
args
[
0
]);
char
*
s
=
stringValue
(
NPVARIANT_TO_STRING
(
args
[
0
]));
NPUTF8
*
s
=
new
NPUTF8
[
name
.
utf8length
+
1
];
if
(
s
)
if
(
s
)
{
{
int
vlc_id
=
libvlc_get_vlc_id
(
p_plugin
->
getVLC
());
int
vlc_id
=
libvlc_get_vlc_id
(
p_plugin
->
getVLC
());
vlc_value_t
val
;
vlc_value_t
val
;
strncpy
(
s
,
name
.
utf8characters
,
name
.
utf8length
);
s
[
name
.
utf8length
]
=
'\0'
;
if
(
VLC_SUCCESS
==
VLC_VariableGet
(
vlc_id
,
s
,
&
val
)
)
if
(
VLC_SUCCESS
==
VLC_VariableGet
(
vlc_id
,
s
,
&
val
)
)
{
{
delete
s
;
delete
s
;
INT32_TO_NPVARIANT
(
val
.
i_int
,
*
result
);
INT32_TO_NPVARIANT
(
val
.
i_int
,
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
else
else
...
@@ -278,19 +275,16 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
...
@@ -278,19 +275,16 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
&&
NPVARIANT_IS_STRING
(
args
[
0
])
&&
NPVARIANT_IS_STRING
(
args
[
0
])
&&
isNumberValue
(
args
[
1
])
)
&&
isNumberValue
(
args
[
1
])
)
{
{
const
NPString
&
name
=
NPVARIANT_TO_STRING
(
args
[
0
]);
char
*
s
=
stringValue
(
NPVARIANT_TO_STRING
(
args
[
0
]));
NPUTF8
*
s
=
new
NPUTF8
[
name
.
utf8length
+
1
];
if
(
s
)
if
(
s
)
{
{
int
vlc_id
=
libvlc_get_vlc_id
(
p_plugin
->
getVLC
());
int
vlc_id
=
libvlc_get_vlc_id
(
p_plugin
->
getVLC
());
vlc_value_t
val
;
vlc_value_t
val
;
strncpy
(
s
,
name
.
utf8characters
,
name
.
utf8length
);
s
[
name
.
utf8length
]
=
'\0'
;
val
.
i_int
=
numberValue
(
args
[
1
]);
val
.
i_int
=
numberValue
(
args
[
1
]);
if
(
VLC_SUCCESS
==
VLC_VariableSet
(
vlc_id
,
s
,
val
)
)
if
(
VLC_SUCCESS
==
VLC_VariableSet
(
vlc_id
,
s
,
val
)
)
{
{
delete
s
;
delete
s
;
VOID_TO_NPVARIANT
(
*
result
);
VOID_TO_NPVARIANT
(
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
else
else
...
@@ -306,18 +300,15 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
...
@@ -306,18 +300,15 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
case
ID_get_bool_variable
:
case
ID_get_bool_variable
:
if
(
(
argCount
==
1
)
&&
NPVARIANT_IS_STRING
(
args
[
0
])
)
if
(
(
argCount
==
1
)
&&
NPVARIANT_IS_STRING
(
args
[
0
])
)
{
{
const
NPString
&
name
=
NPVARIANT_TO_STRING
(
args
[
0
]);
char
*
s
=
stringValue
(
NPVARIANT_TO_STRING
(
args
[
0
]));
NPUTF8
*
s
=
new
NPUTF8
[
name
.
utf8length
+
1
];
if
(
s
)
if
(
s
)
{
{
int
vlc_id
=
libvlc_get_vlc_id
(
p_plugin
->
getVLC
());
int
vlc_id
=
libvlc_get_vlc_id
(
p_plugin
->
getVLC
());
vlc_value_t
val
;
vlc_value_t
val
;
strncpy
(
s
,
name
.
utf8characters
,
name
.
utf8length
);
s
[
name
.
utf8length
]
=
'\0'
;
if
(
VLC_SUCCESS
==
VLC_VariableGet
(
vlc_id
,
s
,
&
val
)
)
if
(
VLC_SUCCESS
==
VLC_VariableGet
(
vlc_id
,
s
,
&
val
)
)
{
{
delete
s
;
delete
s
;
BOOLEAN_TO_NPVARIANT
(
val
.
b_bool
,
*
result
);
BOOLEAN_TO_NPVARIANT
(
val
.
b_bool
,
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
else
else
...
@@ -335,19 +326,16 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
...
@@ -335,19 +326,16 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
&&
NPVARIANT_IS_STRING
(
args
[
0
])
&&
NPVARIANT_IS_STRING
(
args
[
0
])
&&
NPVARIANT_IS_BOOLEAN
(
args
[
1
])
)
&&
NPVARIANT_IS_BOOLEAN
(
args
[
1
])
)
{
{
const
NPString
&
name
=
NPVARIANT_TO_STRING
(
args
[
0
]);
char
*
s
=
stringValue
(
NPVARIANT_TO_STRING
(
args
[
0
]));
NPUTF8
*
s
=
new
NPUTF8
[
name
.
utf8length
+
1
];
if
(
s
)
if
(
s
)
{
{
int
vlc_id
=
libvlc_get_vlc_id
(
p_plugin
->
getVLC
());
int
vlc_id
=
libvlc_get_vlc_id
(
p_plugin
->
getVLC
());
vlc_value_t
val
;
vlc_value_t
val
;
strncpy
(
s
,
name
.
utf8characters
,
name
.
utf8length
);
s
[
name
.
utf8length
]
=
'\0'
;
val
.
b_bool
=
NPVARIANT_TO_BOOLEAN
(
args
[
1
]);
val
.
b_bool
=
NPVARIANT_TO_BOOLEAN
(
args
[
1
]);
if
(
VLC_SUCCESS
==
VLC_VariableSet
(
vlc_id
,
s
,
val
)
)
if
(
VLC_SUCCESS
==
VLC_VariableSet
(
vlc_id
,
s
,
val
)
)
{
{
delete
s
;
delete
s
;
VOID_TO_NPVARIANT
(
*
result
);
VOID_TO_NPVARIANT
(
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
else
else
...
@@ -363,14 +351,11 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
...
@@ -363,14 +351,11 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
case
ID_get_str_variable
:
case
ID_get_str_variable
:
if
(
(
argCount
==
1
)
&&
NPVARIANT_IS_STRING
(
args
[
0
])
)
if
(
(
argCount
==
1
)
&&
NPVARIANT_IS_STRING
(
args
[
0
])
)
{
{
const
NPString
&
name
=
NPVARIANT_TO_STRING
(
args
[
0
]);
char
*
s
=
stringValue
(
NPVARIANT_TO_STRING
(
args
[
0
]));
NPUTF8
*
s
=
new
NPUTF8
[
name
.
utf8length
+
1
];
if
(
s
)
if
(
s
)
{
{
int
vlc_id
=
libvlc_get_vlc_id
(
p_plugin
->
getVLC
());
int
vlc_id
=
libvlc_get_vlc_id
(
p_plugin
->
getVLC
());
vlc_value_t
val
;
vlc_value_t
val
;
strncpy
(
s
,
name
.
utf8characters
,
name
.
utf8length
);
s
[
name
.
utf8length
]
=
'\0'
;
if
(
VLC_SUCCESS
==
VLC_VariableGet
(
vlc_id
,
s
,
&
val
)
)
if
(
VLC_SUCCESS
==
VLC_VariableGet
(
vlc_id
,
s
,
&
val
)
)
{
{
delete
s
;
delete
s
;
...
@@ -381,7 +366,7 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
...
@@ -381,7 +366,7 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
if
(
retval
)
if
(
retval
)
{
{
memcpy
(
retval
,
val
.
psz_string
,
len
);
memcpy
(
retval
,
val
.
psz_string
,
len
);
STRINGN_TO_NPVARIANT
(
retval
,
len
,
*
result
);
STRINGN_TO_NPVARIANT
(
retval
,
len
,
result
);
free
(
val
.
psz_string
);
free
(
val
.
psz_string
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
...
@@ -393,7 +378,7 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
...
@@ -393,7 +378,7 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
else
else
{
{
/* null string */
/* null string */
STRINGN_TO_NPVARIANT
(
NULL
,
0
,
*
result
);
STRINGN_TO_NPVARIANT
(
NULL
,
0
,
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
}
}
...
@@ -412,25 +397,19 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
...
@@ -412,25 +397,19 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
&&
NPVARIANT_IS_STRING
(
args
[
0
])
&&
NPVARIANT_IS_STRING
(
args
[
0
])
&&
NPVARIANT_IS_STRING
(
args
[
1
])
)
&&
NPVARIANT_IS_STRING
(
args
[
1
])
)
{
{
const
NPString
&
name
=
NPVARIANT_TO_STRING
(
args
[
0
]);
char
*
s
=
stringValue
(
NPVARIANT_TO_STRING
(
args
[
0
]));
NPUTF8
*
s
=
new
NPUTF8
[
name
.
utf8length
+
1
];
if
(
s
)
if
(
s
)
{
{
int
vlc_id
=
libvlc_get_vlc_id
(
p_plugin
->
getVLC
());
int
vlc_id
=
libvlc_get_vlc_id
(
p_plugin
->
getVLC
());
vlc_value_t
val
;
vlc_value_t
val
;
strncpy
(
s
,
name
.
utf8characters
,
name
.
utf8length
);
val
.
psz_string
=
stringValue
(
NPVARIANT_TO_STRING
(
args
[
1
]));
s
[
name
.
utf8length
]
=
'\0'
;
const
NPString
&
v
=
NPVARIANT_TO_STRING
(
args
[
1
]);
val
.
psz_string
=
new
NPUTF8
[
v
.
utf8length
+
1
];
if
(
val
.
psz_string
)
if
(
val
.
psz_string
)
{
{
strncpy
(
val
.
psz_string
,
v
.
utf8characters
,
v
.
utf8length
);
val
.
psz_string
[
v
.
utf8length
]
=
'\0'
;
if
(
VLC_SUCCESS
==
VLC_VariableSet
(
vlc_id
,
s
,
val
)
)
if
(
VLC_SUCCESS
==
VLC_VariableSet
(
vlc_id
,
s
,
val
)
)
{
{
delete
s
;
delete
s
;
delete
val
.
psz_string
;
delete
val
.
psz_string
;
VOID_TO_NPVARIANT
(
*
result
);
VOID_TO_NPVARIANT
(
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
else
else
...
@@ -462,7 +441,7 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
...
@@ -462,7 +441,7 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
}
}
else
else
{
{
VOID_TO_NPVARIANT
(
*
result
);
VOID_TO_NPVARIANT
(
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
}
}
...
@@ -470,13 +449,9 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
...
@@ -470,13 +449,9 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
case
ID_add_item
:
case
ID_add_item
:
if
(
(
argCount
==
1
)
&&
NPVARIANT_IS_STRING
(
args
[
0
])
)
if
(
(
argCount
==
1
)
&&
NPVARIANT_IS_STRING
(
args
[
0
])
)
{
{
const
NPString
&
name
=
NPVARIANT_TO_STRING
(
args
[
0
]);
char
*
s
=
stringValue
(
NPVARIANT_TO_STRING
(
args
[
0
]));
NPUTF8
*
s
=
new
NPUTF8
[
name
.
utf8length
+
1
];
if
(
s
)
if
(
s
)
{
{
strncpy
(
s
,
name
.
utf8characters
,
name
.
utf8length
);
s
[
name
.
utf8length
]
=
'\0'
;
char
*
url
=
p_plugin
->
getAbsoluteURL
(
s
);
char
*
url
=
p_plugin
->
getAbsoluteURL
(
s
);
delete
s
;
delete
s
;
if
(
!
url
)
if
(
!
url
)
...
@@ -493,7 +468,7 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
...
@@ -493,7 +468,7 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
}
}
else
else
{
{
INT32_TO_NPVARIANT
(
item
,
*
result
);
INT32_TO_NPVARIANT
(
item
,
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
}
}
...
@@ -513,7 +488,7 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
...
@@ -513,7 +488,7 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
}
}
else
else
{
{
VOID_TO_NPVARIANT
(
*
result
);
VOID_TO_NPVARIANT
(
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
}
}
...
@@ -530,7 +505,7 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
...
@@ -530,7 +505,7 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
}
}
else
else
{
{
VOID_TO_NPVARIANT
(
*
result
);
VOID_TO_NPVARIANT
(
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
}
}
...
@@ -547,7 +522,7 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
...
@@ -547,7 +522,7 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
}
}
else
else
{
{
BOOLEAN_TO_NPVARIANT
(
isplaying
,
*
result
);
BOOLEAN_TO_NPVARIANT
(
isplaying
,
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
}
}
...
@@ -568,7 +543,7 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
...
@@ -568,7 +543,7 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
}
}
else
else
{
{
INT32_TO_NPVARIANT
((
uint32_t
)(
val
/
1000LL
),
*
result
);
INT32_TO_NPVARIANT
((
uint32_t
)(
val
/
1000LL
),
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
}
}
...
@@ -600,7 +575,7 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
...
@@ -600,7 +575,7 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
}
}
else
else
{
{
DOUBLE_TO_NPVARIANT
((
double
)
val
,
*
result
);
DOUBLE_TO_NPVARIANT
((
double
)
val
,
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
}
}
...
@@ -632,7 +607,7 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
...
@@ -632,7 +607,7 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
}
}
else
else
{
{
DOUBLE_TO_NPVARIANT
((
uint32_t
)(
val
/
1000LL
),
*
result
);
DOUBLE_TO_NPVARIANT
((
uint32_t
)(
val
/
1000LL
),
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
}
}
...
@@ -680,7 +655,7 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
...
@@ -680,7 +655,7 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
libvlc_exception_clear
(
&
ex
);
libvlc_exception_clear
(
&
ex
);
return
INVOKERESULT_GENERIC_ERROR
;
return
INVOKERESULT_GENERIC_ERROR
;
}
}
VOID_TO_NPVARIANT
(
*
result
);
VOID_TO_NPVARIANT
(
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
else
else
...
...
mozilla/control/npovlc.h
View file @
310dfdca
...
@@ -43,6 +43,6 @@ protected:
...
@@ -43,6 +43,6 @@ protected:
static
const
int
methodCount
;
static
const
int
methodCount
;
static
const
NPUTF8
*
const
methodNames
[];
static
const
NPUTF8
*
const
methodNames
[];
virtual
InvokeResult
invoke
(
int
index
,
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
*
result
);
virtual
InvokeResult
invoke
(
int
index
,
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
&
result
);
};
};
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