Re: [Mlt-devel] Debugging MLT Questions
Brought to you by:
ddennedy,
lilo_booter
From: Jonathan T. <jon...@gm...> - 2010-12-23 07:25:16
|
Awesome! That will save me some time. =) I just tested the function, and it works great. -Jonathan On Thu, Dec 23, 2010 at 1:03 AM, Dan Dennedy <da...@de...> wrote: > On Wed, Dec 22, 2010 at 10:22 PM, Dan Dennedy <da...@de...> wrote: > > On Wed, Dec 22, 2010 at 8:25 PM, Jonathan Thomas > > <jon...@gm...> 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 ); > } > } > |