Skip to content
Snippets Groups Projects
Commit 81ec22a1 authored by Tom Greig's avatar Tom Greig
Browse files

Add scale bars and rework UI

There were too many things in the column view.  Input title fonts,
frame rates and scales are now below and pertain to which ever input is
selected.  There are now nice handy ‘copy to all inputs’ buttons so you
don't have to enter the same information six times or whatever.

Also, this fixes a bug where ffmpeg would complain if an input's title
was empty (we just make the title a single space in this case!)

And yeah, scale bars.
parent a7fa0f35
No related branches found
No related tags found
No related merge requests found
...@@ -40,7 +40,10 @@ struct input { ...@@ -40,7 +40,10 @@ struct input {
struct input_source* source; struct input_source* source;
char* title; char* title;
struct font font; struct font title_font;
double scale_length;
char* scale_label;
struct font scale_font;
unsigned int row; unsigned int row;
unsigned int column; unsigned int column;
double frame_rate; double frame_rate;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#define __TIMELAPSE_EDITOR_UTIL_H__ #define __TIMELAPSE_EDITOR_UTIL_H__
struct font { struct font {
const char* font_path; char* font_name;
unsigned int font_size; unsigned int font_size;
unsigned char font_colour[3]; unsigned char font_colour[3];
}; };
......
...@@ -145,23 +145,28 @@ struct input_context* input_context_create( ...@@ -145,23 +145,28 @@ struct input_context* input_context_create(
char* filter_description = strdup( "" ); char* filter_description = strdup( "" );
if ( '\0' != input->title[0] ) { const char* title;
if ( 0 == strlen( input->title ) ) {
title = " ";
} else {
title = input->title;
}
char* title_text; char* title_text;
switch ( input->rate_unit ) { switch ( input->rate_unit ) {
case INPUT_RATE_FPS: case INPUT_RATE_FPS:
title_text = format_title( input->title, title_text = format_title( title,
input->frame_rate, 1 ); input->frame_rate, 1 );
break; break;
case INPUT_RATE_SPF: case INPUT_RATE_SPF:
title_text = format_title( input->title, title_text = format_title( title,
1, input->frame_rate ); 1, input->frame_rate );
break; break;
case INPUT_RATE_MPF: case INPUT_RATE_MPF:
title_text = format_title( input->title, title_text = format_title( title,
1, 60 * input->frame_rate ); 1, 60 * input->frame_rate );
break; break;
...@@ -169,13 +174,31 @@ struct input_context* input_context_create( ...@@ -169,13 +174,31 @@ struct input_context* input_context_create(
filter_description = sappendf( filter_description, filter_description = sappendf( filter_description,
"drawtext=text=%s:fontsize=%d:x=10:y=h-th-10:" "drawtext=text=%s:fontsize=%d:x=10:y=h-th-10:"
"fontcolor=#%02X%02X%02X:fontfile=%s", "fontcolor=#%02X%02X%02X:font=%s",
title_text, input->font.font_size, title_text, input->title_font.font_size,
input->font.font_colour[0], input->font.font_colour[1], input->title_font.font_colour[0],
input->font.font_colour[2], input->font.font_path ); input->title_font.font_colour[1],
input->title_font.font_colour[2],
input->title_font.font_name );
free( title_text ); free( title_text );
if ( 0 < input->scale_length ) {
filter_description = sappendf( filter_description,
",drawbox=t=fill:c=white:x=iw-10-%lf:y=ih-13:w=%lf:h=3",
input->scale_length, input->scale_length );
}
if ( 0 < strlen( input->scale_label ) ) {
filter_description = sappendf( filter_description,
",drawtext=text=%s:fontsize=%d:x=w-10-%lf/2-tw/2:y=h-th-14:"
"fontcolor=#%02X%02X%02X:font=%s",
input->scale_label, input->scale_font.font_size,
input->scale_length,
input->scale_font.font_colour[0],
input->scale_font.font_colour[1],
input->scale_font.font_colour[2],
input->scale_font.font_name );
} }
AVFilterInOut* outputs = avfilter_inout_alloc(); AVFilterInOut* outputs = avfilter_inout_alloc();
......
This diff is collapsed.
...@@ -457,7 +457,7 @@ void* output_all( void* data ) { ...@@ -457,7 +457,7 @@ void* output_all( void* data ) {
config->title_font.font_colour[0], config->title_font.font_colour[0],
config->title_font.font_colour[1], config->title_font.font_colour[1],
config->title_font.font_colour[2], config->title_font.font_colour[2],
config->title_font.font_path ); config->title_font.font_name );
free( title_text ); free( title_text );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment