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
a8fd6d96
Commit
a8fd6d96
authored
Mar 20, 2007
by
Damien Fouilleul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- mozilla: some cleanup, workarounds for potential crash scenarios
parent
1c9c2faa
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
153 additions
and
81 deletions
+153
-81
mozilla/control/npolibvlc.cpp
mozilla/control/npolibvlc.cpp
+81
-54
mozilla/control/npolibvlc.h
mozilla/control/npolibvlc.h
+3
-2
mozilla/control/nporuntime.h
mozilla/control/nporuntime.h
+54
-23
mozilla/vlcshell.cpp
mozilla/vlcshell.cpp
+15
-2
No files found.
mozilla/control/npolibvlc.cpp
View file @
a8fd6d96
This diff is collapsed.
Click to expand it.
mozilla/control/npolibvlc.h
View file @
a8fd6d96
...
...
@@ -45,6 +45,7 @@ protected:
InvokeResult
invoke
(
int
index
,
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
&
result
);
private:
NPObject
*
audioObj
;
NPObject
*
inputObj
;
NPObject
*
logObj
;
...
...
@@ -184,7 +185,7 @@ protected:
static
const
NPUTF8
*
const
methodNames
[];
private:
LibvlcMessages
NPObject
*
_p_vlcmessages
;
NPObject
*
_p_vlcmessages
;
};
class
LibvlcPlaylistItemsNPObject
:
public
RuntimeNPObject
...
...
@@ -229,7 +230,7 @@ protected:
void
parseOptions
(
NPObject
*
obj
,
int
*
i_options
,
char
***
ppsz_options
);
private:
LibvlcPlaylistItemsNPObject
*
_p_vlcplaylistitems
;
NPObject
*
_p_vlcplaylistitems
;
};
class
LibvlcVideoNPObject
:
public
RuntimeNPObject
...
...
mozilla/control/nporuntime.h
View file @
a8fd6d96
...
...
@@ -69,12 +69,26 @@ public:
static
char
*
stringValue
(
const
NPVariant
&
v
);
protected:
void
*
operator
new
(
size_t
n
)
{
return
NPN_MemAlloc
(
n
);
};
void
operator
delete
(
void
*
p
)
{
/*
** Some memory scribble happens occasionally on freed object
** when used on Firefox (MacOS X) and may cause crash, a leak
** sounds like the better option.
*/
//NPN_MemFree(p);
};
RuntimeNPObject
(
NPP
instance
,
const
NPClass
*
aClass
)
:
_instance
(
instance
)
{
_class
=
const_cast
<
NPClass
*>
(
aClass
);
referenceCount
=
1
;
//
referenceCount = 1;
};
virtual
~
RuntimeNPObject
()
{};
...
...
@@ -149,12 +163,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,12 +196,15 @@ static bool RuntimeNPClassHasProperty(NPObject *npobj, NPIdentifier name)
template
<
class
T
>
static
bool
RuntimeNPClassGetProperty
(
NPObject
*
npobj
,
NPIdentifier
name
,
NPVariant
*
result
)
{
const
RuntimeNPClass
<
T
>
*
vClass
=
static_cast
<
RuntimeNPClass
<
T
>
*>
(
npobj
->
_class
);
int
index
=
vClass
->
indexOfProperty
(
name
);
if
(
index
!=
-
1
)
RuntimeNPObject
*
vObj
=
static_cast
<
RuntimeNPObject
*>
(
npobj
);
if
(
vObj
->
_instance
)
{
RuntimeNPObject
*
vObj
=
static_cast
<
RuntimeNPObject
*>
(
npobj
);
return
vObj
->
returnInvokeResult
(
vObj
->
getProperty
(
index
,
*
result
));
const
RuntimeNPClass
<
T
>
*
vClass
=
static_cast
<
RuntimeNPClass
<
T
>
*>
(
npobj
->
_class
);
int
index
=
vClass
->
indexOfProperty
(
name
);
if
(
index
!=
-
1
)
{
return
vObj
->
returnInvokeResult
(
vObj
->
getProperty
(
index
,
*
result
));
}
}
return
false
;
}
...
...
@@ -194,12 +212,15 @@ static bool RuntimeNPClassGetProperty(NPObject *npobj, NPIdentifier name, NPVari
template
<
class
T
>
static
bool
RuntimeNPClassSetProperty
(
NPObject
*
npobj
,
NPIdentifier
name
,
const
NPVariant
*
value
)
{
const
RuntimeNPClass
<
T
>
*
vClass
=
static_cast
<
RuntimeNPClass
<
T
>
*>
(
npobj
->
_class
);
int
index
=
vClass
->
indexOfProperty
(
name
);
if
(
index
!=
-
1
)
RuntimeNPObject
*
vObj
=
static_cast
<
RuntimeNPObject
*>
(
npobj
);
if
(
vObj
->
_instance
)
{
RuntimeNPObject
*
vObj
=
static_cast
<
RuntimeNPObject
*>
(
npobj
);
return
vObj
->
returnInvokeResult
(
vObj
->
setProperty
(
index
,
*
value
));
const
RuntimeNPClass
<
T
>
*
vClass
=
static_cast
<
RuntimeNPClass
<
T
>
*>
(
npobj
->
_class
);
int
index
=
vClass
->
indexOfProperty
(
name
);
if
(
index
!=
-
1
)
{
return
vObj
->
returnInvokeResult
(
vObj
->
setProperty
(
index
,
*
value
));
}
}
return
false
;
}
...
...
@@ -207,12 +228,15 @@ static bool RuntimeNPClassSetProperty(NPObject *npobj, NPIdentifier name, const
template
<
class
T
>
static
bool
RuntimeNPClassRemoveProperty
(
NPObject
*
npobj
,
NPIdentifier
name
)
{
const
RuntimeNPClass
<
T
>
*
vClass
=
static_cast
<
RuntimeNPClass
<
T
>
*>
(
npobj
->
_class
);
int
index
=
vClass
->
indexOfProperty
(
name
);
if
(
index
!=
-
1
)
RuntimeNPObject
*
vObj
=
static_cast
<
RuntimeNPObject
*>
(
npobj
);
if
(
vObj
->
_instance
)
{
RuntimeNPObject
*
vObj
=
static_cast
<
RuntimeNPObject
*>
(
npobj
);
return
vObj
->
returnInvokeResult
(
vObj
->
removeProperty
(
index
));
const
RuntimeNPClass
<
T
>
*
vClass
=
static_cast
<
RuntimeNPClass
<
T
>
*>
(
npobj
->
_class
);
int
index
=
vClass
->
indexOfProperty
(
name
);
if
(
index
!=
-
1
)
{
return
vObj
->
returnInvokeResult
(
vObj
->
removeProperty
(
index
));
}
}
return
false
;
}
...
...
@@ -222,13 +246,16 @@ static bool RuntimeNPClassInvoke(NPObject *npobj, NPIdentifier name,
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
*
result
)
{
const
RuntimeNPClass
<
T
>
*
vClass
=
static_cast
<
RuntimeNPClass
<
T
>
*>
(
npobj
->
_class
);
int
index
=
vClass
->
indexOfMethod
(
name
);
if
(
index
!=
-
1
)
RuntimeNPObject
*
vObj
=
static_cast
<
RuntimeNPObject
*>
(
npobj
);
if
(
vObj
->
_instance
)
{
RuntimeNPObject
*
vObj
=
static_cast
<
RuntimeNPObject
*>
(
npobj
);
return
vObj
->
returnInvokeResult
(
vObj
->
invoke
(
index
,
args
,
argCount
,
*
result
));
const
RuntimeNPClass
<
T
>
*
vClass
=
static_cast
<
RuntimeNPClass
<
T
>
*>
(
npobj
->
_class
);
int
index
=
vClass
->
indexOfMethod
(
name
);
if
(
index
!=
-
1
)
{
return
vObj
->
returnInvokeResult
(
vObj
->
invoke
(
index
,
args
,
argCount
,
*
result
));
}
}
return
false
;
}
...
...
@@ -239,7 +266,11 @@ static bool RuntimeNPClassInvokeDefault(NPObject *npobj,
NPVariant
*
result
)
{
RuntimeNPObject
*
vObj
=
static_cast
<
RuntimeNPObject
*>
(
npobj
);
return
vObj
->
returnInvokeResult
(
vObj
->
invokeDefault
(
args
,
argCount
,
*
result
));
if
(
vObj
->
_instance
)
{
return
vObj
->
returnInvokeResult
(
vObj
->
invokeDefault
(
args
,
argCount
,
*
result
));
}
return
false
;
}
template
<
class
T
>
...
...
mozilla/vlcshell.cpp
View file @
a8fd6d96
...
...
@@ -147,6 +147,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
)
...
...
@@ -311,8 +317,7 @@ NPError NPP_Destroy( NPP instance, NPSavedData** save )
}
#endif
if
(
p_plugin
)
delete
p_plugin
;
delete
p_plugin
;
return
NPERR_NO_ERROR
;
}
...
...
@@ -479,6 +484,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 +538,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