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
b99ae3e2
Commit
b99ae3e2
authored
May 31, 2005
by
Damien Fouilleul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
all: activex plugin Set/GetVariable support all of VLC types
parent
30efcc2b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
99 additions
and
12 deletions
+99
-12
activex/vlccontrol.cpp
activex/vlccontrol.cpp
+67
-11
src/libvlc.c
src/libvlc.c
+32
-1
No files found.
activex/vlccontrol.cpp
View file @
b99ae3e2
...
...
@@ -355,15 +355,13 @@ STDMETHODIMP VLCControl::setVariable( BSTR name, VARIANT value)
HRESULT
hr
=
E_INVALIDARG
;
int
i_type
;
vlc_value_t
val
;
if
(
VLC_SUCCESS
==
VLC_VariableType
(
i_vlc
,
psz_varname
,
&
i_type
)
)
{
VARIANT
arg
;
VariantInit
(
&
arg
);
vlc_value_t
val
;
hr
=
DISP_E_TYPEMISMATCH
;
switch
(
i_type
)
{
case
VLC_VAR_BOOL
:
...
...
@@ -373,6 +371,7 @@ STDMETHODIMP VLCControl::setVariable( BSTR name, VARIANT value)
break
;
case
VLC_VAR_INTEGER
:
case
VLC_VAR_HOTKEY
:
hr
=
VariantChangeType
(
&
value
,
&
arg
,
0
,
VT_I4
);
if
(
SUCCEEDED
(
hr
)
)
val
.
i_int
=
V_I4
(
&
arg
);
...
...
@@ -385,21 +384,66 @@ STDMETHODIMP VLCControl::setVariable( BSTR name, VARIANT value)
break
;
case
VLC_VAR_STRING
:
case
VLC_VAR_MODULE
:
case
VLC_VAR_FILE
:
case
VLC_VAR_DIRECTORY
:
case
VLC_VAR_VARIABLE
:
hr
=
VariantChangeType
(
&
value
,
&
arg
,
0
,
VT_BSTR
);
if
(
SUCCEEDED
(
hr
)
)
{
val
.
psz_string
=
CStrFromBSTR
(
codePage
,
V_BSTR
(
&
arg
));
VariantClear
(
&
arg
);
}
break
;
}
if
(
SUCCEEDED
(
hr
)
)
{
VariantClear
(
&
arg
);
hr
=
(
VLC_SUCCESS
==
VLC_VariableSet
(
i_vlc
,
psz_varname
,
val
))
?
NOERROR
:
E_FAIL
;
case
VLC_VAR_TIME
:
// use a double value to represent time (base is expressed in seconds)
hr
=
VariantChangeType
(
&
value
,
&
arg
,
0
,
VT_R8
);
if
(
SUCCEEDED
(
hr
)
)
val
.
i_time
=
(
signed
__int64
)(
V_R8
(
&
arg
)
*
1000000.0
);
break
;
if
(
(
VLC_VAR_STRING
==
i_type
)
&&
(
NULL
!=
val
.
psz_string
)
)
free
(
val
.
psz_string
)
;
default:
hr
=
DISP_E_TYPEMISMATCH
;
}
}
else
{
// no defined type, defaults to VARIANT type
hr
=
NO_ERROR
;
switch
(
V_VT
(
&
value
)
)
{
case
VT_BOOL
:
val
.
b_bool
=
(
VARIANT_TRUE
==
V_BOOL
(
&
value
))
?
VLC_TRUE
:
VLC_FALSE
;
i_type
=
VLC_VAR_BOOL
;
break
;
case
VT_I4
:
val
.
i_int
=
V_I4
(
&
value
);
i_type
=
VLC_VAR_INTEGER
;
break
;
case
VT_R4
:
val
.
f_float
=
V_R4
(
&
value
);
i_type
=
VLC_VAR_FLOAT
;
break
;
case
VT_BSTR
:
val
.
psz_string
=
CStrFromBSTR
(
codePage
,
V_BSTR
(
&
value
));
i_type
=
VLC_VAR_STRING
;
break
;
case
VT_R8
:
// use a double value to represent time (base is expressed in seconds)
val
.
i_time
=
(
signed
__int64
)(
V_R8
(
&
value
)
*
1000000.0
);
i_type
=
VLC_VAR_TIME
;
break
;
default:
hr
=
DISP_E_TYPEMISMATCH
;
}
}
if
(
SUCCEEDED
(
hr
)
)
{
hr
=
(
VLC_SUCCESS
==
VLC_VariableSet
(
i_vlc
,
psz_varname
,
val
))
?
NOERROR
:
E_FAIL
;
if
(
(
VLC_VAR_STRING
==
i_type
)
&&
(
NULL
!=
val
.
psz_string
)
)
free
(
val
.
psz_string
);
}
free
(
psz_varname
);
return
hr
;
...
...
@@ -440,6 +484,7 @@ STDMETHODIMP VLCControl::getVariable( BSTR name, VARIANT *value)
break
;
case
VLC_VAR_INTEGER
:
case
VLC_VAR_HOTKEY
:
V_VT
(
value
)
=
VT_I4
;
V_I4
(
value
)
=
val
.
i_int
;
break
;
...
...
@@ -450,10 +495,21 @@ STDMETHODIMP VLCControl::getVariable( BSTR name, VARIANT *value)
break
;
case
VLC_VAR_STRING
:
case
VLC_VAR_MODULE
:
case
VLC_VAR_FILE
:
case
VLC_VAR_DIRECTORY
:
case
VLC_VAR_VARIABLE
:
V_VT
(
value
)
=
VT_BSTR
;
V_BSTR
(
value
)
=
BSTRFromCStr
(
codePage
,
val
.
psz_string
);
free
(
val
.
psz_string
);
break
;
case
VLC_VAR_TIME
:
// use a double value to represent time (base is expressed in seconds)
V_VT
(
value
)
=
VT_R8
;
V_R8
(
value
)
=
((
double
)
val
.
i_time
)
/
1000000.0
;
break
;
default:
hr
=
DISP_E_TYPEMISMATCH
;
}
...
...
src/libvlc.c
View file @
b99ae3e2
...
...
@@ -1043,7 +1043,38 @@ int VLC_VariableType( int i_object, char const *psz_var, int *pi_type )
return
VLC_ENOOBJ
;
}
i_type
=
VLC_VAR_TYPE
&
var_Type
(
p_vlc
,
psz_var
);
/* FIXME: Temporary hack for Mozilla, if variable starts with conf:: then
* we handle it as a configuration variable. Don't tell Gildas :) -- sam */
if
(
!
strncmp
(
psz_var
,
"conf::"
,
6
)
)
{
module_config_t
*
p_item
;
char
const
*
psz_newvar
=
psz_var
+
6
;
p_item
=
config_FindConfig
(
VLC_OBJECT
(
p_vlc
),
psz_newvar
);
if
(
p_item
)
{
switch
(
p_item
->
i_type
)
{
case
CONFIG_ITEM_BOOL
:
i_type
=
VLC_VAR_BOOL
;
break
;
case
CONFIG_ITEM_INTEGER
:
i_type
=
VLC_VAR_INTEGER
;
break
;
case
CONFIG_ITEM_FLOAT
:
i_type
=
VLC_VAR_FLOAT
;
break
;
default:
i_type
=
VLC_VAR_STRING
;
break
;
}
}
else
i_type
=
0
;
}
else
i_type
=
VLC_VAR_TYPE
&
var_Type
(
p_vlc
,
psz_var
);
if
(
i_object
)
vlc_object_release
(
p_vlc
);
...
...
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