X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fframework%2Fmlt_frame.c;h=76afc2208c806fab12a65cf05014a65c46d333ba;hb=d43f0157761584d8ec0143e2afdb50c4ad86b393;hp=2053cc847c7bc6675ae8cb41caaf1bdaa22b1253;hpb=e17f84ca234cdb35fd054f46eed37babc01bfc77;p=mlt diff --git a/src/framework/mlt_frame.c b/src/framework/mlt_frame.c index 2053cc84..76afc220 100644 --- a/src/framework/mlt_frame.c +++ b/src/framework/mlt_frame.c @@ -351,9 +351,6 @@ const char * mlt_image_format_name( mlt_image_format format ) case mlt_image_yuv422: return "yuv422"; case mlt_image_yuv420p: return "yuv420p"; case mlt_image_opengl: return "opengl"; - case mlt_image_rgb24_full: return "rgb24_full"; - case mlt_image_rgb24a_full: return "rgb24a_full"; - case mlt_image_yuv422_709: return "yuv422_709"; } return "invalid"; } @@ -458,7 +455,6 @@ int mlt_frame_get_image( mlt_frame this, uint8_t **buffer, mlt_image_format *for *buffer = NULL; break; case mlt_image_rgb24: - case mlt_image_rgb24_full: size *= 3; size += *width * 3; *buffer = mlt_pool_alloc( size ); @@ -466,7 +462,6 @@ int mlt_frame_get_image( mlt_frame this, uint8_t **buffer, mlt_image_format *for memset( *buffer, 255, size ); break; case mlt_image_rgb24a: - case mlt_image_rgb24a_full: case mlt_image_opengl: size *= 4; size += *width * 4; @@ -835,3 +830,25 @@ int64_t mlt_sample_calculator_to_now( float fps, int frequency, int64_t position return samples; } + +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 ); + } +}