Imported Upstream version 0.14.2+dfsg1

This commit is contained in:
Sebastian Ramacher 2016-05-24 21:53:01 +02:00
parent fb3990e9e5
commit 41a01dbf05
529 changed files with 25112 additions and 2336 deletions

View file

@ -49,6 +49,7 @@ struct ffmpeg_source {
char *input;
char *input_format;
enum AVDiscard frame_drop;
enum video_range_type range;
int audio_buffer_size;
int video_buffer_size;
bool is_advanced;
@ -81,6 +82,9 @@ static bool set_obs_frame_colorprops(struct ff_frame *frame,
obs_frame->full_range =
frame->frame->color_range == AVCOL_RANGE_JPEG;
if (s->range != VIDEO_RANGE_DEFAULT)
obs_frame->full_range = s->range == VIDEO_RANGE_FULL;
range = obs_frame->full_range ? VIDEO_RANGE_FULL : VIDEO_RANGE_PARTIAL;
if (!video_format_get_parameters(obs_cs,
@ -265,7 +269,7 @@ static bool audio_frame(struct ff_frame *frame, void *opaque)
uint64_t pts;
// Media ended
if (frame == NULL)
if (frame == NULL || frame->frame == NULL)
return true;
pts = (uint64_t)(frame->pts * 1000000000.0L);
@ -316,10 +320,12 @@ static bool is_advanced_modified(obs_properties_t *props,
obs_property_t *abuf = obs_properties_get(props, "audio_buffer_size");
obs_property_t *vbuf = obs_properties_get(props, "video_buffer_size");
obs_property_t *frame_drop = obs_properties_get(props, "frame_drop");
obs_property_t *color_range = obs_properties_get(props, "color_range");
obs_property_set_visible(fscale, enabled);
obs_property_set_visible(abuf, enabled);
obs_property_set_visible(vbuf, enabled);
obs_property_set_visible(frame_drop, enabled);
obs_property_set_visible(color_range, enabled);
return true;
}
@ -345,7 +351,9 @@ static const char *audio_filter =
static obs_properties_t *ffmpeg_source_getproperties(void *data)
{
struct ffmpeg_source *s = data;
struct dstr filter = {0};
struct dstr path = {0};
UNUSED_PARAMETER(data);
obs_properties_t *props = obs_properties_create();
@ -368,10 +376,21 @@ static obs_properties_t *ffmpeg_source_getproperties(void *data)
dstr_cat(&filter, obs_module_text("MediaFileFilter.AllFiles"));
dstr_cat(&filter, " (*.*)");
if (s && s->input && *s->input) {
const char *slash;
dstr_copy(&path, s->input);
dstr_replace(&path, "\\", "/");
slash = strrchr(path.array, '/');
if (slash)
dstr_resize(&path, slash - path.array + 1);
}
obs_properties_add_path(props, "local_file",
obs_module_text("LocalFile"), OBS_PATH_FILE,
filter.array, NULL);
filter.array, path.array);
dstr_free(&filter);
dstr_free(&path);
obs_properties_add_bool(props, "looping", obs_module_text("Looping"));
@ -431,6 +450,18 @@ static obs_properties_t *ffmpeg_source_getproperties(void *data)
obs_property_set_visible(prop, false);
prop = obs_properties_add_list(props, "color_range",
obs_module_text("ColorRange"), OBS_COMBO_TYPE_LIST,
OBS_COMBO_FORMAT_INT);
obs_property_list_add_int(prop, obs_module_text("ColorRange.Auto"),
VIDEO_RANGE_DEFAULT);
obs_property_list_add_int(prop, obs_module_text("ColorRange.Partial"),
VIDEO_RANGE_PARTIAL);
obs_property_list_add_int(prop, obs_module_text("ColorRange.Full"),
VIDEO_RANGE_FULL);
obs_property_set_visible(prop, false);
return props;
}
@ -547,6 +578,7 @@ static void ffmpeg_source_update(void *data, obs_data_t *settings)
s->restart_on_activate = obs_data_get_bool(settings,
"restart_on_activate");
s->is_forcing_scale = true;
s->range = VIDEO_RANGE_DEFAULT;
if (is_advanced) {
s->audio_buffer_size = (int)obs_data_get_int(settings,
@ -557,6 +589,8 @@ static void ffmpeg_source_update(void *data, obs_data_t *settings)
"frame_drop");
s->is_forcing_scale = obs_data_get_bool(settings,
"force_scale");
s->range = (enum video_range_type)obs_data_get_int(settings,
"color_range");
if (s->audio_buffer_size < 1) {
s->audio_buffer_size = 1;