Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
b7f934a7
Commit
b7f934a7
authored
May 17, 2009
by
JP Dinger
Committed by
Rémi Denis-Courmont
May 18, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract common string-to-variant code in mozilla plugin.
Signed-off-by:
Rémi Denis-Courmont
<
remi@remlab.net
>
parent
e4fb8860
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
98 deletions
+37
-98
projects/mozilla/control/npolibvlc.cpp
projects/mozilla/control/npolibvlc.cpp
+14
-98
projects/mozilla/control/nporuntime.cpp
projects/mozilla/control/nporuntime.cpp
+21
-0
projects/mozilla/control/nporuntime.h
projects/mozilla/control/nporuntime.h
+2
-0
No files found.
projects/mozilla/control/npolibvlc.cpp
View file @
b7f934a7
...
...
@@ -4,7 +4,7 @@
* Copyright (C) 2002-2009 the VideoLAN team
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
* J
an Paul
Dinger <jpd@m2x.nl>
* J
P
Dinger <jpd@m2x.nl>
*
* 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
...
...
@@ -141,17 +141,7 @@ LibvlcRootNPObject::getProperty(int index, NPVariant &result)
OBJECT_TO_NPVARIANT
(
NPN_RetainObject
(
videoObj
),
result
);
return
INVOKERESULT_NO_ERROR
;
case
ID_root_VersionInfo
:
{
const
char
*
s
=
libvlc_get_version
();
int
len
=
strlen
(
s
);
NPUTF8
*
retval
=
(
NPUTF8
*
)
NPN_MemAlloc
(
len
);
if
(
!
retval
)
return
INVOKERESULT_OUT_OF_MEMORY
;
memcpy
(
retval
,
s
,
len
);
STRINGN_TO_NPVARIANT
(
retval
,
len
,
result
);
return
INVOKERESULT_NO_ERROR
;
}
return
invokeResultString
(
libvlc_get_version
(),
result
);
default:
;
}
...
...
@@ -182,18 +172,9 @@ RuntimeNPObject::InvokeResult LibvlcRootNPObject::invoke(int index,
switch
(
index
)
{
case
ID_root_versionInfo
:
if
(
argCount
==
0
)
{
const
char
*
s
=
libvlc_get_version
();
int
len
=
strlen
(
s
);
NPUTF8
*
retval
=
(
NPUTF8
*
)
NPN_MemAlloc
(
len
);
if
(
!
retval
)
return
INVOKERESULT_OUT_OF_MEMORY
;
memcpy
(
retval
,
s
,
len
);
STRINGN_TO_NPVARIANT
(
retval
,
len
,
result
);
return
INVOKERESULT_NO_ERROR
;
}
return
INVOKERESULT_NO_SUCH_METHOD
;
if
(
0
!=
argCount
)
return
INVOKERESULT_NO_SUCH_METHOD
;
return
invokeResultString
(
libvlc_get_version
(),
result
);
default:
;
}
...
...
@@ -590,77 +571,13 @@ LibvlcMessageNPObject::getProperty(int index, NPVariant &result)
return
INVOKERESULT_NO_ERROR
;
}
case
ID_message_type
:
{
if
(
_msg
.
psz_type
)
{
int
len
=
strlen
(
_msg
.
psz_type
);
NPUTF8
*
retval
=
(
NPUTF8
*
)
NPN_MemAlloc
(
len
);
if
(
retval
)
{
memcpy
(
retval
,
_msg
.
psz_type
,
len
);
STRINGN_TO_NPVARIANT
(
retval
,
len
,
result
);
}
}
else
{
NULL_TO_NPVARIANT
(
result
);
}
return
INVOKERESULT_NO_ERROR
;
}
return
invokeResultString
(
_msg
.
psz_type
,
result
);
case
ID_message_name
:
{
if
(
_msg
.
psz_name
)
{
int
len
=
strlen
(
_msg
.
psz_name
);
NPUTF8
*
retval
=
(
NPUTF8
*
)
NPN_MemAlloc
(
len
);
if
(
retval
)
{
memcpy
(
retval
,
_msg
.
psz_name
,
len
);
STRINGN_TO_NPVARIANT
(
retval
,
len
,
result
);
}
}
else
{
NULL_TO_NPVARIANT
(
result
);
}
return
INVOKERESULT_NO_ERROR
;
}
return
invokeResultString
(
_msg
.
psz_name
,
result
);
case
ID_message_header
:
{
if
(
_msg
.
psz_header
)
{
int
len
=
strlen
(
_msg
.
psz_header
);
NPUTF8
*
retval
=
(
NPUTF8
*
)
NPN_MemAlloc
(
len
);
if
(
retval
)
{
memcpy
(
retval
,
_msg
.
psz_header
,
len
);
STRINGN_TO_NPVARIANT
(
retval
,
len
,
result
);
}
}
else
{
NULL_TO_NPVARIANT
(
result
);
}
return
INVOKERESULT_NO_ERROR
;
}
return
invokeResultString
(
_msg
.
psz_header
,
result
);
case
ID_message_message
:
{
if
(
_msg
.
psz_message
)
{
int
len
=
strlen
(
_msg
.
psz_message
);
NPUTF8
*
retval
=
(
NPUTF8
*
)
NPN_MemAlloc
(
len
);
if
(
retval
)
{
memcpy
(
retval
,
_msg
.
psz_message
,
len
);
STRINGN_TO_NPVARIANT
(
retval
,
len
,
result
);
}
}
else
{
NULL_TO_NPVARIANT
(
result
);
}
return
INVOKERESULT_NO_ERROR
;
}
return
invokeResultString
(
_msg
.
psz_message
,
result
);
default:
;
}
...
...
@@ -1134,10 +1051,9 @@ LibvlcPlaylistItemsNPObject::invoke(int index, const NPVariant *args,
LibvlcPlaylistNPObject
::~
LibvlcPlaylistNPObject
()
{
if
(
isValid
()
)
{
if
(
playlistItemsObj
)
NPN_ReleaseObject
(
playlistItemsObj
);
}
// Why the isValid()?
if
(
isValid
()
&&
playlistItemsObj
)
NPN_ReleaseObject
(
playlistItemsObj
);
};
const
NPUTF8
*
const
LibvlcPlaylistNPObject
::
propertyNames
[]
=
...
...
@@ -1315,8 +1231,8 @@ LibvlcPlaylistNPObject::invoke(int index, const NPVariant *args,
}
}
int
item
=
p_plugin
->
playlist_add_extended_untrusted
(
url
,
name
,
i_options
,
const_cast
<
const
char
**>
(
ppsz_options
),
&
ex
);
int
item
=
p_plugin
->
playlist_add_extended_untrusted
(
url
,
name
,
i_options
,
const_cast
<
const
char
**>
(
ppsz_options
),
&
ex
);
free
(
url
);
free
(
name
);
for
(
int
i
=
0
;
i
<
i_options
;
++
i
)
...
...
projects/mozilla/control/nporuntime.cpp
View file @
b7f934a7
...
...
@@ -110,3 +110,24 @@ bool RuntimeNPObject::returnInvokeResult(RuntimeNPObject::InvokeResult result)
}
return
false
;
}
RuntimeNPObject
::
InvokeResult
RuntimeNPObject
::
invokeResultString
(
const
char
*
psz
,
NPVariant
&
result
)
{
if
(
!
psz
)
NULL_TO_NPVARIANT
(
result
);
else
{
size_t
len
=
strlen
(
psz
);
NPUTF8
*
retval
=
(
NPUTF8
*
)
NPN_MemAlloc
(
len
);
if
(
!
retval
)
return
INVOKERESULT_OUT_OF_MEMORY
;
else
{
memcpy
(
retval
,
psz
,
len
);
STRINGN_TO_NPVARIANT
(
retval
,
len
,
result
);
}
}
return
INVOKERESULT_NO_ERROR
;
}
projects/mozilla/control/nporuntime.h
View file @
b7f934a7
...
...
@@ -127,6 +127,8 @@ protected:
bool
returnInvokeResult
(
InvokeResult
result
);
static
InvokeResult
invokeResultString
(
const
char
*
,
NPVariant
&
);
bool
isPluginRunning
()
{
return
_instance
->
pdata
;
...
...
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