MediaPlayer.hpp 44.1 KB
Newer Older
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
1 2 3 4 5 6
/*****************************************************************************
 * libvlc_MediaPlayer.hpp: MediaPlayer API
 *****************************************************************************
 * Copyright © 2014 the VideoLAN team
 *
 * Authors: Alexey Sokolov <alexey@alexeysokolov.co.cc>
7
 *          Hugo Beauzée-Luyssen <hugo@beauzee.fr>
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/

#ifndef LIBVLC_CXX_MEDIAPLAYER_H
#define LIBVLC_CXX_MEDIAPLAYER_H

27 28 29
#include <string>
#include <vector>

30
#include "common.hpp"
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
31

32
namespace VLC
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
33 34
{

35 36 37 38
class AudioOutputDeviceDescription;
class TrackDescription;
class Instance;
class Media;
39
class MediaPlayerEventManager;
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
40

41
class MediaPlayer : public Internal<libvlc_media_player_t>
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
42 43 44 45 46 47 48
{
public:
    /**
     * Check if 2 MediaPlayer objects contain the same libvlc_media_player_t.
     * \param another another MediaPlayer
     * \return true if they contain the same libvlc_media_player_t
     */
49 50 51 52
    bool operator==(const MediaPlayer& another) const
    {
        return m_obj == another.m_obj;
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
53 54 55 56 57 58 59 60

    // libvlc_media_player_new
    /**
     * Create an empty Media Player object
     *
     * \param p_libvlc_instance  the libvlc instance in which the Media
     * Player should be created.
     */
61 62
    MediaPlayer(Instance& instance )
        : Internal{ libvlc_media_player_new( instance ), libvlc_media_player_release }
63 64
    {
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
65 66 67 68 69 70 71

    // libvlc_media_player_new_from_media
    /**
     * Create a Media Player object from a Media
     *
     * \param p_md  the media. Afterwards the p_md can be safely destroyed.
     */
72
    MediaPlayer( Media& md )
73 74 75 76 77 78
        : Internal{ libvlc_media_player_new_from_media(
                        getInternalPtr<libvlc_media_t>( md ) ),
                    libvlc_media_player_release }
    {
    }

Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
79 80 81 82 83 84 85

    /**
     * Set the media that will be used by the media_player. If any, previous
     * md will be released.
     *
     * \param p_md  the Media. Afterwards the p_md can be safely destroyed.
     */
86
    void setMedia(Media& md)
87
    {
88
        libvlc_media_player_set_media( *this, getInternalPtr<libvlc_media_t>( md ) );
89
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
90 91 92 93 94 95 96

    /**
     * Get the media used by the media_player.
     *
     * \return the media associated with p_mi, or NULL if no media is
     * associated
     */
97 98
    MediaPtr media()
    {
99
        libvlc_media_t* media = libvlc_media_player_get_media(*this);
100 101
        return std::make_shared<Media>( media, true );
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
102 103 104 105 106 107

    /**
     * Get the Event Manager from which the media player send event.
     *
     * \return the event manager associated with p_mi
     */
108
    MediaPlayerEventManager& eventManager()
109 110 111
    {
        if ( m_eventManager == NULL )
        {
112
            libvlc_event_manager_t* obj = libvlc_media_player_event_manager( *this );
113
            m_eventManager = std::make_shared<MediaPlayerEventManager>( obj );
114
        }
115
        return *m_eventManager;
116
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
117 118 119 120 121 122

    /**
     * is_playing
     *
     * \return 1 if the media player is playing, 0 otherwise
     */
123 124
    bool isPlaying()
    {
125
        return libvlc_media_player_is_playing(*this) != 0;
126
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
127 128 129 130 131 132 133

    /**
     * Play
     *
     * \return 0 if playback started (and was already started), or -1 on
     * error.
     */
134 135
    int play()
    {
136
        return libvlc_media_player_play(*this);
137
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
138 139 140 141 142 143 144 145

    /**
     * Pause or resume (no effect if there is no media)
     *
     * \param do_pause  play/resume if zero, pause if non-zero
     *
     * \version LibVLC 1.1.1 or later
     */
146 147
    void setPause(int do_pause)
    {
148
        libvlc_media_player_set_pause(*this, do_pause);
149
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
150 151 152 153

    /**
     * Toggle pause (no effect if there is no media)
     */
154 155
    void pause()
    {
156
        libvlc_media_player_pause(*this);
157
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
158 159 160 161

    /**
     * Stop (no effect if there is no media)
     */
162 163
    void stop()
    {
164
        libvlc_media_player_stop(*this);
165
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190

    /**
     * Set the NSView handler where the media player should render its video
     * output.
     *
     * Use the vout called "macosx".
     *
     * The drawable is an NSObject that follow the
     * VLCOpenGLVideoViewEmbedding protocol:
     *
     * @protocol VLCOpenGLVideoViewEmbedding <NSObject>
     *
     * Or it can be an NSView object.
     *
     * If you want to use it along with Qt4 see the QMacCocoaViewContainer.
     * Then the following code should work:  { NSView *video = [[NSView
     * alloc] init]; QMacCocoaViewContainer *container = new
     * QMacCocoaViewContainer(video, parent);
     * libvlc_media_player_set_nsobject(mp, video); [video release]; }
     *
     * You can find a live example in VLCVideoView in VLCKit.framework.
     *
     * \param drawable  the drawable that is either an NSView or an object
     * following the VLCOpenGLVideoViewEmbedding protocol.
     */
191 192
    void setNsobject(void * drawable)
    {
193
        libvlc_media_player_set_nsobject(*this, drawable);
194
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
195 196 197 198 199 200 201

    /**
     * Get the NSView handler previously set with MediaPlayer::setNsobject()
     * .
     *
     * \return the NSView handler or 0 if none where set
     */
202 203
    void * nsobject()
    {
204
        return libvlc_media_player_get_nsobject(*this);
205
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
206 207 208 209 210 211 212

    /**
     * Set the agl handler where the media player should render its video
     * output.
     *
     * \param drawable  the agl handler
     */
213 214
    void setAgl(uint32_t drawable)
    {
215
        libvlc_media_player_set_agl(*this, drawable);
216
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
217 218 219 220 221 222

    /**
     * Get the agl handler previously set with MediaPlayer::setAgl() .
     *
     * \return the agl handler or 0 if none where set
     */
223 224
    uint32_t agl()
    {
225
        return libvlc_media_player_get_agl(*this);
226
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241

    /**
     * Set an X Window System drawable where the media player should render
     * its video output. If LibVLC was built without X11 output support, then
     * this has no effects.
     *
     * The specified identifier must correspond to an existing Input/Output
     * class X11 window. Pixmaps are supported. The caller shall ensure that
     * the X11 server is the same as the one the VLC instance has been
     * configured with. This function must be called before video playback is
     * started; otherwise it will only take effect after playback stop and
     * restart.
     *
     * \param drawable  the ID of the X window
     */
242 243
    void setXwindow(uint32_t drawable)
    {
244
        libvlc_media_player_set_xwindow(*this, drawable);
245
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
246 247 248 249 250 251 252 253 254

    /**
     * Get the X Window System window identifier previously set with
     * MediaPlayer::setXwindow() . Note that this will return the identifier
     * even if VLC is not currently using it (for instance if it is playing
     * an audio-only input).
     *
     * \return an X window ID, or 0 if none where set.
     */
255 256
    uint32_t xwindow()
    {
257
        return libvlc_media_player_get_xwindow(*this);
258
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
259 260 261 262 263 264 265 266

    /**
     * Set a Win32/Win64 API window handle (HWND) where the media player
     * should render its video output. If LibVLC was built without
     * Win32/Win64 API output support, then this has no effects.
     *
     * \param drawable  windows handle of the drawable
     */
267 268
    void setHwnd(void * drawable)
    {
269
        libvlc_media_player_set_hwnd(*this, drawable);
270
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
271 272 273 274 275 276 277 278

    /**
     * Get the Windows API window handle (HWND) previously set with
     * MediaPlayer::setHwnd() . The handle will be returned even if LibVLC is
     * not currently outputting any video to it.
     *
     * \return a window handle or NULL if there are none.
     */
279 280
    void * hwnd()
    {
281
        return libvlc_media_player_get_hwnd(*this);
282
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
283 284 285 286 287 288

    /**
     * Get the current movie length (in ms).
     *
     * \return the movie length (in ms), or -1 if there is no media.
     */
289 290
    libvlc_time_t length()
    {
291
        return libvlc_media_player_get_length(*this);
292
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
293 294 295 296 297 298

    /**
     * Get the current movie time (in ms).
     *
     * \return the movie time (in ms), or -1 if there is no media.
     */
299 300
    libvlc_time_t time()
    {
301
        return  libvlc_media_player_get_time(*this);
302
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
303 304 305 306 307 308 309

    /**
     * Set the movie time (in ms). This has no effect if no media is being
     * played. Not all formats and protocols support this.
     *
     * \param i_time  the movie time (in ms).
     */
310 311
    void setTime(libvlc_time_t i_time)
    {
312
        libvlc_media_player_set_time(*this, i_time);
313
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
314 315 316 317 318 319

    /**
     * Get movie position as percentage between 0.0 and 1.0.
     *
     * \return movie position, or -1. in case of error
     */
320 321
    float position()
    {
322
        return libvlc_media_player_get_position(*this);
323
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
324 325 326 327 328 329 330 331

    /**
     * Set movie position as percentage between 0.0 and 1.0. This has no
     * effect if playback is not enabled. This might not work depending on
     * the underlying input format and protocol.
     *
     * \param f_pos  the position
     */
332 333
    void setPosition(float f_pos)
    {
334
        libvlc_media_player_set_position(*this, f_pos);
335
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
336 337 338 339 340 341

    /**
     * Set movie chapter (if applicable).
     *
     * \param i_chapter  chapter number to play
     */
342 343
    void setChapter(int i_chapter)
    {
344
        libvlc_media_player_set_chapter(*this, i_chapter);
345
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
346 347 348 349 350 351

    /**
     * Get movie chapter.
     *
     * \return chapter number currently playing, or -1 if there is no media.
     */
352 353
    int chapter()
    {
354
        return libvlc_media_player_get_chapter(*this);
355
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
356 357 358 359 360 361

    /**
     * Get movie chapter count
     *
     * \return number of chapters in movie, or -1.
     */
362 363
    int chapterCount()
    {
364
        return libvlc_media_player_get_chapter_count(*this);
365
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
366 367 368 369 370 371

    /**
     * Is the player able to play
     *
     * \return boolean
     */
372 373
    bool willPlay()
    {
374
        return libvlc_media_player_will_play(*this);
375
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
376 377 378 379 380 381 382 383

    /**
     * Get title chapter count
     *
     * \param i_title  title
     *
     * \return number of chapters in title, or -1
     */
384 385
    int chapterCountForTitle(int i_title)
    {
386
        return libvlc_media_player_get_chapter_count_for_title(*this, i_title);
387
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
388 389 390 391 392 393

    /**
     * Set movie title
     *
     * \param i_title  title number to play
     */
394 395
    void setTitle(int i_title)
    {
396
        libvlc_media_player_set_title(*this, i_title);
397
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
398 399 400 401 402 403

    /**
     * Get movie title
     *
     * \return title number currently playing, or -1
     */
404 405
    int title()
    {
406
        return libvlc_media_player_get_title(*this);
407
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
408 409 410 411 412 413

    /**
     * Get movie title count
     *
     * \return title number count, or -1
     */
414 415
    int titleCount()
    {
416
        return libvlc_media_player_get_title_count(*this);
417
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
418 419 420 421

    /**
     * Set previous chapter (if applicable)
     */
422 423
    void previousChapter()
    {
424
        libvlc_media_player_previous_chapter(*this);
425
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
426 427 428 429

    /**
     * Set next chapter (if applicable)
     */
430 431
    void nextChapter()
    {
432
        libvlc_media_player_next_chapter(*this);
433
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
434 435 436 437 438 439 440 441 442

    /**
     * Get the requested movie play rate.
     *
     * \warning Depending on the underlying media, the requested rate may be
     * different from the real playback rate.
     *
     * \return movie play rate
     */
443 444
    float rate()
    {
445
        return libvlc_media_player_get_rate(*this);
446
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
447 448 449 450 451 452 453 454 455

    /**
     * Set movie play rate
     *
     * \param rate  movie play rate to set
     *
     * \return -1 if an error was detected, 0 otherwise (but even then, it
     * might not actually work depending on the underlying media protocol)
     */
456 457
    int setRate(float rate)
    {
458
        return libvlc_media_player_set_rate(*this, rate);
459
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
460 461 462 463 464 465 466 467

    /**
     * Get current movie state
     *
     * \return the current state of the media player (playing, paused, ...)
     *
     * \see libvlc_state_t
     */
468 469
    libvlc_state_t state()
    {
470
        return libvlc_media_player_get_state(*this);
471
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
472 473 474 475 476 477 478

    /**
     * Get movie fps rate
     *
     * \return frames per second (fps) for this playing movie, or 0 if
     * unspecified
     */
479 480
    float fps()
    {
481
        return libvlc_media_player_get_fps(*this);
482
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
483 484 485 486 487 488

    /**
     * end bug How many video outputs does this media player have?
     *
     * \return the number of video outputs
     */
489 490
    unsigned hasVout()
    {
491
        return libvlc_media_player_has_vout(*this);
492
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
493 494 495 496 497 498

    /**
     * Is this media player seekable?
     *
     * \return true if the media player can seek
     */
499 500
    bool isSeekable()
    {
501
        return libvlc_media_player_is_seekable(*this);
502
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
503 504 505 506 507 508

    /**
     * Can this media player be paused?
     *
     * \return true if the media player can pause
     */
509 510
    bool canPause()
    {
511
        return libvlc_media_player_can_pause(*this);
512
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
513 514 515 516 517 518 519 520

    /**
     * Check if the current program is scrambled
     *
     * \return true if the current program is scrambled
     *
     * \version LibVLC 2.2.0 or later
     */
521 522
    bool programScrambled()
    {
523
        return libvlc_media_player_program_scrambled(*this);
524
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
525 526 527 528

    /**
     * Display the next frame (if supported)
     */
529 530
    void nextFrame()
    {
531
        libvlc_media_player_next_frame(*this);
532
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
533 534 535 536 537 538 539 540

    /**
     * Navigate through DVD Menu
     *
     * \param navigate  the Navigation mode
     *
     * \version libVLC 2.0.0 or later
     */
541 542
    void navigate(unsigned navigate)
    {
543
        libvlc_media_player_navigate(*this, navigate);
544
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
545 546 547 548 549 550 551 552 553 554 555 556

    /**
     * Set if, and how, the video title will be shown when media is played.
     *
     * \param position  position at which to display the title, or
     * libvlc_position_disable to prevent the title from being displayed
     *
     * \param timeout  title display timeout in milliseconds (ignored if
     * libvlc_position_disable)
     *
     * \version libVLC 2.1.0 or later
     */
557 558
    void setVideoTitleDisplay(libvlc_position_t position, unsigned int timeout)
    {
559
        libvlc_media_player_set_video_title_display(*this, position, timeout);
560
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
561 562 563 564 565 566 567

    /**
     * Toggle fullscreen status on non-embedded video outputs.
     *
     * \warning The same limitations applies to this function as to
     * MediaPlayer::setFullscreen() .
     */
568 569
    void toggleFullscreen()
    {
570
        libvlc_toggle_fullscreen(*this);
571
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
572 573 574 575 576 577 578 579 580 581 582 583 584

    /**
     * Enable or disable fullscreen.
     *
     * \warning With most window managers, only a top-level windows can be in
     * full-screen mode. Hence, this function will not operate properly if
     * MediaPlayer::setXwindow() was used to embed the video in a non-top-
     * level window. In that case, the embedding window must be reparented to
     * the root window fullscreen mode is enabled. You will want to reparent
     * it back to its normal parent when disabling fullscreen.
     *
     * \param b_fullscreen  boolean for fullscreen status
     */
585 586
    void setFullscreen(int b_fullscreen)
    {
587
        libvlc_set_fullscreen(*this, b_fullscreen);
588
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
589 590 591 592 593 594

    /**
     * Get current fullscreen status.
     *
     * \return the fullscreen status (boolean)
     */
595 596
    bool fullscreen()
    {
597
        return libvlc_get_fullscreen(*this) != 0;
598
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
599 600 601 602

    /**
     * Toggle teletext transparent status on video output.
     */
603 604
    void toggleTeletext()
    {
605
        libvlc_toggle_teletext(*this);
606
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640

    /**
     * Apply new equalizer settings to a media player.
     *
     * The equalizer is first created by invoking
     * libvlc_audio_equalizer_new() or
     * libvlc_audio_equalizer_new_from_preset() .
     *
     * It is possible to apply new equalizer settings to a media player
     * whether the media player is currently playing media or not.
     *
     * Invoking this method will immediately apply the new equalizer settings
     * to the audio output of the currently playing media if there is any.
     *
     * If there is no currently playing media, the new equalizer settings
     * will be applied later if and when new media is played.
     *
     * Equalizer settings will automatically be applied to subsequently
     * played media.
     *
     * To disable the equalizer for a media player invoke this method passing
     * NULL for the p_equalizer parameter.
     *
     * The media player does not keep a reference to the supplied equalizer
     * so it is safe for an application to release the equalizer reference
     * any time after this method returns.
     *
     * \param p_equalizer  opaque equalizer handle, or NULL to disable the
     * equalizer for this media player
     *
     * \return zero on success, -1 on error
     *
     * \version LibVLC 2.2.0 or later
     */
641 642
    int setEqualizer(libvlc_equalizer_t * p_equalizer)
    {
643
        return libvlc_media_player_set_equalizer(*this, p_equalizer);
644
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
645

646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665
    /**
     * Set callbacks and private data for decoded audio. Use
     * MediaPlayer::setFormat() or MediaPlayer::setFormatCallbacks() to configure the
     * decoded audio format.
     *
     * \param play  callback to play audio samples (must not be NULL)
     *
     * \param pause  callback to pause playback (or NULL to ignore)
     *
     * \param resume  callback to resume playback (or NULL to ignore)
     *
     * \param flush  callback to flush audio buffers (or NULL to ignore)
     *
     * \param drain  callback to drain audio buffers (or NULL to ignore)
     *
     * \param opaque  private pointer for the audio callbacks (as first
     * parameter)
     *
     * \version LibVLC 2.0.0 or later
     */
666 667
    void setAudioCallbacks(libvlc_audio_play_cb play, libvlc_audio_pause_cb pause, libvlc_audio_resume_cb resume, libvlc_audio_flush_cb flush, libvlc_audio_drain_cb drain, void * opaque)
    {
668
        libvlc_audio_set_callbacks(*this, play, pause, resume, flush, drain, opaque);
669
    }
670 671 672 673 674 675 676 677 678 679 680

    /**
     * Set callbacks and private data for decoded audio. Use
     * MediaPlayer::setFormat() or MediaPlayer::setFormatCallbacks() to configure the
     * decoded audio format.
     *
     * \param set_volume  callback to apply audio volume, or NULL to apply
     * volume in software
     *
     * \version LibVLC 2.0.0 or later
     */
681 682
    void setVolumeCallback(libvlc_audio_set_volume_cb set_volume)
    {
683
        libvlc_audio_set_volume_callback(*this, set_volume);
684
    }
685 686 687 688 689 690 691 692 693 694 695

    /**
     * Set decoded audio format. This only works in combination with
     * MediaPlayer::setCallbacks() .
     *
     * \param setup  callback to select the audio format (cannot be NULL)
     *
     * \param cleanup  callback to release any allocated resources (or NULL)
     *
     * \version LibVLC 2.0.0 or later
     */
696 697
    void setAudioFormatCallbacks(libvlc_audio_setup_cb setup, libvlc_audio_cleanup_cb cleanup)
    {
698
        libvlc_audio_set_format_callbacks(*this, setup, cleanup);
699
    }
700 701 702 703 704 705 706 707 708 709 710 711 712 713 714

    /**
     * Set decoded audio format. This only works in combination with
     * MediaPlayer::setCallbacks() , and is mutually exclusive with
     * MediaPlayer::setFormatCallbacks() .
     *
     * \param format  a four-characters string identifying the sample format
     * (e.g. "S16N" or "FL32")
     *
     * \param rate  sample rate (expressed in Hz)
     *
     * \param channels  channels count
     *
     * \version LibVLC 2.0.0 or later
     */
715 716
    void setAudioFormat(const std::string& format, unsigned rate, unsigned channels)
    {
717
        libvlc_audio_set_format(*this, format.c_str(), rate, channels);
718
    }
719 720 721 722 723 724 725 726 727 728 729 730 731

    /**
     * Selects an audio output module.
     *
     * \note Any change will take be effect only after playback is stopped
     * and restarted. Audio output cannot be changed while playing.
     *
     * \param psz_name  name of audio output, use psz_name of
     *
     * \see AudioOutputDescription
     *
     * \return 0 if function succeded, -1 on error
     */
732 733
    int setAudioOutput(const std::string& psz_name)
    {
734
        return libvlc_audio_output_set(*this, psz_name.c_str());
735
    }
736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756

    /**
     * Gets a list of potential audio output devices,
     *
     * \see MediaPlayer::outputDeviceSet() .
     *
     * \note Not all audio outputs support enumerating devices. The audio
     * output may be functional even if the list is empty (NULL).
     *
     * \note The list may not be exhaustive.
     *
     * \warning Some audio output devices in the list might not actually work
     * in some circumstances. By default, it is recommended to not specify
     * any explicit audio device.
     *
     * \return A NULL-terminated linked list of potential audio output
     * devices. It must be freed it with
     * libvlc_audio_output_device_list_release()
     *
     * \version LibVLC 2.2.0 or later.
     */
757 758
    std::vector<AudioOutputDeviceDescription> outputDeviceEnum()
    {
759
        libvlc_audio_output_device_t* devices = libvlc_audio_output_device_enum(*this);
760 761 762 763 764 765 766 767
        std::vector<AudioOutputDeviceDescription> res;
        if ( devices == NULL )
            return res;
        for ( libvlc_audio_output_device_t* p = devices; p != NULL; p = p->p_next )
            res.push_back( AudioOutputDeviceDescription( p ) );
        libvlc_audio_output_device_list_release( devices );
        return res;
    }
768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806

    /**
     * Configures an explicit audio output device.
     *
     * If the module paramater is NULL, audio output will be moved to the
     * device specified by the device identifier string immediately. This is
     * the recommended usage.
     *
     * A list of adequate potential device strings can be obtained with
     * MediaPlayer::outputDeviceEnum() .
     *
     * However passing NULL is supported in LibVLC version 2.2.0 and later
     * only; in earlier versions, this function would have no effects when
     * the module parameter was NULL.
     *
     * If the module parameter is not NULL, the device parameter of the
     * corresponding audio output, if it exists, will be set to the specified
     * string. Note that some audio output modules do not have such a
     * parameter (notably MMDevice and PulseAudio).
     *
     * A list of adequate potential device strings can be obtained with
     * Instance::audioOutputDeviceList() .
     *
     * \note This function does not select the specified audio output plugin.
     * MediaPlayer::outputSet() is used for that purpose.
     *
     * \warning The syntax for the device parameter depends on the audio
     * output. Some audio output modules require further parameters (e.g. a
     * channels map in the case of ALSA).
     *
     * \param module  If NULL, current audio output module. if non-NULL, name
     * of audio output module (
     *
     * \see AudioOutputDescription )
     *
     * \param device_id  device identifier string
     *
     * \return Nothing. Errors are ignored (this is a design bug).
     */
807 808
    void outputDeviceSet(const std::string& module, const std::string& device_id)
    {
809
        libvlc_audio_output_device_set(*this, module.c_str(), device_id.c_str());
810
    }
811 812 813 814 815 816 817 818 819

    /**
     * Toggle mute status.
     *
     * \warning Toggling mute atomically is not always possible: On some
     * platforms, other processes can mute the VLC audio playback stream
     * asynchronously. Thus, there is a small race condition where toggling
     * will not work. See also the limitations of MediaPlayer::setMute() .
     */
820 821
    void toggleMute()
    {
822
        libvlc_audio_toggle_mute(*this);
823
    }
824 825 826 827 828 829 830

    /**
     * Get current mute status.
     *
     * \return the mute status (boolean) if defined, -1 if
     * undefined/unapplicable
     */
831 832
    int mute()
    {
833
        return libvlc_audio_get_mute(*this);
834
    }
835 836 837 838 839 840 841 842 843 844 845 846 847 848 849

    /**
     * Set mute status.
     *
     * \param status  If status is true then mute, otherwise unmute
     *
     * \warning This function does not always work. If there are no active
     * audio playback stream, the mute status might not be available. If
     * digital pass-through (S/PDIF, HDMI...) is in use, muting may be
     * unapplicable. Also some audio output plugins do not support muting at
     * all.
     *
     * \note To force silent playback, disable all audio tracks. This is more
     * efficient and reliable than mute.
     */
850 851
    void setMute(int status)
    {
852
        libvlc_audio_set_mute(*this,status);
853
    }
854 855 856 857 858 859 860

    /**
     * Get current software audio volume.
     *
     * \return the software volume in percents (0 = mute, 100 = nominal /
     * 0dB)
     */
861 862
    int volume()
    {
863
        return libvlc_audio_get_volume(*this);
864
    }
865 866 867 868 869 870 871 872

    /**
     * Set current software audio volume.
     *
     * \param i_volume  the volume in percents (0 = mute, 100 = 0dB)
     *
     * \return 0 if the volume was set, -1 if it was out of range
     */
873 874
    int setVolume(int i_volume)
    {
875
        return libvlc_audio_set_volume(*this, i_volume);
876
    }
877 878 879 880 881 882 883

    /**
     * Get number of available audio tracks.
     *
     * \return the number of available audio tracks (int), or -1 if
     * unavailable
     */
884 885
    int audioTrackCount()
    {
886
        return libvlc_audio_get_track_count(*this);
887
    }
888 889 890 891 892 893

    /**
     * Get the description of available audio tracks.
     *
     * \return list with description of available audio tracks, or NULL
     */
894 895
    std::vector<TrackDescription> audioTrackDescription()
    {
896
        libvlc_track_description_t* result = libvlc_audio_get_track_description( *this );
897 898
        return getTracksDescription( result );
    }
899 900 901 902 903 904

    /**
     * Get current audio track.
     *
     * \return the audio track ID or -1 if no active input.
     */
905 906
    int audioTrack()
    {
907
        return libvlc_audio_get_track(*this);
908
    }
909 910 911 912 913 914 915 916

    /**
     * Set current audio track.
     *
     * \param i_track  the track ID (i_id field from track description)
     *
     * \return 0 on success, -1 on error
     */
917 918
    int setAudioTrack(int i_track)
    {
919
        return libvlc_audio_set_track(*this, i_track);
920
    }
921 922 923 924 925 926 927 928

    /**
     * Get current audio channel.
     *
     * \return the audio channel
     *
     * \see libvlc_audio_output_channel_t
     */
929 930
    int channel()
    {
931
        return libvlc_audio_get_channel(*this);
932
    }
933 934 935 936 937 938 939 940 941 942

    /**
     * Set current audio channel.
     *
     * \param channel  the audio channel,
     *
     * \see libvlc_audio_output_channel_t
     *
     * \return 0 on success, -1 on error
     */
943 944
    int setChannel(int channel)
    {
945
        return libvlc_audio_set_channel(*this, channel);
946
    }
947 948 949 950 951 952 953 954

    /**
     * Get current audio delay.
     *
     * \return the audio delay (microseconds)
     *
     * \version LibVLC 1.1.1 or later
     */
955 956
    int64_t delay()
    {
957
        return libvlc_audio_get_delay(*this);
958
    }
959 960 961 962 963 964 965 966 967 968 969

    /**
     * Set current audio delay. The audio delay will be reset to zero each
     * time the media changes.
     *
     * \param i_delay  the audio delay (microseconds)
     *
     * \return 0 on success, -1 on error
     *
     * \version LibVLC 1.1.1 or later
     */
970 971
    int setDelay(int64_t i_delay)
    {
972
        return libvlc_audio_set_delay(*this, i_delay);
973
    }
974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990

    /**
     * Set callbacks and private data to render decoded video to a custom
     * area in memory. Use MediaPlayer::setFormat() or MediaPlayer::setFormatCallbacks()
     * to configure the decoded format.
     *
     * \param lock  callback to lock video memory (must not be NULL)
     *
     * \param unlock  callback to unlock video memory (or NULL if not needed)
     *
     * \param display  callback to display video (or NULL if not needed)
     *
     * \param opaque  private pointer for the three callbacks (as first
     * parameter)
     *
     * \version LibVLC 1.1.1 or later
     */
991 992
    void setVideoCallbacks(libvlc_video_lock_cb lock, libvlc_video_unlock_cb unlock, libvlc_video_display_cb display, void * opaque)
    {
993
        libvlc_video_set_callbacks(*this, lock, unlock, display, opaque);
994
    }
995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011

    /**
     * Set decoded video chroma and dimensions. This only works in
     * combination with MediaPlayer::setCallbacks() , and is mutually exclusive
     * with MediaPlayer::setFormatCallbacks() .
     *
     * \param chroma  a four-characters string identifying the chroma (e.g.
     * "RV32" or "YUYV")
     *
     * \param width  pixel width
     *
     * \param height  pixel height
     *
     * \param pitch  line pitch (in bytes)
     *
     * \version LibVLC 1.1.1 or later
     */
1012 1013
    void setVideoFormat(const std::string& chroma, unsigned width, unsigned height, unsigned pitch)
    {
1014
        libvlc_video_set_format(*this, chroma.c_str(), width, height, pitch);
1015
    }
1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026

    /**
     * Set decoded video chroma and dimensions. This only works in
     * combination with MediaPlayer::setCallbacks() .
     *
     * \param setup  callback to select the video format (cannot be NULL)
     *
     * \param cleanup  callback to release any allocated resources (or NULL)
     *
     * \version LibVLC 2.0.0 or later
     */
1027 1028
    void setVideoFormatCallbacks(libvlc_video_format_cb setup, libvlc_video_cleanup_cb cleanup)
    {
1029
        libvlc_video_set_format_callbacks(*this, setup, cleanup);
1030
    }
1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046

    /**
     * Enable or disable key press events handling, according to the LibVLC
     * hotkeys configuration. By default and for historical reasons, keyboard
     * events are handled by the LibVLC video widget.
     *
     * \note On X11, there can be only one subscriber for key press and mouse
     * click events per window. If your application has subscribed to those
     * events for the X window ID of the video widget, then LibVLC will not
     * be able to handle key presses and mouse clicks in any case.
     *
     * \warning This function is only implemented for X11 and Win32 at the
     * moment.
     *
     * \param on  true to handle key press events, false to ignore them.
     */
1047 1048
    void setKeyInput(unsigned on)
    {
1049
        libvlc_video_set_key_input(*this, on);
1050
    }
1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063

    /**
     * Enable or disable mouse click events handling. By default, those
     * events are handled. This is needed for DVD menus to work, as well as a
     * few video filters such as "puzzle".
     *
     * \see MediaPlayer::setKeyInput() .
     *
     * \warning This function is only implemented for X11 and Win32 at the
     * moment.
     *
     * \param on  true to handle mouse click events, false to ignore them.
     */
1064 1065
    void setMouseInput(unsigned on)
    {
1066
        libvlc_video_set_mouse_input(*this, on);
1067
    }
1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079

    /**
     * Get the pixel dimensions of a video.
     *
     * \param num  number of the video (starting from, and most commonly 0)
     *
     * \param px  pointer to get the pixel width [OUT]
     *
     * \param py  pointer to get the pixel height [OUT]
     *
     * \return 0 on success, -1 if the specified video does not exist
     */
1080 1081
    int size(unsigned num, unsigned * px, unsigned * py)
    {
1082
        return libvlc_video_get_size(*this, num, px, py);
1083
    }
1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110

    /**
     * Get the mouse pointer coordinates over a video. Coordinates are
     * expressed in terms of the decoded video resolution, in terms of pixels
     * on the screen/viewport (to get the latter, you can query your
     * windowing system directly).
     *
     * Either of the coordinates may be negative or larger than the
     * corresponding dimension of the video, if the cursor is outside the
     * rendering area.
     *
     * \warning The coordinates may be out-of-date if the pointer is not
     * located on the video rendering area. LibVLC does not track the pointer
     * if it is outside of the video widget.
     *
     * \note LibVLC does not support multiple pointers (it does of course
     * support multiple input devices sharing the same pointer) at the
     * moment.
     *
     * \param num  number of the video (starting from, and most commonly 0)
     *
     * \param px  pointer to get the abscissa [OUT]
     *
     * \param py  pointer to get the ordinate [OUT]
     *
     * \return 0 on success, -1 if the specified video does not exist
     */
1111 1112
    int cursor(unsigned num, int * px, int * py)
    {
1113
        return libvlc_video_get_cursor(*this, num, px, py);
1114
    }
1115 1116 1117 1118 1119 1120 1121

    /**
     * Get the current video scaling factor. See also MediaPlayer::setScale() .
     *
     * \return the currently configured zoom factor, or 0. if the video is
     * set to fit to the output window/drawable automatically.
     */
1122 1123
    float scale()
    {
1124
        return libvlc_video_get_scale(*this);
1125
    }
1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136

    /**
     * Set the video scaling factor. That is the ratio of the number of
     * pixels on screen to the number of pixels in the original decoded video
     * in each dimension. Zero is a special value; it will adjust the video
     * to the output window/drawable (in windowed mode) or the entire screen.
     *
     * Note that not all video outputs support scaling.
     *
     * \param f_factor  the scaling factor, or zero
     */
1137 1138
    void setScale(float f_factor)
    {
1139
        libvlc_video_set_scale(*this, f_factor);
1140
    }
1141 1142 1143 1144 1145 1146 1147

    /**
     * Get current video aspect ratio.
     *
     * \return the video aspect ratio or NULL if unspecified (the result must
     * be released with free() or libvlc_free() ).
     */
1148 1149
    std::string aspectRatio()
    {
1150 1151 1152 1153
        auto str = wrapCStr( libvlc_video_get_aspect_ratio(*this) );
        if ( str == nullptr )
            return {};
        return str.get();
1154
    }
1155 1156 1157 1158 1159 1160 1161 1162

    /**
     * Set new video aspect ratio.
     *
     * \param psz_aspect  new video aspect-ratio or NULL to reset to default
     *
     * \note Invalid aspect ratios are ignored.
     */
1163 1164
    void setAspectRatio(const std::string& psz_aspect)
    {
1165
        libvlc_video_set_aspect_ratio(*this,psz_aspect.c_str());
1166
    }
1167 1168 1169 1170 1171 1172

    /**
     * Get current video subtitle.
     *
     * \return the video subtitle selected, or -1 if none
     */
1173 1174
    int spu()
    {
1175
        return libvlc_video_get_spu(*this);
1176
    }
1177 1178 1179 1180 1181 1182

    /**
     * Get the number of available video subtitles.
     *
     * \return the number of available video subtitles
     */
1183 1184
    int spuCount()
    {
1185
        return libvlc_video_get_spu_count(*this);
1186
    }
1187 1188 1189 1190 1191 1192

    /**
     * Get the description of available video subtitles.
     *
     * \return list containing description of available video subtitles
     */
1193 1194
    std::vector<TrackDescription> spuDescription()
    {
1195
        libvlc_track_description_t* result = libvlc_video_get_spu_description( *this );
1196 1197
        return getTracksDescription( result );
    }
1198 1199 1200 1201 1202 1203 1204 1205 1206

    /**
     * Set new video subtitle.
     *
     * \param i_spu  video subtitle track to select (i_id from track
     * description)
     *
     * \return 0 on success, -1 if out of range
     */
1207 1208
    int setSpu(int i_spu)
    {
1209
        return libvlc_video_set_spu(*this, i_spu);
1210
    }
1211 1212 1213 1214 1215 1216 1217 1218

    /**
     * Set new video subtitle file.
     *
     * \param psz_subtitle  new video subtitle file
     *
     * \return the success status (boolean)
     */
1219 1220
    int setSubtitleFile(const std::string& psz_subtitle)
    {
1221
        return libvlc_video_set_subtitle_file(*this, psz_subtitle.c_str());
1222
    }
1223 1224 1225 1226 1227 1228 1229 1230 1231 1232

    /**
     * Get the current subtitle delay. Positive values means subtitles are
     * being displayed later, negative values earlier.
     *
     * \return time (in microseconds) the display of subtitles is being
     * delayed
     *
     * \version LibVLC 2.0.0 or later
     */
1233 1234
    int64_t spuDelay()
    {
1235
        return libvlc_video_get_spu_delay(*this);
1236
    }
1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252

    /**
     * Set the subtitle delay. This affects the timing of when the subtitle
     * will be displayed. Positive values result in subtitles being displayed
     * later, while negative values will result in subtitles being displayed
     * earlier.
     *
     * The subtitle delay will be reset to zero each time the media changes.
     *
     * \param i_delay  time (in microseconds) the display of subtitles should
     * be delayed
     *
     * \return 0 on success, -1 on error
     *
     * \version LibVLC 2.0.0 or later
     */
1253 1254
    int setSpuDelay(int64_t i_delay)
    {
1255
        return libvlc_video_set_spu_delay(*this, i_delay);
1256
    }
1257 1258 1259 1260 1261 1262

    /**
     * Get the description of available titles.
     *
     * \return list containing description of available titles
     */
1263 1264
    std::vector<TrackDescription> titleDescription()
    {
1265
        libvlc_track_description_t* result = libvlc_video_get_title_description( *this );
1266 1267
        return getTracksDescription( result );
    }
1268 1269 1270 1271 1272 1273 1274 1275 1276

    /**
     * Get the description of available chapters for specific title.
     *
     * \param i_title  selected title
     *
     * \return list containing description of available chapter for title
     * i_title
     */
1277 1278
    std::vector<TrackDescription> chapterDescription(int i_title)
    {
1279
        libvlc_track_description_t* result = libvlc_video_get_chapter_description( *this, i_title );
1280 1281
        return getTracksDescription( result );
    }
1282 1283 1284 1285 1286 1287

    /**
     * Get current crop filter geometry.
     *
     * \return the crop filter geometry or NULL if unset
     */
1288 1289
    std::string cropGeometry()
    {
1290 1291 1292 1293
        auto str = wrapCStr( libvlc_video_get_crop_geometry(*this) );
        if ( str == nullptr )
            return {};
        return str.get();
1294
    }
1295 1296 1297 1298 1299 1300

    /**
     * Set new crop filter geometry.
     *
     * \param psz_geometry  new crop filter geometry (NULL to unset)
     */
1301 1302
    void setCropGeometry(const std::string& psz_geometry)
    {
1303
        libvlc_video_set_crop_geometry(*this, psz_geometry.c_str());
1304
    }
1305 1306 1307 1308 1309 1310

    /**
     * Get current teletext page requested.
     *
     * \return the current teletext page requested.
     */
1311 1312
    int teletext()
    {
1313
        return libvlc_video_get_teletext(*this);
1314
    }
1315 1316 1317 1318 1319 1320

    /**
     * Set new teletext page to retrieve.
     *
     * \param i_page  teletex page number requested
     */
1321 1322
    void setTeletext(int i_page)
    {
1323
        libvlc_video_set_teletext(*this, i_page);
1324
    }
1325 1326 1327 1328 1329 1330

    /**
     * Get number of available video tracks.
     *
     * \return the number of available video tracks (int)
     */
1331 1332
    int videoTrackCount()
    {
1333
        return libvlc_video_get_track_count(*this);
1334
    }
1335 1336 1337 1338 1339 1340 1341

    /**
     * Get the description of available video tracks.
     *
     * \return list with description of available video tracks, or NULL on
     * error
     */
1342 1343
    std::vector<TrackDescription> videoTrackDescription()
    {
1344
        libvlc_track_description_t* result = libvlc_video_get_track_description( *this );
1345 1346
        return getTracksDescription( result );
    }
1347 1348 1349 1350 1351 1352

    /**
     * Get current video track.
     *
     * \return the video track ID (int) or -1 if no active input
     */
1353 1354
    int videoTrack()
    {
1355
        return libvlc_video_get_track(*this);
1356
    }
1357 1358 1359 1360 1361 1362 1363 1364

    /**
     * Set video track.
     *
     * \param i_track  the track ID (i_id field from track description)
     *
     * \return 0 on success, -1 if out of range
     */
1365 1366
    int setVideoTrack(int i_track)
    {
1367
        return libvlc_video_set_track(*this, i_track);
1368
    }
1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386

    /**
     * Take a snapshot of the current video window.
     *
     * If i_width AND i_height is 0, original size is used. If i_width XOR
     * i_height is 0, original aspect-ratio is preserved.
     *
     * \param num  number of video output (typically 0 for the first/only
     * one)
     *
     * \param psz_filepath  the path where to save the screenshot to
     *
     * \param i_width  the snapshot's width
     *
     * \param i_height  the snapshot's height
     *
     * \return 0 on success, -1 if the video was not found
     */
1387 1388
    int takeSnapshot(unsigned num, const std::string& psz_filepath, unsigned int i_width, unsigned int i_height)
    {
1389
        return libvlc_video_take_snapshot(*this, num, psz_filepath.c_str(), i_width, i_height);
1390
    }
1391 1392 1393 1394 1395 1396

    /**
     * Enable or disable deinterlace filter
     *
     * \param psz_mode  type of deinterlace filter, NULL to disable
     */
1397 1398
    void setDeinterlace(const std::string& psz_mode)
    {
1399
        libvlc_video_set_deinterlace(*this, psz_mode.c_str());
1400
    }
1401 1402 1403 1404 1405 1406 1407 1408

    /**
     * Get an integer marquee option value
     *
     * \param option  marq option to get
     *
     * \see libvlc_video_marquee_int_option_t
     */
1409 1410
    int marqueeInt(unsigned option)
    {
1411
        return libvlc_video_get_marquee_int(*this, option);
1412
    }
1413 1414 1415 1416 1417 1418 1419 1420

    /**
     * Get a string marquee option value
     *
     * \param option  marq option to get
     *
     * \see libvlc_video_marquee_string_option_t
     */
1421 1422
    std::string marqueeString(unsigned option)
    {
1423 1424 1425 1426
        auto str = wrapCStr( libvlc_video_get_marquee_string(*this, option) );
        if ( str == nullptr )
            return {};
        return str.get();
1427
    }
1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440

    /**
     * Enable, disable or set an integer marquee option
     *
     * Setting libvlc_marquee_Enable has the side effect of enabling (arg !0)
     * or disabling (arg 0) the marq filter.
     *
     * \param option  marq option to set
     *
     * \see libvlc_video_marquee_int_option_t
     *
     * \param i_val  marq option value
     */
1441 1442
    void setMarqueeInt(unsigned option, int i_val)
    {
1443
        libvlc_video_set_marquee_int(*this, option, i_val);
1444
    }
1445 1446 1447 1448 1449 1450 1451 1452 1453 1454

    /**
     * Set a marquee string option
     *
     * \param option  marq option to set
     *
     * \see libvlc_video_marquee_string_option_t
     *
     * \param psz_text  marq option value
     */
1455 1456
    void setMarqueeString(unsigned option, const std::string& psz_text)
    {
1457
        libvlc_video_set_marquee_string(*this, option, psz_text.c_str());
1458
    }
1459 1460 1461 1462 1463 1464 1465

    /**
     * Get integer logo option.
     *
     * \param option  logo option to get, values of
     * libvlc_video_logo_option_t
     */
1466 1467
    int logoInt(unsigned option)
    {
1468
        return libvlc_video_get_logo_int(*this, option);
1469
    }
1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480

    /**
     * Set logo option as integer. Options that take a different type value
     * are ignored. Passing libvlc_logo_enable as option value has the side
     * effect of starting (arg !0) or stopping (arg 0) the logo filter.
     *
     * \param option  logo option to set, values of
     * libvlc_video_logo_option_t
     *
     * \param value  logo option value
     */
1481 1482
    void setLogoInt(unsigned option, int value)
    {
1483
        libvlc_video_set_logo_int(*this, option, value);
1484
    }
1485 1486 1487 1488 1489 1490 1491 1492 1493 1494

    /**
     * Set logo option as string. Options that take a different type value
     * are ignored.
     *
     * \param option  logo option to set, values of
     * libvlc_video_logo_option_t
     *
     * \param psz_value  logo option value
     */
1495 1496
    void setLogoString(unsigned option, const std::string& psz_value)
    {
1497
        libvlc_video_set_logo_string(*this, option, psz_value.c_str());
1498
    }
1499 1500 1501 1502 1503 1504 1505 1506 1507

    /**
     * Get integer adjust option.
     *
     * \param option  adjust option to get, values of
     * libvlc_video_adjust_option_t
     *
     * \version LibVLC 1.1.1 and later.
     */
1508 1509
    int adjustInt(unsigned option)
    {
1510
        return libvlc_video_get_adjust_int(*this, option);
1511
    }
1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524

    /**
     * Set adjust option as integer. Options that take a different type value
     * are ignored. Passing libvlc_adjust_enable as option value has the side
     * effect of starting (arg !0) or stopping (arg 0) the adjust filter.
     *
     * \param option  adust option to set, values of
     * libvlc_video_adjust_option_t
     *
     * \param value  adjust option value
     *
     * \version LibVLC 1.1.1 and later.
     */
1525 1526
    void setAdjustInt(unsigned option, int value)
    {
1527
        libvlc_video_set_adjust_int(*this, option, value);
1528
    }
1529 1530 1531 1532 1533 1534 1535 1536 1537

    /**
     * Get float adjust option.
     *
     * \param option  adjust option to get, values of
     * libvlc_video_adjust_option_t
     *
     * \version LibVLC 1.1.1 and later.
     */
1538 1539
    float adjustFloat(unsigned option)
    {
1540
        return libvlc_video_get_adjust_float(*this, option);
1541
    }
1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553

    /**
     * Set adjust option as float. Options that take a different type value
     * are ignored.
     *
     * \param option  adust option to set, values of
     * libvlc_video_adjust_option_t
     *
     * \param value  adjust option value
     *
     * \version LibVLC 1.1.1 and later.
     */
1554 1555
    void setAdjustFloat(unsigned option, float value)
    {
1556
        libvlc_video_set_adjust_float(*this, option, value);
1557
    }
1558

Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
1559
private:
1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573
    std::vector<TrackDescription> getTracksDescription( libvlc_track_description_t* tracks ) const
    {
        std::vector<TrackDescription> result;
        if ( tracks == NULL )
            return result;
        libvlc_track_description_t* p = tracks;
        while ( p != NULL )
        {
            result.push_back( TrackDescription( p ) );
            p = p->p_next;
        }
        libvlc_track_description_list_release(tracks);
        return result;
    }
1574 1575

private:
1576
    std::shared_ptr<MediaPlayerEventManager> m_eventManager;
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
1577 1578 1579 1580 1581 1582
};

} // namespace VLC

#endif