]> git.sesse.net Git - mlt/commitdiff
Merge pull request #37 from jliljebl/luma-lift-gain-gamma
authorDan Dennedy <dan@dennedy.org>
Wed, 26 Feb 2014 04:48:40 +0000 (20:48 -0800)
committerDan Dennedy <dan@dennedy.org>
Wed, 26 Feb 2014 04:48:40 +0000 (20:48 -0800)
Add lumaliftgaingamma filter to plusgpl

presets/filter/movit.opacity/fade_in [new file with mode: 0644]
presets/filter/movit.opacity/fade_in_out [new file with mode: 0644]
presets/filter/movit.opacity/fade_out [new file with mode: 0644]
src/modules/opengl/filter_movit_opacity.cpp
src/modules/opengl/filter_movit_opacity.yml

diff --git a/presets/filter/movit.opacity/fade_in b/presets/filter/movit.opacity/fade_in
new file mode 100644 (file)
index 0000000..6637bd3
--- /dev/null
@@ -0,0 +1,2 @@
+opacity=0=0;:2.0=1.0
+alpha=1
diff --git a/presets/filter/movit.opacity/fade_in_out b/presets/filter/movit.opacity/fade_in_out
new file mode 100644 (file)
index 0000000..bc5b7d6
--- /dev/null
@@ -0,0 +1,2 @@
+opacity=0=0;:2.0=1.0; :-2.0=1.0; -1=0
+alpha=1
diff --git a/presets/filter/movit.opacity/fade_out b/presets/filter/movit.opacity/fade_out
new file mode 100644 (file)
index 0000000..aed8cab
--- /dev/null
@@ -0,0 +1,2 @@
+opacity=:-2.0=1.0; -1=0
+alpha=1
index 300145c2b731a52897ae1c0e6b30a578295db730..eac2975778a681d028941234a242875110f969a6 100644 (file)
@@ -34,10 +34,11 @@ static int get_image( mlt_frame frame, uint8_t **image, mlt_image_format *format
        mlt_position position = mlt_filter_get_position( filter, frame );
        mlt_position length = mlt_filter_get_length2( filter, frame );
        double opacity = mlt_properties_anim_get_double( properties, "opacity", position, length );
+       double alpha = mlt_properties_anim_get_double( properties, "alpha", position, length );
        mlt_properties_set_double( properties, "movit.parms.vec4.factor[0]", opacity );
        mlt_properties_set_double( properties, "movit.parms.vec4.factor[1]", opacity );
        mlt_properties_set_double( properties, "movit.parms.vec4.factor[2]", opacity );
-       mlt_properties_set_double( properties, "movit.parms.vec4.factor[3]", opacity );
+       mlt_properties_set_double( properties, "movit.parms.vec4.factor[3]", alpha >= 0 ? alpha : opacity );
        GlslManager::get_instance()->unlock_service( frame );
        *format = mlt_image_glsl;
        int error = mlt_frame_get_image( frame, image, format, width, height, writable );
@@ -64,6 +65,7 @@ mlt_filter filter_movit_opacity_init( mlt_profile profile, mlt_service_type type
                mlt_properties properties = MLT_FILTER_PROPERTIES( filter );
                glsl->add_ref( properties );
                mlt_properties_set( properties, "opacity", arg? arg : "1" );
+               mlt_properties_set_double( properties, "alpha", -1.0 );
                filter->process = process;
        }
        return filter;
index cf4d1d65dac2107114ede725c6ffd7c6080bf0cb..264ce321780d1168859900a5676936b2bb566710 100644 (file)
@@ -15,6 +15,7 @@ notes: >
   the other video. If the video this is applied to already has an alpha channel,
   then this preserves that by multiplying the opacity level with the alpha channel.
   This filter is especially handy when used in conjunction with movit.overlay.
+  You can also use this to fade a clip from and to black.
 
 parameters:
   - identifier: opacity
@@ -24,3 +25,16 @@ parameters:
     maximum: 1
     default: 1
     mutable: yes
+
+  - identifier: alpha
+    title: Alpha
+    description: >
+      When this is less than zero, the alpha component of the Movit mutliply
+      effect follows opacity. Otherwise, you can set this to another value to
+      control the alpha component independently. If you set this to 1, then
+      the opacity parameter can be used to fade to and from black.
+    type: float
+    minimum: -1
+    maximum: 1
+    default: -1
+    mutable: yes