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
df9f30c2
Commit
df9f30c2
authored
May 25, 2009
by
JP Dinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
And do the same exception packing for the old activex interface.
parent
6610397f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
158 deletions
+54
-158
projects/activex/vlccontrol.cpp
projects/activex/vlccontrol.cpp
+35
-151
projects/activex/vlccontrol.h
projects/activex/vlccontrol.h
+19
-7
No files found.
projects/activex/vlccontrol.cpp
View file @
df9f30c2
...
@@ -16,9 +16,9 @@
...
@@ -16,9 +16,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 "plugin.h"
#include "plugin.h"
...
@@ -128,15 +128,10 @@ STDMETHODIMP VLCControl::play(void)
...
@@ -128,15 +128,10 @@ STDMETHODIMP VLCControl::play(void)
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
_p_instance
->
playlist_play
(
&
ex
);
_p_instance
->
playlist_play
(
&
ex
);
if
(
libvlc_exception_raised
(
&
ex
)
)
HRESULT
result
=
exception_bridge
(
&
ex
);
{
if
(
SUCCEEDED
(
result
)
)
_p_instance
->
setErrorInfo
(
IID_IVLCControl
,
libvlc_exception_get_message
(
&
ex
));
libvlc_exception_clear
(
&
ex
);
return
E_FAIL
;
}
_p_instance
->
fireOnPlayEvent
();
_p_instance
->
fireOnPlayEvent
();
return
NOERROR
;
return
result
;
};
};
STDMETHODIMP
VLCControl
::
pause
(
void
)
STDMETHODIMP
VLCControl
::
pause
(
void
)
...
@@ -149,15 +144,9 @@ STDMETHODIMP VLCControl::pause(void)
...
@@ -149,15 +144,9 @@ STDMETHODIMP VLCControl::pause(void)
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
libvlc_media_player_pause
(
p_md
,
&
ex
);
libvlc_media_player_pause
(
p_md
,
&
ex
);
if
(
libvlc_exception_raised
(
&
ex
)
)
result
=
exception_bridge
(
&
ex
);
{
if
(
SUCCEEDED
(
result
)
)
_p_instance
->
setErrorInfo
(
IID_IVLCControl
,
libvlc_exception_get_message
(
&
ex
));
libvlc_exception_clear
(
&
ex
);
return
E_FAIL
;
}
_p_instance
->
fireOnPauseEvent
();
_p_instance
->
fireOnPauseEvent
();
return
NOERROR
;
}
}
return
result
;
return
result
;
};
};
...
@@ -172,16 +161,10 @@ STDMETHODIMP VLCControl::stop(void)
...
@@ -172,16 +161,10 @@ STDMETHODIMP VLCControl::stop(void)
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
libvlc_media_player_stop
(
p_md
,
&
ex
);
libvlc_media_player_stop
(
p_md
,
&
ex
);
if
(
libvlc_exception_raised
(
&
ex
)
)
result
=
exception_bridge
(
&
ex
);
{
if
(
SUCCEEDED
(
result
)
)
_p_instance
->
setErrorInfo
(
IID_IVLCControl
,
libvlc_exception_get_message
(
&
ex
));
libvlc_exception_clear
(
&
ex
);
return
E_FAIL
;
}
return
NOERROR
;
}
_p_instance
->
fireOnStopEvent
();
_p_instance
->
fireOnStopEvent
();
}
return
result
;
return
result
;
};
};
...
@@ -196,9 +179,7 @@ STDMETHODIMP VLCControl::get_Playing(VARIANT_BOOL *isPlaying)
...
@@ -196,9 +179,7 @@ STDMETHODIMP VLCControl::get_Playing(VARIANT_BOOL *isPlaying)
{
{
*
isPlaying
=
libvlc_media_player_is_playing
(
p_md
,
NULL
)
?
*
isPlaying
=
libvlc_media_player_is_playing
(
p_md
,
NULL
)
?
VARIANT_TRUE
:
VARIANT_FALSE
;
VARIANT_TRUE
:
VARIANT_FALSE
;
return
NOERROR
;
}
else
*
isPlaying
=
VARIANT_FALSE
;
}
*
isPlaying
=
VARIANT_FALSE
;
return
result
;
return
result
;
};
};
...
@@ -216,14 +197,7 @@ STDMETHODIMP VLCControl::get_Position(float *position)
...
@@ -216,14 +197,7 @@ STDMETHODIMP VLCControl::get_Position(float *position)
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
*
position
=
libvlc_media_player_get_position
(
p_md
,
&
ex
);
*
position
=
libvlc_media_player_get_position
(
p_md
,
&
ex
);
if
(
!
libvlc_exception_raised
(
&
ex
)
)
result
=
exception_bridge
(
&
ex
);
{
return
NOERROR
;
}
_p_instance
->
setErrorInfo
(
IID_IVLCControl
,
libvlc_exception_get_message
(
&
ex
));
libvlc_exception_clear
(
&
ex
);
return
E_FAIL
;
}
}
return
result
;
return
result
;
};
};
...
@@ -238,14 +212,7 @@ STDMETHODIMP VLCControl::put_Position(float position)
...
@@ -238,14 +212,7 @@ STDMETHODIMP VLCControl::put_Position(float position)
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
libvlc_media_player_set_position
(
p_md
,
position
,
&
ex
);
libvlc_media_player_set_position
(
p_md
,
position
,
&
ex
);
if
(
!
libvlc_exception_raised
(
&
ex
)
)
result
=
exception_bridge
(
&
ex
);
{
return
NOERROR
;
}
_p_instance
->
setErrorInfo
(
IID_IVLCControl
,
libvlc_exception_get_message
(
&
ex
));
libvlc_exception_clear
(
&
ex
);
return
E_FAIL
;
}
}
return
result
;
return
result
;
};
};
...
@@ -264,14 +231,7 @@ STDMETHODIMP VLCControl::get_Time(int *seconds)
...
@@ -264,14 +231,7 @@ STDMETHODIMP VLCControl::get_Time(int *seconds)
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
*
seconds
=
libvlc_media_player_get_time
(
p_md
,
&
ex
);
*
seconds
=
libvlc_media_player_get_time
(
p_md
,
&
ex
);
if
(
!
libvlc_exception_raised
(
&
ex
)
)
result
=
exception_bridge
(
&
ex
);
{
return
NOERROR
;
}
_p_instance
->
setErrorInfo
(
IID_IVLCControl
,
libvlc_exception_get_message
(
&
ex
));
libvlc_exception_clear
(
&
ex
);
return
E_FAIL
;
}
}
return
result
;
return
result
;
};
};
...
@@ -294,14 +254,7 @@ STDMETHODIMP VLCControl::shuttle(int seconds)
...
@@ -294,14 +254,7 @@ STDMETHODIMP VLCControl::shuttle(int seconds)
if
(
seconds
<
0
)
seconds
=
0
;
if
(
seconds
<
0
)
seconds
=
0
;
libvlc_media_player_set_time
(
p_md
,
(
int64_t
)
seconds
,
&
ex
);
libvlc_media_player_set_time
(
p_md
,
(
int64_t
)
seconds
,
&
ex
);
if
(
!
libvlc_exception_raised
(
&
ex
)
)
result
=
exception_bridge
(
&
ex
);
{
return
NOERROR
;
}
_p_instance
->
setErrorInfo
(
IID_IVLCControl
,
libvlc_exception_get_message
(
&
ex
));
libvlc_exception_clear
(
&
ex
);
return
E_FAIL
;
}
}
return
result
;
return
result
;
...
@@ -335,14 +288,7 @@ STDMETHODIMP VLCControl::get_Length(int *seconds)
...
@@ -335,14 +288,7 @@ STDMETHODIMP VLCControl::get_Length(int *seconds)
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
*
seconds
=
(
double
)
libvlc_media_player_get_length
(
p_md
,
&
ex
);
*
seconds
=
(
double
)
libvlc_media_player_get_length
(
p_md
,
&
ex
);
if
(
!
libvlc_exception_raised
(
&
ex
)
)
result
=
exception_bridge
(
&
ex
);
{
return
NOERROR
;
}
_p_instance
->
setErrorInfo
(
IID_IVLCControl
,
libvlc_exception_get_message
(
&
ex
));
libvlc_exception_clear
(
&
ex
);
return
E_FAIL
;
}
}
return
result
;
return
result
;
...
@@ -360,18 +306,8 @@ STDMETHODIMP VLCControl::playFaster(void)
...
@@ -360,18 +306,8 @@ STDMETHODIMP VLCControl::playFaster(void)
libvlc_exception_t
ex
;
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
if
(
!
libvlc_exception_raised
(
&
ex
)
)
{
libvlc_media_player_set_rate
(
p_md
,
rate
,
&
ex
);
libvlc_media_player_set_rate
(
p_md
,
rate
,
&
ex
);
if
(
!
libvlc_exception_raised
(
&
ex
)
)
result
=
exception_bridge
(
&
ex
);
{
return
NOERROR
;
}
}
_p_instance
->
setErrorInfo
(
IID_IVLCControl
,
libvlc_exception_get_message
(
&
ex
));
libvlc_exception_clear
(
&
ex
);
return
E_FAIL
;
}
}
return
result
;
return
result
;
};
};
...
@@ -388,14 +324,7 @@ STDMETHODIMP VLCControl::playSlower(void)
...
@@ -388,14 +324,7 @@ STDMETHODIMP VLCControl::playSlower(void)
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
libvlc_media_player_set_rate
(
p_md
,
rate
,
&
ex
);
libvlc_media_player_set_rate
(
p_md
,
rate
,
&
ex
);
if
(
!
libvlc_exception_raised
(
&
ex
)
)
result
=
exception_bridge
(
&
ex
);
{
return
NOERROR
;
}
_p_instance
->
setErrorInfo
(
IID_IVLCControl
,
libvlc_exception_get_message
(
&
ex
));
libvlc_exception_clear
(
&
ex
);
return
E_FAIL
;
}
}
return
result
;
return
result
;
};
};
...
@@ -425,14 +354,7 @@ STDMETHODIMP VLCControl::toggleMute(void)
...
@@ -425,14 +354,7 @@ STDMETHODIMP VLCControl::toggleMute(void)
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
libvlc_audio_toggle_mute
(
p_libvlc
,
&
ex
);
libvlc_audio_toggle_mute
(
p_libvlc
,
&
ex
);
if
(
libvlc_exception_raised
(
&
ex
)
)
result
=
exception_bridge
(
&
ex
);
{
_p_instance
->
setErrorInfo
(
IID_IVLCControl
,
libvlc_exception_get_message
(
&
ex
));
libvlc_exception_clear
(
&
ex
);
return
E_FAIL
;
}
return
NOERROR
;
}
}
return
result
;
return
result
;
};
};
...
@@ -810,20 +732,17 @@ STDMETHODIMP VLCControl::addTarget(BSTR uri, VARIANT options, enum VLCPlaylistMo
...
@@ -810,20 +732,17 @@ STDMETHODIMP VLCControl::addTarget(BSTR uri, VARIANT options, enum VLCPlaylistMo
FreeTargetOptions
(
cOptions
,
cOptionsCount
);
FreeTargetOptions
(
cOptions
,
cOptionsCount
);
CoTaskMemFree
(
cUri
);
CoTaskMemFree
(
cUri
);
if
(
libvlc_exception_raised
(
&
ex
)
)
hr
=
exception_bridge
(
&
ex
);
if
(
SUCCEEDED
(
hr
)
)
{
{
_p_instance
->
setErrorInfo
(
IID_IVLCPlaylist
,
libvlc_exception_get_message
(
&
ex
));
libvlc_exception_clear
(
&
ex
);
if
(
mode
&
VLCPlayListAppendAndGo
)
if
(
mode
&
VLCPlayListAppendAndGo
)
_p_instance
->
fireOnStopEvent
();
_p_instance
->
fireOnPlayEvent
();
return
E_FAIL
;
}
}
else
{
if
(
mode
&
VLCPlayListAppendAndGo
)
if
(
mode
&
VLCPlayListAppendAndGo
)
_p_instance
->
fireOnPlay
Event
();
_p_instance
->
fireOnStop
Event
();
return
NOERROR
;
}
}
}
return
hr
;
return
hr
;
};
};
...
@@ -842,14 +761,7 @@ STDMETHODIMP VLCControl::get_PlaylistIndex(int *index)
...
@@ -842,14 +761,7 @@ STDMETHODIMP VLCControl::get_PlaylistIndex(int *index)
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
*
index
=
_p_instance
->
playlist_get_current_index
(
&
ex
);
*
index
=
_p_instance
->
playlist_get_current_index
(
&
ex
);
if
(
libvlc_exception_raised
(
&
ex
)
)
result
=
exception_bridge
(
&
ex
);
{
_p_instance
->
setErrorInfo
(
IID_IVLCControl
,
libvlc_exception_get_message
(
&
ex
));
libvlc_exception_clear
(
&
ex
);
return
E_FAIL
;
}
return
NOERROR
;
}
}
return
result
;
return
result
;
};
};
...
@@ -863,14 +775,7 @@ STDMETHODIMP VLCControl::get_PlaylistCount(int *count)
...
@@ -863,14 +775,7 @@ STDMETHODIMP VLCControl::get_PlaylistCount(int *count)
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
*
count
=
_p_instance
->
playlist_count
(
&
ex
);
*
count
=
_p_instance
->
playlist_count
(
&
ex
);
if
(
libvlc_exception_raised
(
&
ex
)
)
return
exception_bridge
(
&
ex
);
{
_p_instance
->
setErrorInfo
(
IID_IVLCControl
,
libvlc_exception_get_message
(
&
ex
));
libvlc_exception_clear
(
&
ex
);
return
E_FAIL
;
}
return
NOERROR
;
};
};
STDMETHODIMP
VLCControl
::
playlistNext
(
void
)
STDMETHODIMP
VLCControl
::
playlistNext
(
void
)
...
@@ -883,14 +788,7 @@ STDMETHODIMP VLCControl::playlistNext(void)
...
@@ -883,14 +788,7 @@ STDMETHODIMP VLCControl::playlistNext(void)
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
_p_instance
->
playlist_next
(
&
ex
);
_p_instance
->
playlist_next
(
&
ex
);
if
(
libvlc_exception_raised
(
&
ex
)
)
result
=
exception_bridge
(
&
ex
);
{
_p_instance
->
setErrorInfo
(
IID_IVLCControl
,
libvlc_exception_get_message
(
&
ex
));
libvlc_exception_clear
(
&
ex
);
return
E_FAIL
;
}
return
NOERROR
;
}
}
return
result
;
return
result
;
};
};
...
@@ -905,14 +803,7 @@ STDMETHODIMP VLCControl::playlistPrev(void)
...
@@ -905,14 +803,7 @@ STDMETHODIMP VLCControl::playlistPrev(void)
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
_p_instance
->
playlist_prev
(
&
ex
);
_p_instance
->
playlist_prev
(
&
ex
);
if
(
libvlc_exception_raised
(
&
ex
)
)
result
=
exception_bridge
(
&
ex
);
{
_p_instance
->
setErrorInfo
(
IID_IVLCControl
,
libvlc_exception_get_message
(
&
ex
));
libvlc_exception_clear
(
&
ex
);
return
E_FAIL
;
}
return
NOERROR
;
}
}
return
result
;
return
result
;
};
};
...
@@ -927,14 +818,7 @@ STDMETHODIMP VLCControl::playlistClear(void)
...
@@ -927,14 +818,7 @@ STDMETHODIMP VLCControl::playlistClear(void)
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
_p_instance
->
playlist_clear
(
&
ex
);
_p_instance
->
playlist_clear
(
&
ex
);
if
(
libvlc_exception_raised
(
&
ex
)
)
result
=
exception_bridge
(
&
ex
);
{
_p_instance
->
setErrorInfo
(
IID_IVLCControl
,
libvlc_exception_get_message
(
&
ex
));
libvlc_exception_clear
(
&
ex
);
return
E_FAIL
;
}
return
NOERROR
;
}
}
return
result
;
return
result
;
};
};
...
...
projects/activex/vlccontrol.h
View file @
df9f30c2
...
@@ -15,9 +15,9 @@
...
@@ -15,9 +15,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.
*****************************************************************************/
*****************************************************************************/
#ifndef _VLCCONTROL_H_
#ifndef _VLCCONTROL_H_
...
@@ -29,7 +29,8 @@ class VLCControl : public IVLCControl
...
@@ -29,7 +29,8 @@ class VLCControl : public IVLCControl
{
{
public:
public:
VLCControl
(
VLCPlugin
*
p_instance
)
:
_p_instance
(
p_instance
),
_p_typeinfo
(
NULL
)
{};
VLCControl
(
VLCPlugin
*
p_instance
)
:
_p_instance
(
p_instance
),
_p_typeinfo
(
NULL
)
{
}
virtual
~
VLCControl
();
virtual
~
VLCControl
();
// IUnknown methods
// IUnknown methods
...
@@ -46,10 +47,12 @@ public:
...
@@ -46,10 +47,12 @@ public:
return
NOERROR
;
return
NOERROR
;
}
}
return
_p_instance
->
pUnkOuter
->
QueryInterface
(
riid
,
ppv
);
return
_p_instance
->
pUnkOuter
->
QueryInterface
(
riid
,
ppv
);
}
;
}
STDMETHODIMP_
(
ULONG
)
AddRef
(
void
)
{
return
_p_instance
->
pUnkOuter
->
AddRef
();
};
STDMETHODIMP_
(
ULONG
)
AddRef
(
void
)
STDMETHODIMP_
(
ULONG
)
Release
(
void
)
{
return
_p_instance
->
pUnkOuter
->
Release
();
};
{
return
_p_instance
->
pUnkOuter
->
AddRef
();
}
STDMETHODIMP_
(
ULONG
)
Release
(
void
)
{
return
_p_instance
->
pUnkOuter
->
Release
();
}
// IDispatch methods
// IDispatch methods
STDMETHODIMP
GetTypeInfoCount
(
UINT
*
);
STDMETHODIMP
GetTypeInfoCount
(
UINT
*
);
...
@@ -98,6 +101,15 @@ public:
...
@@ -98,6 +101,15 @@ public:
private:
private:
HRESULT
getTypeInfo
();
HRESULT
getTypeInfo
();
HRESULT
exception_bridge
(
libvlc_exception_t
*
ex
)
{
if
(
!
libvlc_exception_raised
(
ex
)
)
return
NOERROR
;
_p_instance
->
setErrorInfo
(
IID_IVLCControl
,
libvlc_exception_get_message
(
ex
));
libvlc_exception_clear
(
ex
);
return
E_FAIL
;
}
VLCPlugin
*
_p_instance
;
VLCPlugin
*
_p_instance
;
ITypeInfo
*
_p_typeinfo
;
ITypeInfo
*
_p_typeinfo
;
...
...
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