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
e12fca62
Commit
e12fca62
authored
Mar 25, 2007
by
Damien Fouilleul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- mozilla: nultiple bugfix backports from trunk
parent
7194c2f6
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
265 additions
and
172 deletions
+265
-172
mozilla/control/npolibvlc.cpp
mozilla/control/npolibvlc.cpp
+144
-119
mozilla/control/npolibvlc.h
mozilla/control/npolibvlc.h
+19
-5
mozilla/control/nporuntime.h
mozilla/control/nporuntime.h
+57
-22
mozilla/vlcplugin.cpp
mozilla/vlcplugin.cpp
+0
-12
mozilla/vlcplugin.h
mozilla/vlcplugin.h
+3
-3
mozilla/vlcshell.cpp
mozilla/vlcshell.cpp
+42
-11
No files found.
mozilla/control/npolibvlc.cpp
View file @
e12fca62
This diff is collapsed.
Click to expand it.
mozilla/control/npolibvlc.h
View file @
e12fca62
...
...
@@ -32,7 +32,14 @@ class LibvlcRootNPObject: public RuntimeNPObject
protected:
friend
class
RuntimeNPClass
<
LibvlcRootNPObject
>
;
LibvlcRootNPObject
(
NPP
instance
,
const
NPClass
*
aClass
);
LibvlcRootNPObject
(
NPP
instance
,
const
NPClass
*
aClass
)
:
RuntimeNPObject
(
instance
,
aClass
),
audioObj
(
NULL
),
inputObj
(
NULL
),
logObj
(
NULL
),
playlistObj
(
NULL
),
videoObj
(
NULL
)
{};
virtual
~
LibvlcRootNPObject
();
static
const
int
propertyCount
;
...
...
@@ -45,6 +52,7 @@ protected:
InvokeResult
invoke
(
int
index
,
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
&
result
);
private:
NPObject
*
audioObj
;
NPObject
*
inputObj
;
NPObject
*
logObj
;
...
...
@@ -171,7 +179,10 @@ class LibvlcLogNPObject: public RuntimeNPObject
protected:
friend
class
RuntimeNPClass
<
LibvlcLogNPObject
>
;
LibvlcLogNPObject
(
NPP
instance
,
const
NPClass
*
aClass
);
LibvlcLogNPObject
(
NPP
instance
,
const
NPClass
*
aClass
)
:
RuntimeNPObject
(
instance
,
aClass
),
messagesObj
(
NULL
)
{};
virtual
~
LibvlcLogNPObject
();
static
const
int
propertyCount
;
...
...
@@ -184,7 +195,7 @@ protected:
static
const
NPUTF8
*
const
methodNames
[];
private:
LibvlcMessagesNPObject
*
_p_vlcmessages
;
NPObject
*
messagesObj
;
};
class
LibvlcPlaylistItemsNPObject
:
public
RuntimeNPObject
...
...
@@ -212,7 +223,10 @@ class LibvlcPlaylistNPObject: public RuntimeNPObject
protected:
friend
class
RuntimeNPClass
<
LibvlcPlaylistNPObject
>
;
LibvlcPlaylistNPObject
(
NPP
instance
,
const
NPClass
*
aClass
);
LibvlcPlaylistNPObject
(
NPP
instance
,
const
NPClass
*
aClass
)
:
RuntimeNPObject
(
instance
,
aClass
),
playlistItemsObj
(
NULL
)
{};
virtual
~
LibvlcPlaylistNPObject
();
static
const
int
propertyCount
;
...
...
@@ -229,7 +243,7 @@ protected:
void
parseOptions
(
NPObject
*
obj
,
int
*
i_options
,
char
***
ppsz_options
);
private:
LibvlcPlaylistItemsNPObject
*
_p_vlcplaylistitems
;
NPObject
*
playlistItemsObj
;
};
class
LibvlcVideoNPObject
:
public
RuntimeNPObject
...
...
mozilla/control/nporuntime.h
View file @
e12fca62
...
...
@@ -69,6 +69,24 @@ public:
static
char
*
stringValue
(
const
NPVariant
&
v
);
protected:
void
*
operator
new
(
size_t
n
)
{
/*
** Assume that browser has a smarter memory allocator
** than plain old malloc() and use it instead.
*/
return
NPN_MemAlloc
(
n
);
};
void
operator
delete
(
void
*
p
)
{
NPN_MemFree
(
p
);
};
bool
isValid
()
{
return
_instance
!=
NULL
;
};
RuntimeNPObject
(
NPP
instance
,
const
NPClass
*
aClass
)
:
_instance
(
instance
)
...
...
@@ -149,12 +167,13 @@ template<class T>
static
NPObject
*
RuntimeNPClassAllocate
(
NPP
instance
,
NPClass
*
aClass
)
{
const
RuntimeNPClass
<
T
>
*
vClass
=
static_cast
<
RuntimeNPClass
<
T
>
*>
(
aClass
);
return
(
NPObject
*
)
vClass
->
create
(
instance
);
return
vClass
->
create
(
instance
);
}
static
void
RuntimeNPClassDeallocate
(
NPObject
*
npobj
)
{
RuntimeNPObject
*
vObj
=
static_cast
<
RuntimeNPObject
*>
(
npobj
);
vObj
->
_class
=
NULL
;
delete
vObj
;
}
...
...
@@ -181,39 +200,48 @@ static bool RuntimeNPClassHasProperty(NPObject *npobj, NPIdentifier name)
template
<
class
T
>
static
bool
RuntimeNPClassGetProperty
(
NPObject
*
npobj
,
NPIdentifier
name
,
NPVariant
*
result
)
{
RuntimeNPObject
*
vObj
=
static_cast
<
RuntimeNPObject
*>
(
npobj
);
if
(
vObj
->
isValid
()
)
{
const
RuntimeNPClass
<
T
>
*
vClass
=
static_cast
<
RuntimeNPClass
<
T
>
*>
(
npobj
->
_class
);
int
index
=
vClass
->
indexOfProperty
(
name
);
if
(
index
!=
-
1
)
{
RuntimeNPObject
*
vObj
=
static_cast
<
RuntimeNPObject
*>
(
npobj
);
return
vObj
->
returnInvokeResult
(
vObj
->
getProperty
(
index
,
*
result
));
}
}
return
false
;
}
template
<
class
T
>
static
bool
RuntimeNPClassSetProperty
(
NPObject
*
npobj
,
NPIdentifier
name
,
const
NPVariant
*
value
)
{
RuntimeNPObject
*
vObj
=
static_cast
<
RuntimeNPObject
*>
(
npobj
);
if
(
vObj
->
isValid
()
)
{
const
RuntimeNPClass
<
T
>
*
vClass
=
static_cast
<
RuntimeNPClass
<
T
>
*>
(
npobj
->
_class
);
int
index
=
vClass
->
indexOfProperty
(
name
);
if
(
index
!=
-
1
)
{
RuntimeNPObject
*
vObj
=
static_cast
<
RuntimeNPObject
*>
(
npobj
);
return
vObj
->
returnInvokeResult
(
vObj
->
setProperty
(
index
,
*
value
));
}
}
return
false
;
}
template
<
class
T
>
static
bool
RuntimeNPClassRemoveProperty
(
NPObject
*
npobj
,
NPIdentifier
name
)
{
RuntimeNPObject
*
vObj
=
static_cast
<
RuntimeNPObject
*>
(
npobj
);
if
(
vObj
->
isValid
()
)
{
const
RuntimeNPClass
<
T
>
*
vClass
=
static_cast
<
RuntimeNPClass
<
T
>
*>
(
npobj
->
_class
);
int
index
=
vClass
->
indexOfProperty
(
name
);
if
(
index
!=
-
1
)
{
RuntimeNPObject
*
vObj
=
static_cast
<
RuntimeNPObject
*>
(
npobj
);
return
vObj
->
returnInvokeResult
(
vObj
->
removeProperty
(
index
));
}
}
return
false
;
}
...
...
@@ -222,14 +250,17 @@ static bool RuntimeNPClassInvoke(NPObject *npobj, NPIdentifier name,
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
*
result
)
{
RuntimeNPObject
*
vObj
=
static_cast
<
RuntimeNPObject
*>
(
npobj
);
if
(
vObj
->
isValid
()
)
{
const
RuntimeNPClass
<
T
>
*
vClass
=
static_cast
<
RuntimeNPClass
<
T
>
*>
(
npobj
->
_class
);
int
index
=
vClass
->
indexOfMethod
(
name
);
if
(
index
!=
-
1
)
{
RuntimeNPObject
*
vObj
=
static_cast
<
RuntimeNPObject
*>
(
npobj
);
return
vObj
->
returnInvokeResult
(
vObj
->
invoke
(
index
,
args
,
argCount
,
*
result
));
}
}
return
false
;
}
...
...
@@ -239,7 +270,11 @@ static bool RuntimeNPClassInvokeDefault(NPObject *npobj,
NPVariant
*
result
)
{
RuntimeNPObject
*
vObj
=
static_cast
<
RuntimeNPObject
*>
(
npobj
);
if
(
vObj
->
isValid
()
)
{
return
vObj
->
returnInvokeResult
(
vObj
->
invokeDefault
(
args
,
argCount
,
*
result
));
}
return
false
;
}
template
<
class
T
>
...
...
mozilla/vlcplugin.cpp
View file @
e12fca62
...
...
@@ -48,7 +48,6 @@ VlcPlugin::VlcPlugin( NPP instance, uint16 mode ) :
libvlc_instance
(
NULL
),
libvlc_log
(
NULL
),
p_scriptClass
(
NULL
),
p_scriptObject
(
NULL
),
p_browser
(
instance
),
psz_baseURL
(
NULL
)
#if XP_WIN
...
...
@@ -284,8 +283,6 @@ VlcPlugin::~VlcPlugin()
{
delete
psz_baseURL
;
delete
psz_target
;
if
(
p_scriptObject
)
NPN_ReleaseObject
(
p_scriptObject
);
if
(
libvlc_log
)
libvlc_log_close
(
libvlc_log
,
NULL
);
if
(
libvlc_instance
)
...
...
@@ -440,15 +437,6 @@ relativeurl:
return
NULL
;
}
NPObject
*
VlcPlugin
::
getScriptObject
()
{
if
(
NULL
==
p_scriptObject
)
{
p_scriptObject
=
NPN_CreateObject
(
p_browser
,
p_scriptClass
);
}
return
NPN_RetainObject
(
p_scriptObject
);
}
#if XP_UNIX
int
VlcPlugin
::
setSize
(
unsigned
width
,
unsigned
height
)
{
...
...
mozilla/vlcplugin.h
View file @
e12fca62
...
...
@@ -71,7 +71,8 @@ public:
void
setWindow
(
const
NPWindow
*
window
)
{
npwindow
=
*
window
;
};
NPObject
*
getScriptObject
();
NPClass
*
getScriptClass
()
{
return
p_scriptClass
;
};
void
setLog
(
libvlc_log_t
*
log
)
{
libvlc_log
=
log
;
};
...
...
@@ -100,7 +101,6 @@ private:
libvlc_instance_t
*
libvlc_instance
;
libvlc_log_t
*
libvlc_log
;
NPClass
*
p_scriptClass
;
NPObject
*
p_scriptObject
;
/* browser reference */
NPP
p_browser
;
...
...
@@ -121,7 +121,7 @@ private:
******************************************************************************/
#define PLUGIN_NAME "VLC Multimedia Plugin"
#define PLUGIN_DESCRIPTION \
"Version %s, copyright 1996-200
6
The VideoLAN Team" \
"Version %s, copyright 1996-200
7
The VideoLAN Team" \
"<br><a href=\"http://www.videolan.org/\">http://www.videolan.org/</a>"
#define PLUGIN_MIMETYPES \
...
...
mozilla/vlcshell.cpp
View file @
e12fca62
...
...
@@ -99,7 +99,7 @@ NPError NPP_GetValue( NPP instance, NPPVariable variable, void *value )
default:
/* move on to instance variables ... */
break
;
;
}
if
(
instance
==
NULL
)
...
...
@@ -119,18 +119,32 @@ NPError NPP_GetValue( NPP instance, NPPVariable variable, void *value )
switch
(
variable
)
{
case
NPPVpluginScriptableNPObject
:
/* create an instance and return it */
*
(
NPObject
**
)
value
=
p_plugin
->
getScriptObject
();
if
(
NULL
==
*
(
NPObject
**
)
value
)
{
return
NPERR_OUT_OF_MEMORY_ERROR
;
/* retrieve plugin root class */
NPClass
*
scriptClass
=
p_plugin
->
getScriptClass
();
if
(
scriptClass
)
{
/* create an instance and return it */
*
(
NPObject
**
)
value
=
NPN_CreateObject
(
instance
,
scriptClass
);
return
NPERR_NO_ERROR
;
}
break
;
}
default:
return
NPERR_GENERIC_ERROR
;
;
}
return
NPERR_NO_ERROR
;
return
NPERR_GENERIC_ERROR
;
}
/*
* there is some confusion in gecko headers regarding definition of this API
* NPPVariable is wrongly defined as NPNVariable, which sounds incorrect.
*/
NPError
NPP_SetValue
(
NPP
instance
,
NPNVariable
variable
,
void
*
value
)
{
return
NPERR_GENERIC_ERROR
;
}
/******************************************************************************
...
...
@@ -147,6 +161,12 @@ int16 NPP_HandleEvent( NPP instance, void * event )
}
VlcPlugin
*
p_plugin
=
(
VlcPlugin
*
)
instance
->
pdata
;
if
(
p_plugin
==
NULL
)
{
return
false
;
}
EventRecord
*
myEvent
=
(
EventRecord
*
)
event
;
switch
(
myEvent
->
what
)
...
...
@@ -281,10 +301,14 @@ NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
}
status
=
p_plugin
->
init
(
argc
,
argn
,
argv
);
if
(
NPERR_NO_ERROR
==
status
)
{
if
(
NPERR_NO_ERROR
==
status
)
{
instance
->
pdata
=
reinterpret_cast
<
void
*>
(
p_plugin
);
//NPN_SetValue(instance, NPPVpluginWindowBool, (void *)false);
NPN_SetValue
(
instance
,
NPPVpluginTransparentBool
,
(
void
*
)
false
);
}
else
{
else
{
delete
p_plugin
;
}
return
status
;
...
...
@@ -311,7 +335,6 @@ NPError NPP_Destroy( NPP instance, NPSavedData** save )
}
#endif
if
(
p_plugin
)
delete
p_plugin
;
return
NPERR_NO_ERROR
;
...
...
@@ -479,6 +502,10 @@ NPError NPP_NewStream( NPP instance, NPMIMEType type, NPStream *stream,
}
VlcPlugin
*
p_plugin
=
reinterpret_cast
<
VlcPlugin
*>
(
instance
->
pdata
);
if
(
NULL
==
p_plugin
)
{
return
NPERR_INVALID_INSTANCE_ERROR
;
}
/*
** Firefox/Mozilla may decide to open a stream from the URL specified
...
...
@@ -529,6 +556,10 @@ void NPP_StreamAsFile( NPP instance, NPStream *stream, const char* fname )
}
VlcPlugin
*
p_plugin
=
reinterpret_cast
<
VlcPlugin
*>
(
instance
->
pdata
);
if
(
NULL
==
p_plugin
)
{
return
;
}
if
(
libvlc_playlist_add
(
p_plugin
->
getVLC
(),
fname
,
stream
->
url
,
NULL
)
!=
-
1
)
{
...
...
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