New upstream version 21.1.2+dfsg1
This commit is contained in:
parent
baafb6325b
commit
665f64a933
152 changed files with 3957 additions and 356 deletions
|
|
@ -49,6 +49,7 @@ struct ffmpeg_source {
|
|||
char *input;
|
||||
char *input_format;
|
||||
int buffering_mb;
|
||||
int speed_percent;
|
||||
bool is_looping;
|
||||
bool is_local_file;
|
||||
bool is_hw_decoding;
|
||||
|
|
@ -72,12 +73,14 @@ static bool is_local_file_modified(obs_properties_t *props,
|
|||
obs_property_t *buffering = obs_properties_get(props, "buffering_mb");
|
||||
obs_property_t *close = obs_properties_get(props, "close_when_inactive");
|
||||
obs_property_t *seekable = obs_properties_get(props, "seekable");
|
||||
obs_property_t *speed = obs_properties_get(props, "speed_percent");
|
||||
obs_property_set_visible(input, !enabled);
|
||||
obs_property_set_visible(input_format, !enabled);
|
||||
obs_property_set_visible(buffering, !enabled);
|
||||
obs_property_set_visible(close, enabled);
|
||||
obs_property_set_visible(local_file, enabled);
|
||||
obs_property_set_visible(looping, enabled);
|
||||
obs_property_set_visible(speed, enabled);
|
||||
obs_property_set_visible(seekable, !enabled);
|
||||
|
||||
return true;
|
||||
|
|
@ -93,6 +96,7 @@ static void ffmpeg_source_defaults(obs_data_t *settings)
|
|||
obs_data_set_default_bool(settings, "hw_decode", true);
|
||||
#endif
|
||||
obs_data_set_default_int(settings, "buffering_mb", 2);
|
||||
obs_data_set_default_int(settings, "speed_percent", 100);
|
||||
}
|
||||
|
||||
static const char *media_filter =
|
||||
|
|
@ -171,6 +175,9 @@ static obs_properties_t *ffmpeg_source_getproperties(void *data)
|
|||
obs_property_set_long_description(prop,
|
||||
obs_module_text("CloseFileWhenInactive.ToolTip"));
|
||||
|
||||
obs_properties_add_int_slider(props, "speed_percent",
|
||||
obs_module_text("SpeedPercentage"), 1, 200, 1);
|
||||
|
||||
prop = obs_properties_add_list(props, "color_range",
|
||||
obs_module_text("ColorRange"), OBS_COMBO_TYPE_LIST,
|
||||
OBS_COMBO_FORMAT_INT);
|
||||
|
|
@ -193,6 +200,7 @@ static void dump_source_info(struct ffmpeg_source *s, const char *input,
|
|||
"settings:\n"
|
||||
"\tinput: %s\n"
|
||||
"\tinput_format: %s\n"
|
||||
"\tspeed: %d\n"
|
||||
"\tis_looping: %s\n"
|
||||
"\tis_hw_decoding: %s\n"
|
||||
"\tis_clear_on_media_end: %s\n"
|
||||
|
|
@ -200,6 +208,7 @@ static void dump_source_info(struct ffmpeg_source *s, const char *input,
|
|||
"\tclose_when_inactive: %s",
|
||||
input ? input : "(null)",
|
||||
input_format ? input_format : "(null)",
|
||||
s->speed_percent,
|
||||
s->is_looping ? "yes" : "no",
|
||||
s->is_hw_decoding ? "yes" : "no",
|
||||
s->is_clear_on_media_end ? "yes" : "no",
|
||||
|
|
@ -241,15 +250,24 @@ static void media_stopped(void *opaque)
|
|||
|
||||
static void ffmpeg_source_open(struct ffmpeg_source *s)
|
||||
{
|
||||
if (s->input && *s->input)
|
||||
s->media_valid = mp_media_init(&s->media,
|
||||
s->input, s->input_format,
|
||||
s->buffering_mb * 1024 * 1024,
|
||||
s, get_frame, get_audio, media_stopped,
|
||||
preload_frame,
|
||||
s->is_hw_decoding,
|
||||
s->is_local_file || s->seekable,
|
||||
s->range);
|
||||
if (s->input && *s->input) {
|
||||
struct mp_media_info info = {
|
||||
.opaque = s,
|
||||
.v_cb = get_frame,
|
||||
.v_preload_cb = preload_frame,
|
||||
.a_cb = get_audio,
|
||||
.stop_cb = media_stopped,
|
||||
.path = s->input,
|
||||
.format = s->input_format,
|
||||
.buffering = s->buffering_mb * 1024 * 1024,
|
||||
.speed = s->speed_percent,
|
||||
.force_range = s->range,
|
||||
.hardware_decoding = s->is_hw_decoding,
|
||||
.is_local_file = s->is_local_file || s->seekable
|
||||
};
|
||||
|
||||
s->media_valid = mp_media_init(&s->media, &info);
|
||||
}
|
||||
}
|
||||
|
||||
static void ffmpeg_source_tick(void *data, float seconds)
|
||||
|
|
@ -320,9 +338,13 @@ static void ffmpeg_source_update(void *data, obs_data_t *settings)
|
|||
s->range = (enum video_range_type)obs_data_get_int(settings,
|
||||
"color_range");
|
||||
s->buffering_mb = (int)obs_data_get_int(settings, "buffering_mb");
|
||||
s->speed_percent = (int)obs_data_get_int(settings, "speed_percent");
|
||||
s->is_local_file = is_local_file;
|
||||
s->seekable = obs_data_get_bool(settings, "seekable");
|
||||
|
||||
if (s->speed_percent < 1 || s->speed_percent > 200)
|
||||
s->speed_percent = 100;
|
||||
|
||||
if (s->media_valid) {
|
||||
mp_media_free(&s->media);
|
||||
s->media_valid = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue