X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmelted%2Fmelted_commands.c;fp=src%2Fmelted%2Fmelted_commands.c;h=45dc0d04ee5945f92f99df581f4dac165e8500cb;hb=0bce140200382aca7fe8757544233158b9d2f4c7;hp=c865a3de956684e4713bc0677f54cd6f9b694a35;hpb=50494c72c7b8b700cf4df4c1f25ae1b5323e4df2;p=melted diff --git a/src/melted/melted_commands.c b/src/melted/melted_commands.c index c865a3d..45dc0d0 100644 --- a/src/melted/melted_commands.c +++ b/src/melted/melted_commands.c @@ -184,6 +184,42 @@ response_codes melted_list_clips( command_argument cmd_arg ) return error; } +/** Probe open clip. +*/ +response_codes melted_probe_clip( command_argument cmd_arg ) +{ + int l; + const char *file_name = (const char*) cmd_arg->argument; + char fullname[1024]; + mlt_producer producer; + mlt_profile profile; + + snprintf( fullname, sizeof(fullname), "%s%s", cmd_arg->root_dir, file_name ); + profile = mlt_profile_init(NULL); + producer = mlt_factory_producer( profile, NULL, fullname ); + if (!producer ) + { + mlt_profile_close(profile); + return RESPONSE_BAD_FILE; + }; + + l = mlt_producer_get_length( producer ); + mvcp_response_printf( cmd_arg->response, 10240, + "%d \"%s\" %d %d %d %d %.2f\n\n", + 0, /* index */ + cmd_arg->argument, /* title */ + 0, /* frame in */ + l - 1, /* frame out */ + l, /* frame count */ + l, /* length */ + mlt_producer_get_fps( producer ) ); + + mlt_producer_close( producer ); + mlt_profile_close(profile); + + return RESPONSE_SUCCESS_N; +} + /** Set a server configuration property. */