11/*
22 * filter_strobe.c -- simple strobing filter
33 * Copyright (C) 2020 Martin Sandsmark <martin.sandsmark@kde.org>
4+ * Copyright (C) 2025 Meltytech, LLC
45 *
56 * This library is free software; you can redistribute it and/or
67 * modify it under the terms of the GNU Lesser General Public
2021#include <framework/mlt_factory.h>
2122#include <framework/mlt_filter.h>
2223#include <framework/mlt_frame.h>
24+ #include <framework/mlt_log.h>
2325#include <framework/mlt_producer.h>
2426#include <framework/mlt_property.h>
2527#include <framework/mlt_service.h>
@@ -54,7 +56,8 @@ static int filter_get_image(mlt_frame frame,
5456 return mlt_frame_get_image (frame , image , format , width , height , 0 );
5557 }
5658
57- * format = mlt_image_rgba ;
59+ if (* format == mlt_image_movit || * format == mlt_image_opengl_texture )
60+ * format = mlt_image_rgba ;
5861 int error = mlt_frame_get_image (frame , image , format , width , height , 1 );
5962 if (error ) {
6063 return error ;
@@ -71,6 +74,26 @@ static int filter_get_image(mlt_frame frame,
7174 }
7275 // Clear any alpha buffer that may be attached to the frame
7376 mlt_frame_set_alpha (frame , NULL , 0 , NULL );
77+ } else if (* format == mlt_image_rgba64 ) {
78+ uint16_t * p = (uint16_t * ) * image ;
79+ for (size_t i = 0 ; i < pixelCount ; i ++ ) {
80+ p [3 ] = 0 ;
81+ p += 4 ;
82+ }
83+ // Clear any alpha buffer that may be attached to the frame
84+ mlt_frame_set_alpha (frame , NULL , 0 , NULL );
85+ } else {
86+ int size = 0 ;
87+ uint8_t * a = mlt_frame_get_alpha_size (frame , & size );
88+ if (!a || size < pixelCount ) {
89+ a = mlt_pool_alloc (pixelCount );
90+ if (!a ) {
91+ mlt_log_error (MLT_FILTER_SERVICE (filter ), "Unable to allocate alpha\n" );
92+ return 1 ;
93+ }
94+ mlt_frame_set_alpha (frame , a , pixelCount , NULL );
95+ }
96+ memset (a , 0 , pixelCount );
7497 }
7598
7699 return 0 ;
0 commit comments