yolobs-studio/plugins/vlc-video/vlc-video-plugin.h

244 lines
9.5 KiB
C
Raw Permalink Normal View History

2016-08-28 12:07:43 +00:00
#include <obs-module.h>
#include <libvlc.h>
#ifdef _MSC_VER
#include <basetsd.h>
typedef SSIZE_T ssize_t;
#endif
#include <libvlc_media.h>
#include <libvlc_events.h>
#include <libvlc_media_list.h>
#include <libvlc_media_player.h>
#include <libvlc_media_list_player.h>
extern libvlc_instance_t *libvlc;
extern uint64_t time_start;
extern bool load_libvlc(void);
/* libvlc core */
typedef libvlc_instance_t *(*LIBVLC_NEW)(int argc, const char *const *argv);
typedef void (*LIBVLC_RELEASE)(libvlc_instance_t *p_instance);
typedef int64_t (*LIBVLC_CLOCK)(void);
typedef int (*LIBVLC_EVENT_ATTACH)(libvlc_event_manager_t *p_event_manager,
2019-09-22 21:19:10 +00:00
libvlc_event_type_t i_event_type,
libvlc_callback_t f_callback,
void *user_data);
2016-08-28 12:07:43 +00:00
/* libvlc media */
2019-09-22 21:19:10 +00:00
typedef libvlc_media_t *(*LIBVLC_MEDIA_NEW_PATH)(libvlc_instance_t *p_instance,
const char *path);
2016-10-10 19:01:40 +00:00
typedef libvlc_media_t *(*LIBVLC_MEDIA_NEW_LOCATION)(
2019-09-22 21:19:10 +00:00
libvlc_instance_t *p_instance, const char *location);
typedef void (*LIBVLC_MEDIA_ADD_OPTION)(libvlc_media_t *p_md,
const char *options);
2016-08-28 12:07:43 +00:00
typedef void (*LIBVLC_MEDIA_RETAIN)(libvlc_media_t *p_md);
typedef void (*LIBVLC_MEDIA_RELEASE)(libvlc_media_t *p_md);
2020-10-01 20:15:25 +00:00
typedef char *(*LIBVLC_MEDIA_GET_META)(libvlc_media_t *p_md,
libvlc_meta_t e_meta);
2016-08-28 12:07:43 +00:00
/* libvlc media player */
typedef libvlc_media_player_t *(*LIBVLC_MEDIA_PLAYER_NEW)(
2019-09-22 21:19:10 +00:00
libvlc_instance_t *p_libvlc);
2016-08-28 12:07:43 +00:00
typedef libvlc_media_player_t *(*LIBVLC_MEDIA_PLAYER_NEW_FROM_MEDIA)(
2019-09-22 21:19:10 +00:00
libvlc_media_t *p_md);
typedef void (*LIBVLC_MEDIA_PLAYER_RELEASE)(libvlc_media_player_t *p_mi);
typedef void (*LIBVLC_VIDEO_SET_CALLBACKS)(libvlc_media_player_t *mp,
libvlc_video_lock_cb lock,
libvlc_video_unlock_cb unlock,
libvlc_video_display_cb display,
void *opaque);
2016-08-28 12:07:43 +00:00
typedef void (*LIBVLC_VIDEO_SET_FORMAT_CALLBACKS)(
2019-09-22 21:19:10 +00:00
libvlc_media_player_t *mp, libvlc_video_format_cb setup,
libvlc_video_cleanup_cb cleanup);
2016-08-28 12:07:43 +00:00
typedef void (*LIBVLC_AUDIO_SET_CALLBACKS)(
2019-09-22 21:19:10 +00:00
libvlc_media_player_t *mp, 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);
2016-08-28 12:07:43 +00:00
typedef void (*LIBVLC_AUDIO_SET_FORMAT_CALLBACKS)(
2019-09-22 21:19:10 +00:00
libvlc_media_player_t *mp, libvlc_audio_setup_cb setup,
libvlc_audio_cleanup_cb cleanup);
typedef int (*LIBVLC_MEDIA_PLAYER_PLAY)(libvlc_media_player_t *p_mi);
typedef void (*LIBVLC_MEDIA_PLAYER_STOP)(libvlc_media_player_t *p_mi);
2016-08-28 12:07:43 +00:00
typedef libvlc_time_t (*LIBVLC_MEDIA_PLAYER_GET_TIME)(
2019-09-22 21:19:10 +00:00
libvlc_media_player_t *p_mi);
2020-03-25 08:07:22 +00:00
typedef void (*LIBVLC_MEDIA_PLAYER_SET_TIME)(libvlc_media_player_t *p_mi,
libvlc_time_t i_time);
2019-09-22 21:19:10 +00:00
typedef int (*LIBVLC_VIDEO_GET_SIZE)(libvlc_media_player_t *p_mi, unsigned num,
unsigned *px, unsigned *py);
2016-08-28 12:07:43 +00:00
typedef libvlc_event_manager_t *(*LIBVLC_MEDIA_PLAYER_EVENT_MANAGER)(
2019-09-22 21:19:10 +00:00
libvlc_media_player_t *p_mp);
2020-03-25 08:07:22 +00:00
typedef libvlc_state_t (*LIBVLC_MEDIA_PLAYER_GET_STATE)(
libvlc_media_player_t *p_mi);
typedef libvlc_time_t (*LIBVLC_MEDIA_PLAYER_GET_LENGTH)(
libvlc_media_player_t *p_mi);
2020-10-01 20:15:25 +00:00
typedef libvlc_media_t *(*LIBVLC_MEDIA_PLAYER_GET_MEDIA)(
libvlc_media_player_t *p_mi);
2016-08-28 12:07:43 +00:00
/* libvlc media list */
typedef libvlc_media_list_t *(*LIBVLC_MEDIA_LIST_NEW)(
2019-09-22 21:19:10 +00:00
libvlc_instance_t *p_instance);
2016-08-28 12:07:43 +00:00
typedef void (*LIBVLC_MEDIA_LIST_RELEASE)(libvlc_media_list_t *p_ml);
typedef int (*LIBVLC_MEDIA_LIST_ADD_MEDIA)(libvlc_media_list_t *p_ml,
2019-09-22 21:19:10 +00:00
libvlc_media_t *p_md);
2016-08-28 12:07:43 +00:00
typedef void (*LIBVLC_MEDIA_LIST_LOCK)(libvlc_media_list_t *p_ml);
typedef void (*LIBVLC_MEDIA_LIST_UNLOCK)(libvlc_media_list_t *p_ml);
typedef libvlc_event_manager_t *(*LIBVLC_MEDIA_LIST_EVENT_MANAGER)(
2019-09-22 21:19:10 +00:00
libvlc_media_list_t *p_ml);
2016-08-28 12:07:43 +00:00
/* libvlc media list player */
typedef libvlc_media_list_player_t *(*LIBVLC_MEDIA_LIST_PLAYER_NEW)(
2019-09-22 21:19:10 +00:00
libvlc_instance_t *p_instance);
2016-08-28 12:07:43 +00:00
typedef void (*LIBVLC_MEDIA_LIST_PLAYER_RELEASE)(
2019-09-22 21:19:10 +00:00
libvlc_media_list_player_t *p_mlp);
typedef void (*LIBVLC_MEDIA_LIST_PLAYER_PLAY)(libvlc_media_list_player_t *p_mlp);
2016-08-28 12:07:43 +00:00
typedef void (*LIBVLC_MEDIA_LIST_PLAYER_PAUSE)(
2019-09-22 21:19:10 +00:00
libvlc_media_list_player_t *p_mlp);
typedef void (*LIBVLC_MEDIA_LIST_PLAYER_STOP)(libvlc_media_list_player_t *p_mlp);
2016-08-28 12:07:43 +00:00
typedef void (*LIBVLC_MEDIA_LIST_PLAYER_SET_MEDIA_PLAYER)(
2019-09-22 21:19:10 +00:00
libvlc_media_list_player_t *p_mlp, libvlc_media_player_t *p_mp);
2016-08-28 12:07:43 +00:00
typedef void (*LIBVLC_MEDIA_LIST_PLAYER_SET_MEDIA_LIST)(
2019-09-22 21:19:10 +00:00
libvlc_media_list_player_t *p_mlp, libvlc_media_list_t *p_mlist);
2016-08-28 12:07:43 +00:00
typedef libvlc_event_manager_t *(*LIBVLC_MEDIA_LIST_PLAYER_EVENT_MANAGER)(
2019-09-22 21:19:10 +00:00
libvlc_media_list_player_t *p_mlp);
2016-08-28 12:07:43 +00:00
typedef void (*LIBVLC_MEDIA_LIST_PLAYER_SET_PLAYBACK_MODE)(
2019-09-22 21:19:10 +00:00
libvlc_media_list_player_t *p_mlp, libvlc_playback_mode_t e_mode);
typedef int (*LIBVLC_MEDIA_LIST_PLAYER_NEXT)(libvlc_media_list_player_t *p_mlp);
2018-02-19 19:54:37 +00:00
typedef int (*LIBVLC_MEDIA_LIST_PLAYER_PREVIOUS)(
2019-09-22 21:19:10 +00:00
libvlc_media_list_player_t *p_mlp);
2016-08-28 12:07:43 +00:00
/* -------------------------------------------------------------------- */
/* libvlc core */
extern LIBVLC_NEW libvlc_new_;
extern LIBVLC_RELEASE libvlc_release_;
extern LIBVLC_CLOCK libvlc_clock_;
extern LIBVLC_EVENT_ATTACH libvlc_event_attach_;
/* libvlc media */
extern LIBVLC_MEDIA_NEW_PATH libvlc_media_new_path_;
2016-10-10 19:01:40 +00:00
extern LIBVLC_MEDIA_NEW_LOCATION libvlc_media_new_location_;
extern LIBVLC_MEDIA_ADD_OPTION libvlc_media_add_option_;
2016-08-28 12:07:43 +00:00
extern LIBVLC_MEDIA_RELEASE libvlc_media_release_;
extern LIBVLC_MEDIA_RETAIN libvlc_media_retain_;
2020-10-01 20:15:25 +00:00
extern LIBVLC_MEDIA_GET_META libvlc_media_get_meta_;
2016-08-28 12:07:43 +00:00
/* libvlc media player */
extern LIBVLC_MEDIA_PLAYER_NEW libvlc_media_player_new_;
extern LIBVLC_MEDIA_PLAYER_NEW_FROM_MEDIA libvlc_media_player_new_from_media_;
extern LIBVLC_MEDIA_PLAYER_RELEASE libvlc_media_player_release_;
extern LIBVLC_VIDEO_SET_CALLBACKS libvlc_video_set_callbacks_;
extern LIBVLC_VIDEO_SET_FORMAT_CALLBACKS libvlc_video_set_format_callbacks_;
extern LIBVLC_AUDIO_SET_CALLBACKS libvlc_audio_set_callbacks_;
extern LIBVLC_AUDIO_SET_FORMAT_CALLBACKS libvlc_audio_set_format_callbacks_;
extern LIBVLC_MEDIA_PLAYER_PLAY libvlc_media_player_play_;
extern LIBVLC_MEDIA_PLAYER_STOP libvlc_media_player_stop_;
extern LIBVLC_MEDIA_PLAYER_GET_TIME libvlc_media_player_get_time_;
2020-03-25 08:07:22 +00:00
extern LIBVLC_MEDIA_PLAYER_SET_TIME libvlc_media_player_set_time_;
2016-08-28 12:07:43 +00:00
extern LIBVLC_VIDEO_GET_SIZE libvlc_video_get_size_;
extern LIBVLC_MEDIA_PLAYER_EVENT_MANAGER libvlc_media_player_event_manager_;
2020-03-25 08:07:22 +00:00
extern LIBVLC_MEDIA_PLAYER_GET_STATE libvlc_media_player_get_state_;
extern LIBVLC_MEDIA_PLAYER_GET_LENGTH libvlc_media_player_get_length_;
2020-10-01 20:15:25 +00:00
extern LIBVLC_MEDIA_PLAYER_GET_MEDIA libvlc_media_player_get_media_;
2016-08-28 12:07:43 +00:00
/* libvlc media list */
extern LIBVLC_MEDIA_LIST_NEW libvlc_media_list_new_;
extern LIBVLC_MEDIA_LIST_RELEASE libvlc_media_list_release_;
extern LIBVLC_MEDIA_LIST_ADD_MEDIA libvlc_media_list_add_media_;
extern LIBVLC_MEDIA_LIST_LOCK libvlc_media_list_lock_;
extern LIBVLC_MEDIA_LIST_UNLOCK libvlc_media_list_unlock_;
extern LIBVLC_MEDIA_LIST_EVENT_MANAGER libvlc_media_list_event_manager_;
/* libvlc media list player */
extern LIBVLC_MEDIA_LIST_PLAYER_NEW libvlc_media_list_player_new_;
extern LIBVLC_MEDIA_LIST_PLAYER_RELEASE libvlc_media_list_player_release_;
extern LIBVLC_MEDIA_LIST_PLAYER_PLAY libvlc_media_list_player_play_;
extern LIBVLC_MEDIA_LIST_PLAYER_PAUSE libvlc_media_list_player_pause_;
extern LIBVLC_MEDIA_LIST_PLAYER_STOP libvlc_media_list_player_stop_;
2019-09-22 21:19:10 +00:00
extern LIBVLC_MEDIA_LIST_PLAYER_SET_MEDIA_PLAYER
libvlc_media_list_player_set_media_player_;
extern LIBVLC_MEDIA_LIST_PLAYER_SET_MEDIA_LIST
libvlc_media_list_player_set_media_list_;
extern LIBVLC_MEDIA_LIST_PLAYER_EVENT_MANAGER
libvlc_media_list_player_event_manager_;
extern LIBVLC_MEDIA_LIST_PLAYER_SET_PLAYBACK_MODE
libvlc_media_list_player_set_playback_mode_;
2018-02-19 19:54:37 +00:00
extern LIBVLC_MEDIA_LIST_PLAYER_NEXT libvlc_media_list_player_next_;
extern LIBVLC_MEDIA_LIST_PLAYER_PREVIOUS libvlc_media_list_player_previous_;
2016-08-28 12:07:43 +00:00
#define EXTENSIONS_AUDIO \
2019-09-22 21:19:10 +00:00
"*.3ga;" \
"*.669;" \
"*.a52;" \
"*.aac;" \
"*.ac3;" \
"*.adt;" \
"*.adts;" \
"*.aif;" \
"*.aifc;" \
"*.aiff;" \
"*.amb;" \
"*.amr;" \
"*.aob;" \
"*.ape;" \
"*.au;" \
"*.awb;" \
"*.caf;" \
"*.dts;" \
"*.flac;" \
"*.it;" \
"*.kar;" \
"*.m4a;" \
"*.m4b;" \
"*.m4p;" \
"*.m5p;" \
"*.mid;" \
"*.mka;" \
"*.mlp;" \
"*.mod;" \
"*.mpa;" \
"*.mp1;" \
"*.mp2;" \
"*.mp3;" \
"*.mpc;" \
"*.mpga;" \
"*.mus;" \
"*.oga;" \
"*.ogg;" \
"*.oma;" \
"*.opus;" \
"*.qcp;" \
"*.ra;" \
"*.rmi;" \
"*.s3m;" \
"*.sid;" \
"*.spx;" \
"*.tak;" \
"*.thd;" \
"*.tta;" \
"*.voc;" \
"*.vqf;" \
"*.w64;" \
"*.wav;" \
"*.wma;" \
"*.wv;" \
"*.xa;" \
2016-08-28 12:07:43 +00:00
"*.xm"
2019-09-22 21:19:10 +00:00
#define EXTENSIONS_VIDEO \
"*.3g2;*.3gp;*.3gp2;*.3gpp;*.amv;*.asf;*.avi;" \
"*.bik;*.bin;*.crf;*.divx;*.drc;*.dv;*.evo;*.f4v;*.flv;*.gvi;*.gxf;" \
2016-08-28 12:07:43 +00:00
"*.iso;*.m1v;*.m2v;*.m2t;*.m2ts;*.m4v;*.mkv;*.mov;*.mp2;*.mp2v;*.mp4;" \
2019-09-22 21:19:10 +00:00
"*.mp4v;*.mpe;*.mpeg;*.mpeg1;*.mpeg2;*.mpeg4;*.mpg;*.mpv2;*.mts;" \
"*.mtv;*.mxf;*.mxg;*.nsv;*.nuv;*.ogg;*.ogm;*.ogv;*.ogx;*.ps;*.rec;" \
"*.rm;*.rmvb;*.rpl;*.thp;*.tod;*.ts;*.tts;*.txd;*.vob;*.vro;*.webm;" \
2016-08-28 12:07:43 +00:00
"*.wm;*.wmv;*.wtv;*.xesc"
2019-09-22 21:19:10 +00:00
#define EXTENSIONS_PLAYLIST \
"*.asx;*.b4s;*.cue;*.ifo;*.m3u;*.m3u8;*.pls;" \
2016-08-28 12:07:43 +00:00
"*.ram;*.rar;*.sdp;*.vlc;*.xspf;*.wax;*.wvx;*.zip;*.conf"
2019-09-22 21:19:10 +00:00
#define EXTENSIONS_MEDIA \
EXTENSIONS_VIDEO ";" EXTENSIONS_AUDIO ";" EXTENSIONS_PLAYLIST