You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
avfilter/vf_v360: add reset_rot option
This commit is contained in:
@@ -21612,6 +21612,9 @@ Set if output video needs to be transposed. Boolean value, by default disabled.
|
|||||||
|
|
||||||
@item alpha_mask
|
@item alpha_mask
|
||||||
Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
|
Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
|
||||||
|
|
||||||
|
@item reset_rot
|
||||||
|
Reset rotation of output video. Boolean value, by default disabled.
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@subsection Examples
|
@subsection Examples
|
||||||
|
@@ -122,6 +122,7 @@ typedef struct V360Context {
|
|||||||
int in, out;
|
int in, out;
|
||||||
int interp;
|
int interp;
|
||||||
int alpha;
|
int alpha;
|
||||||
|
int reset_rot;
|
||||||
int width, height;
|
int width, height;
|
||||||
char *in_forder;
|
char *in_forder;
|
||||||
char *out_forder;
|
char *out_forder;
|
||||||
|
@@ -164,6 +164,7 @@ static const AVOption v360_options[] = {
|
|||||||
{ "iv_fov", "input vertical field of view", OFFSET(iv_fov), AV_OPT_TYPE_FLOAT, {.dbl=0.f}, 0.f, 360.f,TFLAGS, "iv_fov"},
|
{ "iv_fov", "input vertical field of view", OFFSET(iv_fov), AV_OPT_TYPE_FLOAT, {.dbl=0.f}, 0.f, 360.f,TFLAGS, "iv_fov"},
|
||||||
{ "id_fov", "input diagonal field of view", OFFSET(id_fov), AV_OPT_TYPE_FLOAT, {.dbl=0.f}, 0.f, 360.f,TFLAGS, "id_fov"},
|
{ "id_fov", "input diagonal field of view", OFFSET(id_fov), AV_OPT_TYPE_FLOAT, {.dbl=0.f}, 0.f, 360.f,TFLAGS, "id_fov"},
|
||||||
{"alpha_mask", "build mask in alpha plane", OFFSET(alpha), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS, "alpha"},
|
{"alpha_mask", "build mask in alpha plane", OFFSET(alpha), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS, "alpha"},
|
||||||
|
{ "reset_rot", "reset rotation", OFFSET(reset_rot), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1,TFLAGS, "reset_rot"},
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -4948,6 +4949,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
|||||||
return ff_filter_frame(outlink, out);
|
return ff_filter_frame(outlink, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void reset_rot(V360Context *s)
|
||||||
|
{
|
||||||
|
s->rot_quaternion[0][0] = 1.f;
|
||||||
|
s->rot_quaternion[0][1] = s->rot_quaternion[0][2] = s->rot_quaternion[0][3] = 0.f;
|
||||||
|
}
|
||||||
|
|
||||||
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
|
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
|
||||||
char *res, int res_len, int flags)
|
char *res, int res_len, int flags)
|
||||||
{
|
{
|
||||||
@@ -4955,11 +4962,15 @@ static int process_command(AVFilterContext *ctx, const char *cmd, const char *ar
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
s->yaw = s->pitch = s->roll = 0.f;
|
s->yaw = s->pitch = s->roll = 0.f;
|
||||||
|
s->reset_rot = 0;
|
||||||
|
|
||||||
ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags);
|
ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
if (s->reset_rot)
|
||||||
|
reset_rot(s);
|
||||||
|
|
||||||
return config_output(ctx->outputs[0]);
|
return config_output(ctx->outputs[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4967,8 +4978,7 @@ static av_cold int init(AVFilterContext *ctx)
|
|||||||
{
|
{
|
||||||
V360Context *s = ctx->priv;
|
V360Context *s = ctx->priv;
|
||||||
|
|
||||||
s->rot_quaternion[0][0] = 1.f;
|
reset_rot(s);
|
||||||
s->rot_quaternion[0][1] = s->rot_quaternion[0][2] = s->rot_quaternion[0][3] = 0.f;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user