Changeset 763b6733737946e6527ce6bc4a803dccd04de834
- Timestamp:
- 06/14/08 10:09:05
(3 months ago)
- Author:
- Jean-Paul Saman <jpsaman@videolan.org>
- git-committer:
- Jean-Paul Saman <jpsaman@videolan.org> 1213430945 +0200
- git-parent:
[30b36a445eb2607bb808b10c1e68d11489f3cec4]
- git-author:
- Jean-Paul Saman <jpsaman@videolan.org> 1213083809 +0200
- Message:
Remove VLCPlugin::getVLCObject() methond from ActiveX
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r04e7bd8 |
r763b673 |
|
| 411 | 411 | }; |
|---|
| 412 | 412 | |
|---|
| 413 | | HRESULT VLCPlugin::getVLCObject(int* i_vlc) |
|---|
| 414 | | { |
|---|
| 415 | | libvlc_instance_t *p_libvlc; |
|---|
| 416 | | HRESULT result = getVLC(&p_libvlc); |
|---|
| 417 | | if( SUCCEEDED(result) ) |
|---|
| 418 | | { |
|---|
| 419 | | *i_vlc = libvlc_get_vlc_id(p_libvlc); |
|---|
| 420 | | } |
|---|
| 421 | | else |
|---|
| 422 | | { |
|---|
| 423 | | *i_vlc = 0; |
|---|
| 424 | | } |
|---|
| 425 | | return result; |
|---|
| 426 | | } |
|---|
| 427 | | |
|---|
| 428 | 413 | HRESULT VLCPlugin::getVLC(libvlc_instance_t** pp_libvlc) |
|---|
| 429 | 414 | { |
|---|
| … | … | |
| 486 | 471 | ppsz_argv[ppsz_argc++] = "--no-stats"; |
|---|
| 487 | 472 | ppsz_argv[ppsz_argc++] = "--no-media-library"; |
|---|
| | 473 | ppsz_argv[ppsz_argc++] = "--ignore-config"; |
|---|
| 488 | 474 | ppsz_argv[ppsz_argc++] = "--intf=dummy"; |
|---|
| 489 | 475 | |
|---|
| … | … | |
| 492 | 478 | ppsz_argv[ppsz_argc++] = "--loop"; |
|---|
| 493 | 479 | |
|---|
| 494 | | _p_libvlc = libvlc_new(ppsz_argc, ppsz_argv, NULL); |
|---|
| 495 | | if( NULL == _p_libvlc ) |
|---|
| | 480 | libvlc_exception_t ex; |
|---|
| | 481 | libvlc_exception_init(&ex); |
|---|
| | 482 | |
|---|
| | 483 | _p_libvlc = libvlc_new(ppsz_argc, ppsz_argv, &ex); |
|---|
| | 484 | if( libvlc_exception_raised(&ex) ) |
|---|
| 496 | 485 | { |
|---|
| 497 | 486 | *pp_libvlc = NULL; |
|---|
| | 487 | libvlc_exception_clear(&ex); |
|---|
| 498 | 488 | return E_FAIL; |
|---|
| 499 | 489 | } |
|---|
| … | … | |
| 669 | 659 | vlcDataObject->onClose(); |
|---|
| 670 | 660 | |
|---|
| 671 | | libvlc_release(p_libvlc); |
|---|
| | 661 | if( p_libvlc ) |
|---|
| | 662 | libvlc_release(p_libvlc); |
|---|
| 672 | 663 | } |
|---|
| 673 | 664 | return S_OK; |
|---|
| r30b36a4 |
r763b673 |
|
| 28 | 28 | |
|---|
| 29 | 29 | #include <vlc/vlc.h> |
|---|
| 30 | | #include <vlc/libvlc.h> |
|---|
| 31 | 30 | |
|---|
| 32 | 31 | extern "C" const GUID CLSID_VLCPlugin; |
|---|
| … | … | |
| 195 | 194 | |
|---|
| 196 | 195 | inline BOOL isRunning(void) { return NULL != _p_libvlc; }; |
|---|
| 197 | | HRESULT getVLCObject(int *i_vlc); |
|---|
| 198 | 196 | HRESULT getVLC(libvlc_instance_t** p_vlc); |
|---|
| 199 | 197 | void setErrorInfo(REFIID riid, const char *description); |
|---|
| r449fd28 |
r763b673 |
|
| 124 | 124 | STDMETHODIMP VLCControl::play(void) |
|---|
| 125 | 125 | { |
|---|
| 126 | | int i_vlc; |
|---|
| 127 | | HRESULT result = _p_instance->getVLCObject(&i_vlc); |
|---|
| | 126 | libvlc_instance_t *p_libvlc; |
|---|
| | 127 | HRESULT result = _p_instance->getVLC(&p_libvlc); |
|---|
| 128 | 128 | if( SUCCEEDED(result) ) |
|---|
| 129 | 129 | { |
|---|
| … | … | |
| 136 | 136 | STDMETHODIMP VLCControl::pause(void) |
|---|
| 137 | 137 | { |
|---|
| 138 | | int i_vlc; |
|---|
| 139 | | HRESULT result = _p_instance->getVLCObject(&i_vlc); |
|---|
| | 138 | libvlc_instance_t *p_libvlc; |
|---|
| | 139 | HRESULT result = _p_instance->getVLC(&p_libvlc); |
|---|
| 140 | 140 | if( SUCCEEDED(result) ) |
|---|
| 141 | 141 | { |
|---|
| … | … | |
| 148 | 148 | STDMETHODIMP VLCControl::stop(void) |
|---|
| 149 | 149 | { |
|---|
| 150 | | int i_vlc; |
|---|
| 151 | | HRESULT result = _p_instance->getVLCObject(&i_vlc); |
|---|
| | 150 | libvlc_instance_t *p_libvlc; |
|---|
| | 151 | HRESULT result = _p_instance->getVLC(&p_libvlc); |
|---|
| 152 | 152 | if( SUCCEEDED(result) ) |
|---|
| 153 | 153 | { |
|---|
| … | … | |
| 166 | 166 | if( _p_instance->isRunning() ) |
|---|
| 167 | 167 | { |
|---|
| 168 | | int i_vlc; |
|---|
| 169 | | result = _p_instance->getVLCObject(&i_vlc); |
|---|
| | 168 | libvlc_instance_t *p_libvlc; |
|---|
| | 169 | result = _p_instance->getVLC(&p_libvlc); |
|---|
| 170 | 170 | if( SUCCEEDED(result) ) |
|---|
| 171 | 171 | { |
|---|
| 172 | | *isPlaying = VLC_IsPlaying(i_vlc) ? VARIANT_TRUE : VARIANT_FALSE; |
|---|
| | 172 | if( libvlc_playlist_isplaying(p_libvlc, NULL) ) |
|---|
| | 173 | *isPlaying = VARIANT_TRUE; |
|---|
| | 174 | else |
|---|
| | 175 | *isPlaying = VARIANT_FALSE; |
|---|
| 173 | 176 | return NOERROR; |
|---|
| 174 | 177 | } |
|---|
| … | … | |
| 186 | 189 | if( _p_instance->isRunning() ) |
|---|
| 187 | 190 | { |
|---|
| 188 | | int i_vlc; |
|---|
| 189 | | result = _p_instance->getVLCObject(&i_vlc); |
|---|
| | 191 | libvlc_instance_t *p_libvlc; |
|---|
| | 192 | result = _p_instance->getVLC(&p_libvlc); |
|---|
| 190 | 193 | if( SUCCEEDED(result) ) |
|---|
| 191 | 194 | { |
|---|
| … | … | |
| 203 | 206 | if( _p_instance->isRunning() ) |
|---|
| 204 | 207 | { |
|---|
| 205 | | int i_vlc; |
|---|
| 206 | | result = _p_instance->getVLCObject(&i_vlc); |
|---|
| | 208 | libvlc_instance_t *p_libvlc; |
|---|
| | 209 | result = _p_instance->getVLC(&p_libvlc); |
|---|
| 207 | 210 | if( SUCCEEDED(result) ) |
|---|
| 208 | 211 | { |
|---|
| … | … | |
| 221 | 224 | if( _p_instance->isRunning() ) |
|---|
| 222 | 225 | { |
|---|
| 223 | | int i_vlc; |
|---|
| 224 | | result = _p_instance->getVLCObject(&i_vlc); |
|---|
| | 226 | libvlc_instance_t *p_libvlc; |
|---|
| | 227 | result = _p_instance->getVLC(&p_libvlc); |
|---|
| 225 | 228 | if( SUCCEEDED(result) ) |
|---|
| 226 | 229 | { |
|---|
| … | … | |
| 246 | 249 | if( _p_instance->isRunning() ) |
|---|
| 247 | 250 | { |
|---|
| 248 | | int i_vlc; |
|---|
| 249 | | result = _p_instance->getVLCObject(&i_vlc); |
|---|
| | 251 | libvlc_instance_t *p_libvlc; |
|---|
| | 252 | result = _p_instance->getVLC(&p_libvlc); |
|---|
| 250 | 253 | if( SUCCEEDED(result) ) |
|---|
| 251 | 254 | { |
|---|
| … | … | |
| 261 | 264 | if( _p_instance->isRunning() ) |
|---|
| 262 | 265 | { |
|---|
| 263 | | int i_vlc; |
|---|
| 264 | | result = _p_instance->getVLCObject(&i_vlc); |
|---|
| | 266 | libvlc_instance_t *p_libvlc; |
|---|
| | 267 | result = _p_instance->getVLC(&p_libvlc); |
|---|
| 265 | 268 | if( SUCCEEDED(result) ) |
|---|
| 266 | 269 | { |
|---|
| 267 | | VLC_FullScreen(i_vlc); |
|---|
| | 270 | if( libvlc_playlist_isplaying(p_libvlc, NULL) ) |
|---|
| | 271 | { |
|---|
| | 272 | libvlc_media_player_t *p_md = |
|---|
| | 273 | libvlc_playlist_get_media_player(p_libvlc, NULL); |
|---|
| | 274 | if( p_md ) |
|---|
| | 275 | { |
|---|
| | 276 | libvlc_toggle_fullscreen(p_md, NULL); |
|---|
| | 277 | libvlc_media_player_release(p_md); |
|---|
| | 278 | } |
|---|
| | 279 | } |
|---|
| 268 | 280 | } |
|---|
| 269 | 281 | } |
|---|
| … | … | |
| 279 | 291 | if( _p_instance->isRunning() ) |
|---|
| 280 | 292 | { |
|---|
| 281 | | int i_vlc; |
|---|
| 282 | | result = _p_instance->getVLCObject(&i_vlc); |
|---|
| | 293 | libvlc_instance_t *p_libvlc; |
|---|
| | 294 | result = _p_instance->getVLC(&p_libvlc); |
|---|
| 283 | 295 | if( SUCCEEDED(result) ) |
|---|
| 284 | 296 | { |
|---|
| … | … | |
| 296 | 308 | if( _p_instance->isRunning() ) |
|---|
| 297 | 309 | { |
|---|
| 298 | | int i_vlc; |
|---|
| 299 | | result = _p_instance->getVLCObject(&i_vlc); |
|---|
| | 310 | libvlc_instance_t *p_libvlc; |
|---|
| | 311 | result = _p_instance->getVLC(&p_libvlc); |
|---|
| 300 | 312 | if( SUCCEEDED(result) ) |
|---|
| 301 | 313 | { |
|---|
| … | … | |
| 311 | 323 | if( _p_instance->isRunning() ) |
|---|
| 312 | 324 | { |
|---|
| 313 | | int i_vlc; |
|---|
| 314 | | result = _p_instance->getVLCObject(&i_vlc); |
|---|
| | 325 | libvlc_instance_t *p_libvlc; |
|---|
| | 326 | result = _p_instance->getVLC(&p_libvlc); |
|---|
| 315 | 327 | if( SUCCEEDED(result) ) |
|---|
| 316 | 328 | { |
|---|
| … | … | |
| 338 | 350 | STDMETHODIMP VLCControl::toggleMute(void) |
|---|
| 339 | 351 | { |
|---|
| 340 | | int i_vlc; |
|---|
| 341 | | HRESULT result = _p_instance->getVLCObject(&i_vlc); |
|---|
| | 352 | libvlc_instance_t *p_libvlc; |
|---|
| | 353 | HRESULT result = _p_instance->getVLC(&p_libvlc); |
|---|
| 342 | 354 | if( SUCCEEDED(result) ) |
|---|
| 343 | 355 | { |
|---|
| … | … | |
| 352 | 364 | return E_INVALIDARG; |
|---|
| 353 | 365 | |
|---|
| 354 | | int i_vlc; |
|---|
| 355 | | HRESULT hr = _p_instance->getVLCObject(&i_vlc); |
|---|
| | 366 | libvlc_instance_t *p_libvlc; |
|---|
| | 367 | HRESULT result = _p_instance->getVLC(&p_libvlc); |
|---|
| 356 | 368 | if( SUCCEEDED(hr) ) |
|---|
| 357 | 369 | { |
|---|
| … | … | |
| 467 | 479 | return E_INVALIDARG; |
|---|
| 468 | 480 | |
|---|
| 469 | | int i_vlc; |
|---|
| 470 | | HRESULT hr = _p_instance->getVLCObject(&i_vlc); |
|---|
| | 481 | libvlc_instance_t *p_libvlc; |
|---|
| | 482 | HRESULT hr = _p_instance->getVLC(&p_libvlc); |
|---|
| 471 | 483 | if( SUCCEEDED(hr) ) |
|---|
| 472 | 484 | { |
|---|
| … | … | |
| 854 | 866 | return E_INVALIDARG; |
|---|
| 855 | 867 | |
|---|
| 856 | | int i_vlc; |
|---|
| 857 | | HRESULT hr = _p_instance->getVLCObject(&i_vlc); |
|---|
| | 868 | libvlc_instance_t *p_libvlc; |
|---|
| | 869 | HRESULT hr = _p_instance->getVLC(&p_libvlc); |
|---|
| 858 | 870 | if( SUCCEEDED(hr) ) |
|---|
| 859 | 871 | { |
|---|
| … | … | |
| 892 | 904 | return E_POINTER; |
|---|
| 893 | 905 | |
|---|
| 894 | | int i_vlc; |
|---|
| 895 | | HRESULT result = _p_instance->getVLCObject(&i_vlc); |
|---|
| | 906 | libvlc_instance_t *p_libvlc; |
|---|
| | 907 | HRESULT result = _p_instance->getVLC(&p_libvlc); |
|---|
| 896 | 908 | if( SUCCEEDED(result) ) |
|---|
| 897 | 909 | { |
|---|
| … | … | |
| 905 | 917 | STDMETHODIMP VLCControl::get_PlaylistCount(int *count) |
|---|
| 906 | 918 | { |
|---|
| 907 | | int i_vlc; |
|---|
| 908 | | HRESULT result = _p_instance->getVLCObject(&i_vlc); |
|---|
| | 919 | libvlc_instance_t *p_libvlc; |
|---|
| | 920 | HRESULT result = _p_instance->getVLC(&p_libvlc); |
|---|
| 909 | 921 | if( SUCCEEDED(result) ) |
|---|
| 910 | 922 | { |
|---|
| … | … | |
| 918 | 930 | STDMETHODIMP VLCControl::playlistNext(void) |
|---|
| 919 | 931 | { |
|---|
| 920 | | int i_vlc; |
|---|
| 921 | | HRESULT result = _p_instance->getVLCObject(&i_vlc); |
|---|
| | 932 | libvlc_instance_t *p_libvlc; |
|---|
| | 933 | HRESULT result = _p_instance->getVLC(&p_libvlc); |
|---|
| 922 | 934 | if( SUCCEEDED(result) ) |
|---|
| 923 | 935 | { |
|---|
| … | … | |
| 930 | 942 | STDMETHODIMP VLCControl::playlistPrev(void) |
|---|
| 931 | 943 | { |
|---|
| 932 | | int i_vlc; |
|---|
| 933 | | HRESULT result = _p_instance->getVLCObject(&i_vlc); |
|---|
| | 944 | libvlc_instance_t *p_libvlc; |
|---|
| | 945 | HRESULT result = _p_instance->getVLC(&p_libvlc); |
|---|
| 934 | 946 | if( SUCCEEDED(result) ) |
|---|
| 935 | 947 | { |
|---|
| … | … | |
| 942 | 954 | STDMETHODIMP VLCControl::playlistClear(void) |
|---|
| 943 | 955 | { |
|---|
| 944 | | int i_vlc; |
|---|
| 945 | | HRESULT result = _p_instance->getVLCObject(&i_vlc); |
|---|
| | 956 | libvlc_instance_t *p_libvlc; |
|---|
| | 957 | HRESULT result = _p_instance->getVLC(&p_libvlc); |
|---|
| 946 | 958 | if( SUCCEEDED(result) ) |
|---|
| 947 | 959 | { |
|---|
| … | … | |
| 957 | 969 | return E_POINTER; |
|---|
| 958 | 970 | |
|---|
| 959 | | const char *versionStr = VLC_Version(); |
|---|
| | 971 | const char *versionStr = libvlc_get_version(); |
|---|
| 960 | 972 | if( NULL != versionStr ) |
|---|
| 961 | 973 | { |
|---|
| 962 | 974 | *version = BSTRFromCStr(CP_UTF8, versionStr); |
|---|
| 963 | | |
|---|
| | 975 | |
|---|
| 964 | 976 | return NULL == *version ? E_OUTOFMEMORY : NOERROR; |
|---|
| 965 | 977 | } |
|---|