Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ad -F+i option to allow setting ffmpeg options that apply to input only. #8397

Merged
merged 5 commits into from
Mar 8, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Ad -F+i option to allow setting ffmpeg options that apply to input only.
  • Loading branch information
joa-quim committed Mar 6, 2024
commit 8c4deacf7df6b55354aee1ab043cdaf8a9defe58
14 changes: 11 additions & 3 deletions src/movie.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ struct MOVIE_CTRL {
unsigned int stride;
char *format[MOVIE_N_FORMATS];
char *options[MOVIE_N_FORMATS];
char *i_options[MOVIE_N_FORMATS];
} F;
struct MOVIE_G { /* -G<canvasfill>[+p<pen>] */
bool active;
Expand Down Expand Up @@ -700,7 +701,7 @@ static int parse (struct GMT_CTRL *GMT, struct MOVIE_CTRL *Ctrl, struct GMT_OPTI
int n;
bool do_view = false;
char txt_a[GMT_LEN32] = {""}, txt_b[GMT_LEN32] = {""}, arg[GMT_LEN64] = {""}, p[GMT_LEN256] = {""};
char *c = NULL, *s = NULL, *o = NULL, string[GMT_LEN128] = {""};
char *c = NULL, *s = NULL, *o = NULL, *io = NULL, string[GMT_LEN128] = {""};
double width = 24.0, height16x9 = 13.5, height4x3 = 18.0, dpu = 160.0; /* SI values for dimensions and dpu */
struct GMT_FILL fill; /* Only used to make sure any fill is given with correct syntax */
struct GMT_PEN pen; /* Only used to make sure any pen is given with correct syntax */
Expand Down Expand Up @@ -897,14 +898,17 @@ static int parse (struct GMT_CTRL *GMT, struct MOVIE_CTRL *Ctrl, struct GMT_OPTI
do_view = false;
pos = 0; /* Reset to start of new word */
o = NULL;
while (gmt_getmodopt (GMT, 'F', c, "lostv", &pos, p, &n_errors) && n_errors == 0) {
while (gmt_getmodopt (GMT, 'F', c, "liostv", &pos, p, &n_errors) && n_errors == 0) {
switch (p[0]) {
case 'l': /* Specify loops for GIF */
Ctrl->F.loop = true;
Ctrl->F.loops = (p[1]) ? atoi (&p[1]) : 0;
break;
case 'i': /* FFmpeg option for input to pass along */
io = strdup(&p[1]); /* Retain start of encoding options for input for later */
break;
case 'o': /* FFmpeg option to pass along */
o = strdup (&p[1]); /* Retain start of encoding options for later */
o = strdup(&p[1]); /* Retain start of encoding options for later */
break;
case 's': /* Specify GIF stride, 2,5,10,20,50,100,200,500 etc. */
Ctrl->F.skip = true;
Expand Down Expand Up @@ -968,6 +972,10 @@ static int parse (struct GMT_CTRL *GMT, struct MOVIE_CTRL *Ctrl, struct GMT_OPTI
if (Ctrl->F.options[k]) gmt_M_str_free (Ctrl->F.options[k]); /* Free old setting first */
Ctrl->F.options[k] = o;
}
if (io) { /* Gave specific encoding options */
if (Ctrl->F.i_options[k]) gmt_M_str_free(Ctrl->F.i_options[k]); /* Free old setting first */
Ctrl->F.i_options[k] = io;
}
}
if (c) c[0] = '+'; /* Now we can restore the optional text we chopped off */
break;
Expand Down
Loading