mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-09-20 13:08:50 +02:00
vlc-video: Allow all VLC-supported file types
Instead of just having a limited number of video file types that can be used, allow all files types that VLC supports.
This commit is contained in:
parent
a230769f40
commit
cbc1f63990
@ -154,3 +154,76 @@ extern LIBVLC_MEDIA_LIST_PLAYER_SET_MEDIA_PLAYER libvlc_media_list_player_set_me
|
||||
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_;
|
||||
|
||||
#define EXTENSIONS_AUDIO \
|
||||
"*.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;" \
|
||||
"*.xm"
|
||||
|
||||
#define EXTENSIONS_VIDEO "*.3g2;*.3gp;*.3gp2;*.3gpp;*.amv;*.asf;*.avi;" \
|
||||
"*.bik;*.bin;*.crf;*.divx;*.drc;*.dv;*.evo;*.f4v;*.flv;*.gvi;*.gxf;" \
|
||||
"*.iso;*.m1v;*.m2v;*.m2t;*.m2ts;*.m4v;*.mkv;*.mov;*.mp2;*.mp2v;*.mp4;" \
|
||||
"*.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;" \
|
||||
"*.wm;*.wmv;*.wtv;*.xesc"
|
||||
|
||||
#define EXTENSIONS_PLAYLIST "*.asx;*.b4s;*.cue;*.ifo;*.m3u;*.m3u8;*.pls;" \
|
||||
"*.ram;*.rar;*.sdp;*.vlc;*.xspf;*.wax;*.wvx;*.zip;*.conf"
|
||||
|
||||
#define EXTENSIONS_MEDIA EXTENSIONS_VIDEO ";" EXTENSIONS_AUDIO ";" \
|
||||
EXTENSIONS_PLAYLIST
|
||||
|
@ -411,19 +411,35 @@ static void add_file(struct vlc_source *c, struct darray *array,
|
||||
|
||||
static bool valid_extension(const char *ext)
|
||||
{
|
||||
if (!ext)
|
||||
struct dstr test = {0};
|
||||
bool valid = false;
|
||||
const char *b;
|
||||
const char *e;
|
||||
|
||||
if (!ext || !*ext)
|
||||
return false;
|
||||
return astrcmpi(ext, ".mp4") == 0 ||
|
||||
astrcmpi(ext, ".ts") == 0 ||
|
||||
astrcmpi(ext, ".mov") == 0 ||
|
||||
astrcmpi(ext, ".flv") == 0 ||
|
||||
astrcmpi(ext, ".mkv") == 0 ||
|
||||
astrcmpi(ext, ".avi") == 0 ||
|
||||
astrcmpi(ext, ".mp3") == 0 ||
|
||||
astrcmpi(ext, ".ogg") == 0 ||
|
||||
astrcmpi(ext, ".aac") == 0 ||
|
||||
astrcmpi(ext, ".wav") == 0 ||
|
||||
astrcmpi(ext, ".webm") == 0;
|
||||
|
||||
b = EXTENSIONS_MEDIA + 1;
|
||||
e = strchr(b, ';');
|
||||
|
||||
for (;;) {
|
||||
if (e) dstr_ncopy(&test, b, e - b);
|
||||
else dstr_copy(&test, b);
|
||||
|
||||
if (dstr_cmp(&test, ext) == 0) {
|
||||
valid = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!e)
|
||||
break;
|
||||
|
||||
b = e + 2;
|
||||
e = strchr(b, ';');
|
||||
}
|
||||
|
||||
dstr_free(&test);
|
||||
return valid;
|
||||
}
|
||||
|
||||
static void vlcs_update(void *data, obs_data_t *settings)
|
||||
@ -624,14 +640,12 @@ static void vlcs_defaults(obs_data_t *settings)
|
||||
S_BEHAVIOR_STOP_RESTART);
|
||||
}
|
||||
|
||||
static const char *file_filter =
|
||||
"Media files (*.mp4 *.ts *.mov *.flv *.mkv *.avi "
|
||||
"*.mp3 *.ogg *.aac *.wav *.webm)";
|
||||
|
||||
static obs_properties_t *vlcs_properties(void *data)
|
||||
{
|
||||
obs_properties_t *ppts = obs_properties_create();
|
||||
struct vlc_source *c = data;
|
||||
struct dstr filter = {0};
|
||||
struct dstr exts = {0};
|
||||
struct dstr path = {0};
|
||||
obs_property_t *p;
|
||||
|
||||
@ -661,9 +675,32 @@ static obs_properties_t *vlcs_properties(void *data)
|
||||
obs_property_list_add_string(p, T_BEHAVIOR_ALWAYS_PLAY,
|
||||
S_BEHAVIOR_ALWAYS_PLAY);
|
||||
|
||||
dstr_cat(&filter, "Media Files (");
|
||||
dstr_copy(&exts, EXTENSIONS_MEDIA);
|
||||
dstr_replace(&exts, ";", " ");
|
||||
dstr_cat_dstr(&filter, &exts);
|
||||
|
||||
dstr_cat(&filter, ");;Video Files (");
|
||||
dstr_copy(&exts, EXTENSIONS_VIDEO);
|
||||
dstr_replace(&exts, ";", " ");
|
||||
dstr_cat_dstr(&filter, &exts);
|
||||
|
||||
dstr_cat(&filter, ");;Audio Files (");
|
||||
dstr_copy(&exts, EXTENSIONS_AUDIO);
|
||||
dstr_replace(&exts, ";", " ");
|
||||
dstr_cat_dstr(&filter, &exts);
|
||||
|
||||
dstr_cat(&filter, ");;Playlist Files (");
|
||||
dstr_copy(&exts, EXTENSIONS_PLAYLIST);
|
||||
dstr_replace(&exts, ";", " ");
|
||||
dstr_cat_dstr(&filter, &exts);
|
||||
dstr_cat(&filter, ")");
|
||||
|
||||
obs_properties_add_editable_list(ppts, S_PLAYLIST, T_PLAYLIST,
|
||||
OBS_EDITABLE_LIST_TYPE_FILES, file_filter, path.array);
|
||||
OBS_EDITABLE_LIST_TYPE_FILES, filter.array, path.array);
|
||||
dstr_free(&path);
|
||||
dstr_free(&filter);
|
||||
dstr_free(&exts);
|
||||
|
||||
return ppts;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user