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
264b8243
Commit
264b8243
authored
Mar 22, 2007
by
Damien Fouilleul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- activex: support for options passed as a commmand line string
parent
3065549c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
115 additions
and
1 deletion
+115
-1
activex/vlccontrol.cpp
activex/vlccontrol.cpp
+115
-1
No files found.
activex/vlccontrol.cpp
View file @
264b8243
...
...
@@ -546,6 +546,92 @@ void VLCControl::FreeTargetOptions(char **cOptions, int cOptionCount)
}
};
static
HRESULT
parseStringOptions
(
int
codePage
,
BSTR
bstr
,
char
***
cOptions
,
int
*
cOptionCount
)
{
HRESULT
hr
=
E_INVALIDARG
;
if
(
SysStringLen
(
bstr
)
>
0
)
{
hr
=
E_OUTOFMEMORY
;
char
*
s
=
CStrFromBSTR
(
codePage
,
bstr
);
char
*
val
=
s
;
if
(
val
)
{
long
capacity
=
16
;
char
**
options
=
(
char
**
)
CoTaskMemAlloc
(
capacity
*
sizeof
(
char
*
));
if
(
options
)
{
int
nOptions
=
0
;
char
*
end
=
val
+
strlen
(
val
);
while
(
val
<
end
)
{
// skip leading blanks
while
(
(
val
<
end
)
&&
((
*
val
==
' '
)
||
(
*
val
==
'\t'
))
)
++
val
;
char
*
start
=
val
;
// skip till we get a blank character
while
(
(
val
<
end
)
&&
(
*
val
!=
' '
)
&&
(
*
val
!=
'\t'
)
)
{
char
c
=
*
(
val
++
);
if
(
(
'\''
==
c
)
||
(
'"'
==
c
)
)
{
// skip till end of string
while
(
(
val
<
end
)
&&
(
*
(
val
++
)
!=
c
)
);
}
}
if
(
val
>
start
)
{
if
(
nOptions
==
capacity
)
{
capacity
+=
16
;
char
**
moreOptions
=
(
char
**
)
CoTaskMemRealloc
(
options
,
capacity
*
sizeof
(
char
*
));
if
(
!
moreOptions
)
{
/* failed to allocate more memory */
CoTaskMemFree
(
s
);
/* return what we got so far */
*
cOptionCount
=
nOptions
;
*
cOptions
=
options
;
return
NOERROR
;
}
options
=
moreOptions
;
}
*
(
val
++
)
=
'\0'
;
options
[
nOptions
]
=
(
char
*
)
CoTaskMemAlloc
(
val
-
start
);
if
(
options
[
nOptions
]
)
{
memcpy
(
options
[
nOptions
],
start
,
val
-
start
);
++
nOptions
;
}
else
{
/* failed to allocate memory */
CoTaskMemFree
(
s
);
/* return what we got so far */
*
cOptionCount
=
nOptions
;
*
cOptions
=
options
;
return
NOERROR
;
}
}
else
// must be end of string
break
;
}
*
cOptionCount
=
nOptions
;
*
cOptions
=
options
;
hr
=
NOERROR
;
}
CoTaskMemFree
(
s
);
}
}
return
hr
;
}
HRESULT
VLCControl
::
CreateTargetOptions
(
int
codePage
,
VARIANT
*
options
,
char
***
cOptions
,
int
*
cOptionCount
)
{
HRESULT
hr
=
E_INVALIDARG
;
...
...
@@ -568,7 +654,7 @@ HRESULT VLCControl::CreateTargetOptions(int codePage, VARIANT *options, char ***
}
else
if
(
VT_DISPATCH
==
V_VT
(
options
)
)
{
//
collection paramete
r
//
if object is a collection, retrieve enumerato
r
VARIANT
colEnum
;
V_VT
(
&
colEnum
)
=
VT_UNKNOWN
;
hr
=
GetObjectProperty
(
V_DISPATCH
(
options
),
DISPID_NEWENUM
,
colEnum
);
...
...
@@ -630,6 +716,18 @@ HRESULT VLCControl::CreateTargetOptions(int codePage, VARIANT *options, char ***
enumVar
->
Release
();
}
}
else
{
// coerce object into a string and parse it
VARIANT
v_name
;
VariantInit
(
&
v_name
);
hr
=
VariantChangeType
(
&
v_name
,
options
,
0
,
VT_BSTR
);
if
(
SUCCEEDED
(
hr
)
)
{
hr
=
parseStringOptions
(
codePage
,
V_BSTR
(
&
v_name
),
cOptions
,
cOptionCount
);
VariantClear
(
&
v_name
);
}
}
}
else
if
(
V_ISARRAY
(
options
)
)
{
...
...
@@ -726,6 +824,22 @@ HRESULT VLCControl::CreateTargetOptions(int codePage, VARIANT *options, char ***
return
NOERROR
;
}
}
else
if
(
VT_UNKNOWN
==
V_VT
(
options
)
)
{
// coerce object into a string and parse it
VARIANT
v_name
;
VariantInit
(
&
v_name
);
hr
=
VariantChangeType
(
&
v_name
,
options
,
0
,
VT_BSTR
);
if
(
SUCCEEDED
(
hr
)
)
{
hr
=
parseStringOptions
(
codePage
,
V_BSTR
(
&
v_name
),
cOptions
,
cOptionCount
);
VariantClear
(
&
v_name
);
}
}
else
if
(
VT_BSTR
==
V_VT
(
options
)
)
{
hr
=
parseStringOptions
(
codePage
,
V_BSTR
(
options
),
cOptions
,
cOptionCount
);
}
return
hr
;
};
...
...
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