On Wed, Dec 22, 2010 at 10:22 PM, Dan Dennedy <[email protected]> wrote:
> On Wed, Dec 22, 2010 at 8:25 PM, Jonathan Thomas
> <[email protected]> wrote:
>> Dan,
>> Do you have any code snippets or examples that I can use when debugging MLT
>> to save an image buffer to a file, so I can view what the image looks like
>> at various places inside MLT?  For example, during filter processing (i.e.
>> the affine filter), image buffers are passed around and modified, and
>> debugging this kind of bug is quite tricky without seeing what is happening.
>
> Nothing exists now other than the consumers and carefully constructing
> melt commands. However, ppm is easy to write, and it would be possible
> to add a mlt_frame function to write a frame's image as ppm. You can
> see code for reading ppm in src/modules/core/producer_ppm.c.
>
void mlt_frame_write_ppm( mlt_frame frame )
{
        int width;
        int height;
        mlt_image_format format = mlt_image_rgb24;
        uint8_t *image;
        
        if ( mlt_frame_get_image( frame, &image, &format, &width, &height, 0 ) 
== 0 )
        {
                FILE *file;
                char filename[16];
                
                sprintf( filename, "frame-%05d.ppm", mlt_frame_get_position( 
frame ) );
                file = fopen( filename, "wb" );
                if ( !file )
                        return;
                fprintf( file, "P6\n%d %d\n255\n", width, height);
                fwrite( image, width * height * 3, 1, file );
                fclose( file );
        }
}

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Mlt-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mlt-devel

Reply via email to