Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
a2ccb9b4
Commit
a2ccb9b4
authored
Jun 10, 2008
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use the same internal libvlc API as vlccontrol2.cpp does.
parent
6a0f2d46
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
209 additions
and
57 deletions
+209
-57
projects/activex/vlccontrol.cpp
projects/activex/vlccontrol.cpp
+209
-57
No files found.
projects/activex/vlccontrol.cpp
View file @
a2ccb9b4
...
@@ -123,37 +123,70 @@ STDMETHODIMP VLCControl::put_Visible(VARIANT_BOOL isVisible)
...
@@ -123,37 +123,70 @@ STDMETHODIMP VLCControl::put_Visible(VARIANT_BOOL isVisible)
STDMETHODIMP
VLCControl
::
play
(
void
)
STDMETHODIMP
VLCControl
::
play
(
void
)
{
{
libvlc_instance_t
*
p_libvlc
;
libvlc_instance_t
*
p_libvlc
;
HRESULT
result
=
_p_instance
->
getVLC
(
&
p_libvlc
);
HRESULT
result
=
_p_instance
->
getVLC
(
&
p_libvlc
);
if
(
SUCCEEDED
(
result
)
)
if
(
SUCCEEDED
(
result
)
)
{
{
VLC_Play
(
i_vlc
);
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_playlist_play
(
p_libvlc
,
-
1
,
0
,
NULL
,
&
ex
);
if
(
libvlc_exception_raised
(
&
ex
)
)
{
_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
;
return
result
;
};
};
STDMETHODIMP
VLCControl
::
pause
(
void
)
STDMETHODIMP
VLCControl
::
pause
(
void
)
{
{
libvlc_instance_t
*
p_libvlc
;
libvlc_instance_t
*
p_libvlc
;
HRESULT
result
=
_p_instance
->
getVLC
(
&
p_libvlc
);
HRESULT
result
=
_p_instance
->
getVLC
(
&
p_libvlc
);
if
(
SUCCEEDED
(
result
)
)
if
(
SUCCEEDED
(
result
)
)
{
{
VLC_Pause
(
i_vlc
);
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_playlist_pause
(
p_libvlc
,
&
ex
);
if
(
libvlc_exception_raised
(
&
ex
)
)
{
_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
;
};
};
STDMETHODIMP
VLCControl
::
stop
(
void
)
STDMETHODIMP
VLCControl
::
stop
(
void
)
{
{
libvlc_instance_t
*
p_libvlc
;
libvlc_instance_t
*
p_libvlc
;
HRESULT
result
=
_p_instance
->
getVLC
(
&
p_libvlc
);
HRESULT
result
=
_p_instance
->
getVLC
(
&
p_libvlc
);
if
(
SUCCEEDED
(
result
)
)
if
(
SUCCEEDED
(
result
)
)
{
{
VLC_Stop
(
i_vlc
);
libvlc_exception_t
ex
;
_p_instance
->
fireOnStopEvent
();
libvlc_exception_init
(
&
ex
);
libvlc_playlist_stop
(
p_libvlc
,
&
ex
);
if
(
libvlc_exception_raised
(
&
ex
)
)
{
_p_instance
->
setErrorInfo
(
IID_IVLCControl
,
libvlc_exception_get_message
(
&
ex
));
libvlc_exception_clear
(
&
ex
);
return
E_FAIL
;
}
return
NOERROR
;
}
}
_p_instance
->
fireOnStopEvent
();
return
result
;
return
result
;
};
};
...
@@ -184,33 +217,60 @@ STDMETHODIMP VLCControl::get_Position(float *position)
...
@@ -184,33 +217,60 @@ STDMETHODIMP VLCControl::get_Position(float *position)
{
{
if
(
NULL
==
position
)
if
(
NULL
==
position
)
return
E_POINTER
;
return
E_POINTER
;
*
position
=
0.0
f
;
libvlc_instance_t
*
p_libvlc
;
HRESULT
result
=
E_UNEXPECTED
;
HRESULT
result
=
E_UNEXPECTED
;
if
(
_p_instance
->
isRunning
()
)
{
libvlc_instance_t
*
p_libvlc
;
result
=
_p_instance
->
getVLC
(
&
p_libvlc
);
result
=
_p_instance
->
getVLC
(
&
p_libvlc
);
if
(
SUCCEEDED
(
result
)
)
if
(
SUCCEEDED
(
result
)
)
{
{
*
position
=
VLC_PositionGet
(
i_vlc
);
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_media_player_t
*
p_md
;
p_md
=
libvlc_playlist_get_media_player
(
p_libvlc
,
&
ex
);
if
(
!
libvlc_exception_raised
(
&
ex
)
)
{
*
position
=
libvlc_media_player_get_position
(
p_md
,
&
ex
);
libvlc_media_player_release
(
p_md
);
if
(
!
libvlc_exception_raised
(
&
ex
)
)
{
return
NOERROR
;
return
NOERROR
;
}
}
}
}
*
position
=
0.0
f
;
_p_instance
->
setErrorInfo
(
IID_IVLCControl
,
libvlc_exception_get_message
(
&
ex
));
libvlc_exception_clear
(
&
ex
);
return
E_FAIL
;
}
return
result
;
return
result
;
};
};
STDMETHODIMP
VLCControl
::
put_Position
(
float
position
)
STDMETHODIMP
VLCControl
::
put_Position
(
float
position
)
{
{
HRESULT
result
=
E_UNEXPECTED
;
HRESULT
result
=
E_UNEXPECTED
;
if
(
_p_instance
->
isRunning
()
)
libvlc_instance_t
*
p_libvlc
;
{
libvlc_instance_t
*
p_libvlc
;
result
=
_p_instance
->
getVLC
(
&
p_libvlc
);
result
=
_p_instance
->
getVLC
(
&
p_libvlc
);
if
(
SUCCEEDED
(
result
)
)
if
(
SUCCEEDED
(
result
)
)
{
{
VLC_PositionSet
(
i_vlc
,
position
);
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_media_player_t
*
p_md
;
p_md
=
libvlc_playlist_get_media_player
(
p_libvlc
,
&
ex
);
if
(
!
libvlc_exception_raised
(
&
ex
)
)
{
libvlc_media_player_set_position
(
p_md
,
position
,
&
ex
);
libvlc_media_player_release
(
p_md
);
if
(
!
libvlc_exception_raised
(
&
ex
)
)
{
return
NOERROR
;
}
}
}
_p_instance
->
setErrorInfo
(
IID_IVLCControl
,
libvlc_exception_get_message
(
&
ex
));
libvlc_exception_clear
(
&
ex
);
return
E_FAIL
;
}
}
return
result
;
return
result
;
};
};
...
@@ -220,42 +280,68 @@ STDMETHODIMP VLCControl::get_Time(int *seconds)
...
@@ -220,42 +280,68 @@ STDMETHODIMP VLCControl::get_Time(int *seconds)
if
(
NULL
==
seconds
)
if
(
NULL
==
seconds
)
return
E_POINTER
;
return
E_POINTER
;
HRESULT
result
=
NOERROR
;
*
seconds
=
0
;
if
(
_p_instance
->
isRunning
()
)
libvlc_instance_t
*
p_libvlc
;
{
HRESULT
result
=
_p_instance
->
getVLC
(
&
p_libvlc
);
libvlc_instance_t
*
p_libvlc
;
result
=
_p_instance
->
getVLC
(
&
p_libvlc
);
if
(
SUCCEEDED
(
result
)
)
if
(
SUCCEEDED
(
result
)
)
{
{
*
seconds
=
VLC_TimeGet
(
i_vlc
);
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_media_player_t
*
p_md
;
p_md
=
libvlc_playlist_get_media_player
(
p_libvlc
,
&
ex
);
if
(
!
libvlc_exception_raised
(
&
ex
)
)
{
*
seconds
=
libvlc_media_player_get_time
(
p_md
,
&
ex
);
libvlc_media_player_release
(
p_md
);
if
(
!
libvlc_exception_raised
(
&
ex
)
)
{
return
NOERROR
;
}
}
}
}
else
_p_instance
->
setErrorInfo
(
IID_IVLCControl
,
*
seconds
=
_p_instance
->
getTime
();
libvlc_exception_get_message
(
&
ex
));
libvlc_exception_clear
(
&
ex
);
return
E_FAIL
;
}
return
result
;
return
result
;
};
};
STDMETHODIMP
VLCControl
::
put_Time
(
int
seconds
)
STDMETHODIMP
VLCControl
::
put_Time
(
int
seconds
)
{
{
/* setTime function of the plugin sets the time. */
_p_instance
->
setTime
(
seconds
);
_p_instance
->
setTime
(
seconds
);
return
NOERROR
;
return
NOERROR
;
};
};
STDMETHODIMP
VLCControl
::
shuttle
(
int
seconds
)
STDMETHODIMP
VLCControl
::
shuttle
(
int
seconds
)
{
{
HRESULT
result
=
E_UNEXPECTED
;
libvlc_instance_t
*
p_libvlc
;
if
(
_p_instance
->
isRunning
()
)
HRESULT
result
=
_p_instance
->
getVLC
(
&
p_libvlc
);
{
libvlc_instance_t
*
p_libvlc
;
result
=
_p_instance
->
getVLC
(
&
p_libvlc
);
if
(
SUCCEEDED
(
result
)
)
if
(
SUCCEEDED
(
result
)
)
{
{
VLC_TimeSet
(
i_vlc
,
seconds
,
true
);
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_media_player_t
*
p_md
;
p_md
=
libvlc_playlist_get_media_player
(
p_libvlc
,
&
ex
);
if
(
!
libvlc_exception_raised
(
&
ex
)
)
{
if
(
seconds
<
0
)
seconds
=
0
;
libvlc_media_player_set_time
(
p_md
,
(
int64_t
)
seconds
,
&
ex
);
libvlc_media_player_release
(
p_md
);
if
(
!
libvlc_exception_raised
(
&
ex
)
)
{
return
NOERROR
;
}
}
}
_p_instance
->
setErrorInfo
(
IID_IVLCControl
,
libvlc_exception_get_message
(
&
ex
));
libvlc_exception_clear
(
&
ex
);
return
E_FAIL
;
}
}
return
result
;
return
result
;
};
};
STDMETHODIMP
VLCControl
::
fullscreen
(
void
)
STDMETHODIMP
VLCControl
::
fullscreen
(
void
)
...
@@ -286,20 +372,33 @@ STDMETHODIMP VLCControl::get_Length(int *seconds)
...
@@ -286,20 +372,33 @@ STDMETHODIMP VLCControl::get_Length(int *seconds)
{
{
if
(
NULL
==
seconds
)
if
(
NULL
==
seconds
)
return
E_POINTER
;
return
E_POINTER
;
*
seconds
=
0
;
HRESULT
result
=
NOERROR
;
libvlc_instance_t
*
p_libvlc
;
if
(
_p_instance
->
isRunning
()
)
HRESULT
result
=
_p_instance
->
getVLC
(
&
p_libvlc
);
{
libvlc_instance_t
*
p_libvlc
;
result
=
_p_instance
->
getVLC
(
&
p_libvlc
);
if
(
SUCCEEDED
(
result
)
)
if
(
SUCCEEDED
(
result
)
)
{
{
*
seconds
=
VLC_LengthGet
(
i_vlc
);
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_media_player_t
*
p_md
;
p_md
=
libvlc_playlist_get_media_player
(
p_libvlc
,
&
ex
);
if
(
!
libvlc_exception_raised
(
&
ex
)
)
{
*
seconds
=
(
double
)
libvlc_media_player_get_length
(
p_md
,
&
ex
);
libvlc_media_player_release
(
p_md
);
if
(
!
libvlc_exception_raised
(
&
ex
)
)
{
return
NOERROR
;
return
NOERROR
;
}
}
}
}
*
seconds
=
0
;
_p_instance
->
setErrorInfo
(
IID_IVLCControl
,
libvlc_exception_get_message
(
&
ex
));
libvlc_exception_clear
(
&
ex
);
return
E_FAIL
;
}
return
result
;
return
result
;
};
};
STDMETHODIMP
VLCControl
::
playFaster
(
void
)
STDMETHODIMP
VLCControl
::
playFaster
(
void
)
...
@@ -349,11 +448,22 @@ STDMETHODIMP VLCControl::put_Volume(int volume)
...
@@ -349,11 +448,22 @@ STDMETHODIMP VLCControl::put_Volume(int volume)
STDMETHODIMP
VLCControl
::
toggleMute
(
void
)
STDMETHODIMP
VLCControl
::
toggleMute
(
void
)
{
{
libvlc_instance_t
*
p_libvlc
;
libvlc_instance_t
*
p_libvlc
;
HRESULT
result
=
_p_instance
->
getVLC
(
&
p_libvlc
);
HRESULT
result
=
_p_instance
->
getVLC
(
&
p_libvlc
);
if
(
SUCCEEDED
(
result
)
)
if
(
SUCCEEDED
(
result
)
)
{
{
VLC_VolumeMute
(
i_vlc
);
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_audio_toggle_mute
(
p_libvlc
,
&
ex
);
if
(
libvlc_exception_raised
(
&
ex
)
)
{
_p_instance
->
setErrorInfo
(
IID_IVLCControl
,
libvlc_exception_get_message
(
&
ex
));
libvlc_exception_clear
(
&
ex
);
return
E_FAIL
;
}
return
NOERROR
;
}
}
return
result
;
return
result
;
};
};
...
@@ -364,7 +474,7 @@ STDMETHODIMP VLCControl::setVariable(BSTR name, VARIANT value)
...
@@ -364,7 +474,7 @@ STDMETHODIMP VLCControl::setVariable(BSTR name, VARIANT value)
return
E_INVALIDARG
;
return
E_INVALIDARG
;
libvlc_instance_t
*
p_libvlc
;
libvlc_instance_t
*
p_libvlc
;
HRESULT
result
=
_p_instance
->
getVLC
(
&
p_libvlc
);
HRESULT
hr
=
_p_instance
->
getVLC
(
&
p_libvlc
);
if
(
SUCCEEDED
(
hr
)
)
if
(
SUCCEEDED
(
hr
)
)
{
{
int
codePage
=
_p_instance
->
getCodePage
();
int
codePage
=
_p_instance
->
getCodePage
();
...
@@ -916,24 +1026,47 @@ STDMETHODIMP VLCControl::get_PlaylistIndex(int *index)
...
@@ -916,24 +1026,47 @@ STDMETHODIMP VLCControl::get_PlaylistIndex(int *index)
STDMETHODIMP
VLCControl
::
get_PlaylistCount
(
int
*
count
)
STDMETHODIMP
VLCControl
::
get_PlaylistCount
(
int
*
count
)
{
{
libvlc_instance_t
*
p_libvlc
;
if
(
NULL
==
count
)
return
E_POINTER
;
*
count
=
0
;
libvlc_instance_t
*
p_libvlc
;
HRESULT
result
=
_p_instance
->
getVLC
(
&
p_libvlc
);
HRESULT
result
=
_p_instance
->
getVLC
(
&
p_libvlc
);
if
(
SUCCEEDED
(
result
)
)
if
(
SUCCEEDED
(
result
)
)
{
{
*
count
=
VLC_PlaylistNumberOfItems
(
i_vlc
);
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
*
count
=
libvlc_playlist_items_count
(
p_libvlc
,
&
ex
);
if
(
libvlc_exception_raised
(
&
ex
)
)
{
_p_instance
->
setErrorInfo
(
IID_IVLCControl
,
libvlc_exception_get_message
(
&
ex
));
libvlc_exception_clear
(
&
ex
);
return
E_FAIL
;
}
return
NOERROR
;
return
NOERROR
;
}
}
*
count
=
0
;
return
result
;
return
result
;
};
};
STDMETHODIMP
VLCControl
::
playlistNext
(
void
)
STDMETHODIMP
VLCControl
::
playlistNext
(
void
)
{
{
libvlc_instance_t
*
p_libvlc
;
libvlc_instance_t
*
p_libvlc
;
HRESULT
result
=
_p_instance
->
getVLC
(
&
p_libvlc
);
HRESULT
result
=
_p_instance
->
getVLC
(
&
p_libvlc
);
if
(
SUCCEEDED
(
result
)
)
if
(
SUCCEEDED
(
result
)
)
{
{
VLC_PlaylistNext
(
i_vlc
);
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_playlist_next
(
p_libvlc
,
&
ex
);
if
(
libvlc_exception_raised
(
&
ex
)
)
{
_p_instance
->
setErrorInfo
(
IID_IVLCControl
,
libvlc_exception_get_message
(
&
ex
));
libvlc_exception_clear
(
&
ex
);
return
E_FAIL
;
}
return
NOERROR
;
return
NOERROR
;
}
}
return
result
;
return
result
;
...
@@ -941,11 +1074,21 @@ STDMETHODIMP VLCControl::playlistNext(void)
...
@@ -941,11 +1074,21 @@ STDMETHODIMP VLCControl::playlistNext(void)
STDMETHODIMP
VLCControl
::
playlistPrev
(
void
)
STDMETHODIMP
VLCControl
::
playlistPrev
(
void
)
{
{
libvlc_instance_t
*
p_libvlc
;
libvlc_instance_t
*
p_libvlc
;
HRESULT
result
=
_p_instance
->
getVLC
(
&
p_libvlc
);
HRESULT
result
=
_p_instance
->
getVLC
(
&
p_libvlc
);
if
(
SUCCEEDED
(
result
)
)
if
(
SUCCEEDED
(
result
)
)
{
{
VLC_PlaylistPrev
(
i_vlc
);
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_playlist_prev
(
p_libvlc
,
&
ex
);
if
(
libvlc_exception_raised
(
&
ex
)
)
{
_p_instance
->
setErrorInfo
(
IID_IVLCControl
,
libvlc_exception_get_message
(
&
ex
));
libvlc_exception_clear
(
&
ex
);
return
E_FAIL
;
}
return
NOERROR
;
return
NOERROR
;
}
}
return
result
;
return
result
;
...
@@ -953,11 +1096,21 @@ STDMETHODIMP VLCControl::playlistPrev(void)
...
@@ -953,11 +1096,21 @@ STDMETHODIMP VLCControl::playlistPrev(void)
STDMETHODIMP
VLCControl
::
playlistClear
(
void
)
STDMETHODIMP
VLCControl
::
playlistClear
(
void
)
{
{
libvlc_instance_t
*
p_libvlc
;
libvlc_instance_t
*
p_libvlc
;
HRESULT
result
=
_p_instance
->
getVLC
(
&
p_libvlc
);
HRESULT
result
=
_p_instance
->
getVLC
(
&
p_libvlc
);
if
(
SUCCEEDED
(
result
)
)
if
(
SUCCEEDED
(
result
)
)
{
{
VLC_PlaylistClear
(
i_vlc
);
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_playlist_clear
(
p_libvlc
,
&
ex
);
if
(
libvlc_exception_raised
(
&
ex
)
)
{
_p_instance
->
setErrorInfo
(
IID_IVLCControl
,
libvlc_exception_get_message
(
&
ex
));
libvlc_exception_clear
(
&
ex
);
return
E_FAIL
;
}
return
NOERROR
;
return
NOERROR
;
}
}
return
result
;
return
result
;
...
@@ -972,8 +1125,7 @@ STDMETHODIMP VLCControl::get_VersionInfo(BSTR *version)
...
@@ -972,8 +1125,7 @@ STDMETHODIMP VLCControl::get_VersionInfo(BSTR *version)
if
(
NULL
!=
versionStr
)
if
(
NULL
!=
versionStr
)
{
{
*
version
=
BSTRFromCStr
(
CP_UTF8
,
versionStr
);
*
version
=
BSTRFromCStr
(
CP_UTF8
,
versionStr
);
return
(
NULL
==
*
version
)
?
E_OUTOFMEMORY
:
NOERROR
;
return
NULL
==
*
version
?
E_OUTOFMEMORY
:
NOERROR
;
}
}
*
version
=
NULL
;
*
version
=
NULL
;
return
E_FAIL
;
return
E_FAIL
;
...
...
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