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
8e6efd05
Commit
8e6efd05
authored
Jan 19, 2010
by
JP Dinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update mozilla plugin and test page for new logo interface.
parent
9ff83fc5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
265 additions
and
24 deletions
+265
-24
projects/mozilla/control/npolibvlc.cpp
projects/mozilla/control/npolibvlc.cpp
+231
-6
projects/mozilla/control/npolibvlc.h
projects/mozilla/control/npolibvlc.h
+24
-2
projects/mozilla/test.html
projects/mozilla/test.html
+10
-16
No files found.
projects/mozilla/control/npolibvlc.cpp
View file @
8e6efd05
...
@@ -2,9 +2,10 @@
...
@@ -2,9 +2,10 @@
* npolibvlc.cpp: official Javascript APIs
* npolibvlc.cpp: official Javascript APIs
*****************************************************************************
*****************************************************************************
* Copyright (C) 2002-2009 the VideoLAN team
* Copyright (C) 2002-2009 the VideoLAN team
* Copyright (C) 2010 M2X BV
*
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
* JP Dinger <jpd@
m2x.nl
>
* JP Dinger <jpd@
videolan.org
>
*
*
* This program is free software; you can redistribute it and/or modify
* 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
* it under the terms of the GNU General Public License as published by
...
@@ -16,9 +17,9 @@
...
@@ -16,9 +17,9 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU General Public License
along
*
along with this program; if not, write to the Free Software
*
with this program; if not, write to the Free Software Foundation, Inc.,
*
Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
*****************************************************************************/
#include "config.h"
#include "config.h"
...
@@ -1266,7 +1267,8 @@ const NPUTF8 * const LibvlcVideoNPObject::propertyNames[] =
...
@@ -1266,7 +1267,8 @@ const NPUTF8 * const LibvlcVideoNPObject::propertyNames[] =
"subtitle"
,
"subtitle"
,
"crop"
,
"crop"
,
"teletext"
,
"teletext"
,
"marquee"
"marquee"
,
"logo"
};
};
enum
LibvlcVideoNPObjectPropertyIds
enum
LibvlcVideoNPObjectPropertyIds
...
@@ -1278,7 +1280,8 @@ enum LibvlcVideoNPObjectPropertyIds
...
@@ -1278,7 +1280,8 @@ enum LibvlcVideoNPObjectPropertyIds
ID_video_subtitle
,
ID_video_subtitle
,
ID_video_crop
,
ID_video_crop
,
ID_video_teletext
,
ID_video_teletext
,
ID_video_marquee
ID_video_marquee
,
ID_video_logo
};
};
COUNTNAMES
(
LibvlcVideoNPObject
,
propertyCount
,
propertyNames
);
COUNTNAMES
(
LibvlcVideoNPObject
,
propertyCount
,
propertyNames
);
...
@@ -1358,6 +1361,12 @@ LibvlcVideoNPObject::getProperty(int index, NPVariant &result)
...
@@ -1358,6 +1361,12 @@ LibvlcVideoNPObject::getProperty(int index, NPVariant &result)
OBJECT_TO_NPVARIANT
(
NPN_RetainObject
(
marqueeObj
),
result
);
OBJECT_TO_NPVARIANT
(
NPN_RetainObject
(
marqueeObj
),
result
);
return
INVOKERESULT_NO_ERROR
;
return
INVOKERESULT_NO_ERROR
;
}
}
case
ID_video_logo
:
{
InstantObj
<
LibvlcLogoNPObject
>
(
logoObj
);
OBJECT_TO_NPVARIANT
(
NPN_RetainObject
(
logoObj
),
result
);
return
INVOKERESULT_NO_ERROR
;
}
}
}
}
}
return
INVOKERESULT_GENERIC_ERROR
;
return
INVOKERESULT_GENERIC_ERROR
;
...
@@ -1810,3 +1819,219 @@ LibvlcMarqueeNPObject::invoke(int index, const NPVariant *args,
...
@@ -1810,3 +1819,219 @@ LibvlcMarqueeNPObject::invoke(int index, const NPVariant *args,
}
}
return
INVOKERESULT_GENERIC_ERROR
;
return
INVOKERESULT_GENERIC_ERROR
;
}
}
const
NPUTF8
*
const
LibvlcLogoNPObject
::
propertyNames
[]
=
{
"delay"
,
"repeat"
,
"opacity"
,
"position"
,
"x"
,
"y"
,
};
enum
LibvlcLogoNPObjectPropertyIds
{
ID_logo_delay
,
ID_logo_repeat
,
ID_logo_opacity
,
ID_logo_position
,
ID_logo_x
,
ID_logo_y
,
};
COUNTNAMES
(
LibvlcLogoNPObject
,
propertyCount
,
propertyNames
);
static
const
unsigned
char
logo_idx
[]
=
{
libvlc_logo_delay
,
libvlc_logo_repeat
,
libvlc_logo_opacity
,
0
,
libvlc_logo_x
,
libvlc_logo_y
,
};
struct
posidx_s
{
const
char
*
n
;
size_t
i
;
};
static
const
posidx_s
posidx
[]
=
{
{
"center"
,
0
},
{
"left"
,
1
},
{
"right"
,
2
},
{
"top"
,
4
},
{
"bottom"
,
8
},
{
"top-left"
,
5
},
{
"top-right"
,
6
},
{
"bottom-left"
,
9
},
{
"bottom-right"
,
10
},
};
enum
{
num_posidx
=
sizeof
(
posidx
)
/
sizeof
(
*
posidx
)
};
static
inline
const
char
*
logo_numtopos
(
size_t
i
)
{
for
(
const
posidx_s
*
h
=
posidx
;
h
<
posidx
+
num_posidx
;
++
h
)
if
(
h
->
i
==
i
)
return
h
->
n
;
return
"undefined"
;
}
static
inline
bool
logo_postonum
(
const
char
*
n
,
size_t
&
i
)
{
for
(
const
posidx_s
*
h
=
posidx
;
h
<
posidx
+
num_posidx
;
++
h
)
if
(
!
strcasecmp
(
n
,
h
->
n
)
)
{
i
=
h
->
i
;
return
true
;
}
return
false
;
}
RuntimeNPObject
::
InvokeResult
LibvlcLogoNPObject
::
getProperty
(
int
index
,
NPVariant
&
result
)
{
if
(
!
isPluginRunning
()
)
return
INVOKERESULT_GENERIC_ERROR
;
VlcPlugin
*
p_plugin
=
getPrivate
<
VlcPlugin
>
();
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_media_player_t
*
p_md
=
p_plugin
->
getMD
(
&
ex
);
RETURN_ON_EXCEPTION
(
this
,
ex
);
switch
(
index
)
{
case
ID_logo_delay
:
case
ID_logo_repeat
:
case
ID_logo_opacity
:
case
ID_logo_x
:
case
ID_logo_y
:
INT32_TO_NPVARIANT
(
libvlc_video_get_logo_int
(
p_md
,
logo_idx
[
index
],
&
ex
),
result
);
RETURN_ON_EXCEPTION
(
this
,
ex
);
break
;
case
ID_logo_position
:
STRINGZ_TO_NPVARIANT
(
logo_numtopos
(
libvlc_video_get_logo_int
(
p_md
,
libvlc_logo_position
,
&
ex
)
),
result
);
RETURN_ON_EXCEPTION
(
this
,
ex
);
break
;
default:
return
INVOKERESULT_GENERIC_ERROR
;
}
return
INVOKERESULT_NO_ERROR
;
}
RuntimeNPObject
::
InvokeResult
LibvlcLogoNPObject
::
setProperty
(
int
index
,
const
NPVariant
&
value
)
{
size_t
i
;
if
(
!
isPluginRunning
()
)
return
INVOKERESULT_GENERIC_ERROR
;
VlcPlugin
*
p_plugin
=
getPrivate
<
VlcPlugin
>
();
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_media_player_t
*
p_md
=
p_plugin
->
getMD
(
&
ex
);
RETURN_ON_EXCEPTION
(
this
,
ex
);
switch
(
index
)
{
case
ID_logo_delay
:
case
ID_logo_repeat
:
case
ID_logo_opacity
:
case
ID_logo_x
:
case
ID_logo_y
:
if
(
!
NPVARIANT_IS_INT32
(
value
)
)
return
INVOKERESULT_INVALID_VALUE
;
libvlc_video_set_logo_int
(
p_md
,
logo_idx
[
index
],
NPVARIANT_TO_INT32
(
value
),
&
ex
);
RETURN_ON_EXCEPTION
(
this
,
ex
);
break
;
case
ID_logo_position
:
if
(
!
NPVARIANT_IS_STRING
(
value
)
||
!
logo_postonum
(
NPVARIANT_TO_STRING
(
value
).
utf8characters
,
i
)
)
return
INVOKERESULT_INVALID_VALUE
;
libvlc_video_set_logo_int
(
p_md
,
libvlc_logo_position
,
i
,
&
ex
);
RETURN_ON_EXCEPTION
(
this
,
ex
);
break
;
default:
return
INVOKERESULT_GENERIC_ERROR
;
}
return
INVOKERESULT_NO_ERROR
;
}
const
NPUTF8
*
const
LibvlcLogoNPObject
::
methodNames
[]
=
{
"enable"
,
"disable"
,
"file"
,
};
enum
LibvlcLogoNPObjectMethodIds
{
ID_logo_enable
,
ID_logo_disable
,
ID_logo_file
,
};
COUNTNAMES
(
LibvlcLogoNPObject
,
methodCount
,
methodNames
);
RuntimeNPObject
::
InvokeResult
LibvlcLogoNPObject
::
invoke
(
int
index
,
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
&
result
)
{
char
*
buf
,
*
h
;
size_t
i
,
len
;
if
(
!
isPluginRunning
()
)
return
INVOKERESULT_GENERIC_ERROR
;
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_media_player_t
*
p_md
=
getPrivate
<
VlcPlugin
>
()
->
getMD
(
&
ex
);
RETURN_ON_EXCEPTION
(
this
,
ex
);
switch
(
index
)
{
case
ID_logo_enable
:
case
ID_logo_disable
:
if
(
argCount
!=
0
)
return
INVOKERESULT_GENERIC_ERROR
;
libvlc_video_set_logo_int
(
p_md
,
libvlc_logo_enable
,
index
!=
ID_logo_disable
,
&
ex
);
RETURN_ON_EXCEPTION
(
this
,
ex
);
VOID_TO_NPVARIANT
(
result
);
break
;
case
ID_logo_file
:
if
(
argCount
==
0
)
return
INVOKERESULT_GENERIC_ERROR
;
for
(
len
=
0
,
i
=
0
;
i
<
argCount
;
++
i
)
{
if
(
!
NPVARIANT_IS_STRING
(
args
[
i
])
)
return
INVOKERESULT_INVALID_VALUE
;
len
+=
NPVARIANT_TO_STRING
(
args
[
i
]).
utf8length
+
1
;
}
buf
=
(
char
*
)
malloc
(
len
+
1
);
if
(
!
buf
)
return
INVOKERESULT_OUT_OF_MEMORY
;
for
(
h
=
buf
,
i
=
0
;
i
<
argCount
;
++
i
)
{
if
(
i
)
*
h
++=
';'
;
len
=
NPVARIANT_TO_STRING
(
args
[
i
]).
utf8length
;
memcpy
(
h
,
NPVARIANT_TO_STRING
(
args
[
i
]).
utf8characters
,
len
);
h
+=
len
;
}
*
h
=
'\0'
;
libvlc_video_set_logo_string
(
p_md
,
libvlc_logo_file
,
buf
,
&
ex
);
free
(
buf
);
RETURN_ON_EXCEPTION
(
this
,
ex
);
VOID_TO_NPVARIANT
(
result
);
break
;
}
return
INVOKERESULT_NO_ERROR
;
}
projects/mozilla/control/npolibvlc.h
View file @
8e6efd05
...
@@ -180,8 +180,8 @@ protected:
...
@@ -180,8 +180,8 @@ protected:
LibvlcVideoNPObject
(
NPP
instance
,
const
NPClass
*
aClass
)
:
LibvlcVideoNPObject
(
NPP
instance
,
const
NPClass
*
aClass
)
:
RuntimeNPObject
(
instance
,
aClass
),
RuntimeNPObject
(
instance
,
aClass
),
marqueeObj
(
NULL
)
{};
marqueeObj
(
NULL
)
,
logoObj
(
NULL
)
{
}
virtual
~
LibvlcVideoNPObject
()
{
};
virtual
~
LibvlcVideoNPObject
()
{
}
static
const
int
propertyCount
;
static
const
int
propertyCount
;
static
const
NPUTF8
*
const
propertyNames
[];
static
const
NPUTF8
*
const
propertyNames
[];
...
@@ -196,6 +196,7 @@ protected:
...
@@ -196,6 +196,7 @@ protected:
private:
private:
NPObject
*
marqueeObj
;
NPObject
*
marqueeObj
;
NPObject
*
logoObj
;
};
};
class
LibvlcMarqueeNPObject
:
public
RuntimeNPObject
class
LibvlcMarqueeNPObject
:
public
RuntimeNPObject
...
@@ -218,3 +219,24 @@ protected:
...
@@ -218,3 +219,24 @@ protected:
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
LibvlcLogoNPObject
:
public
RuntimeNPObject
{
protected:
friend
class
RuntimeNPClass
<
LibvlcLogoNPObject
>
;
LibvlcLogoNPObject
(
NPP
instance
,
const
NPClass
*
aClass
)
:
RuntimeNPObject
(
instance
,
aClass
)
{
}
virtual
~
LibvlcLogoNPObject
()
{
}
static
const
int
propertyCount
;
static
const
NPUTF8
*
const
propertyNames
[];
InvokeResult
getProperty
(
int
index
,
NPVariant
&
result
);
InvokeResult
setProperty
(
int
index
,
const
NPVariant
&
value
);
static
const
int
methodCount
;
static
const
NPUTF8
*
const
methodNames
[];
InvokeResult
invoke
(
int
index
,
const
NPVariant
*
args
,
uint32_t
argCount
,
NPVariant
&
result
);
};
projects/mozilla/test.html
View file @
8e6efd05
...
@@ -235,14 +235,12 @@ Insert Slider widget
...
@@ -235,14 +235,12 @@ Insert Slider widget
<INPUT
size=
4
value=
""
id=
"logoIntValue"
>
<INPUT
size=
4
value=
""
id=
"logoIntValue"
>
<SELECT
readonly
onClick=
"doLogoOption(this.value,document.getElementById('logoIntValue').value);"
>
<SELECT
readonly
onClick=
"doLogoOption(this.value,document.getElementById('logoIntValue').value);"
>
<OPTION
value=
1
>
File
</OPTION>
<OPTION
value=
1
>
File
</OPTION>
<OPTION
value=
2
>
Transparency
</OPTION>
<OPTION
value=
2
>
Position
</OPTION>
<OPTION
value=
3
>
Position
</OPTION>
<OPTION
value=
3
>
Opacity
</OPTION>
<OPTION
value=
4
>
Repeat
</OPTION>
<OPTION
value=
4
>
Repeat
</OPTION>
<OPTION
value=
5
>
Delay
</OPTION>
<OPTION
value=
5
>
Delay
</OPTION>
<OPTION
value=
6
>
X
</OPTION>
<OPTION
value=
6
>
X
</OPTION>
<OPTION
value=
7
>
Y
</OPTION>
<OPTION
value=
7
>
Y
</OPTION>
<OPTION
value=
8
>
Width
</OPTION>
<OPTION
value=
9
>
Height
</OPTION>
</SELECT>
</SELECT>
</TD>
</TD>
</TR>
</TR>
...
@@ -786,27 +784,23 @@ function doMarqueeOption(option, value)
...
@@ -786,27 +784,23 @@ function doMarqueeOption(option, value)
function doLogoOption(option, value)
function doLogoOption(option, value)
{
{
var vlc = getVLC("vlc");
var vlc = getVLC("vlc");
val = parseInt(value);
if( vlc )
if( vlc )
{
{
if (option == 1)
if (option == 1)
vlc.video.logo.file(val);
vlc.video.logo.file(val
ue
);
if (option == 2)
if (option == 2)
vlc.video.logo.transparency(val);
vlc.video.logo.position = value;
val = parseInt(value);
if (option == 3)
if (option == 3)
vlc.video.logo.
position(val)
;
vlc.video.logo.
opacity = val
;
if (option == 4)
if (option == 4)
vlc.video.logo.repeat
(val)
;
vlc.video.logo.repeat
= val
;
if (option == 5)
if (option == 5)
vlc.video.logo.delay
(val)
;
vlc.video.logo.delay
= val
;
if (option == 6)
if (option == 6)
vlc.video.logo.x
(val)
;
vlc.video.logo.x
= val
;
if (option == 7)
if (option == 7)
vlc.video.logo.y(val);
vlc.video.logo.y = val;
if (option == 8)
vlc.video.logo.width(val);
if (option == 9)
vlc.video.logo.height(val);
}
}
}
}
...
...
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