LUMIERA.clone/tests/plugin/plugin_main.c

70 lines
1.9 KiB
C
Raw Normal View History

2007-08-19 05:53:43 +02:00
#include <string.h>
2007-07-17 20:42:07 +02:00
#include "lib/plugin.h"
2007-07-17 20:42:07 +02:00
#include "hello_interface.h"
int
main(int argc, char** argv)
{
2007-08-14 04:56:55 +02:00
NOBUG_INIT;
2007-08-18 05:05:58 +02:00
2007-08-19 05:53:43 +02:00
if (argc < 2)
return -1;
2007-08-18 05:05:58 +02:00
cinelerra_init_plugin ();
2007-07-17 20:42:07 +02:00
/*
we have a plugin 'hello_1' which provides us 2 hello interfaces, one for english and one for german output,
open both try them, close them.
*/
TODO("macros, doing casting and typing");
2007-08-19 05:53:43 +02:00
if( !strcmp(argv[1],"C"))
{
CINELERRA_INTERFACE_TYPE(hello, 1)* hello_de =
(CINELERRA_INTERFACE_TYPE(hello, 1)*) cinelerra_interface_open ("example_plugin", "german_1", sizeof(CINELERRA_INTERFACE_TYPE(hello, 1)));
2007-08-19 05:53:43 +02:00
if (!hello_de) CINELERRA_DIE;
2007-07-17 20:42:07 +02:00
2007-08-19 05:53:43 +02:00
hello_de->hello();
hello_de->goodbye(argv[1]);
2007-08-19 05:53:43 +02:00
CINELERRA_INTERFACE_TYPE(hello, 1)* hello_en =
(CINELERRA_INTERFACE_TYPE(hello, 1)*) cinelerra_interface_open ("example_plugin", "english_1", sizeof(CINELERRA_INTERFACE_TYPE(hello, 1)));
2007-08-19 05:53:43 +02:00
if (!hello_en) CINELERRA_DIE;
2007-08-19 05:53:43 +02:00
hello_en->hello();
hello_en->goodbye(argv[1]);
2007-08-18 05:05:58 +02:00
2007-08-19 05:53:43 +02:00
cinelerra_interface_close (hello_en);
cinelerra_interface_close (hello_de);
}
2007-08-19 05:53:43 +02:00
if( !strcmp(argv[1],"C++"))
{
2007-08-20 03:22:56 +02:00
/* same again for a plugin written in C++ */
CINELERRA_INTERFACE_TYPE(hello, 1)* hello_de =
(CINELERRA_INTERFACE_TYPE(hello, 1)*) cinelerra_interface_open ("example_plugin_cpp", "german_1", sizeof(CINELERRA_INTERFACE_TYPE(hello, 1)));
2007-07-17 20:42:07 +02:00
2007-08-20 03:22:56 +02:00
if (!hello_de) CINELERRA_DIE;
hello_de->hello();
hello_de->goodbye(argv[1]);
2007-08-20 03:22:56 +02:00
CINELERRA_INTERFACE_TYPE(hello, 1)* hello_en =
(CINELERRA_INTERFACE_TYPE(hello, 1)*) cinelerra_interface_open ("example_plugin_cpp", "english_1", sizeof(CINELERRA_INTERFACE_TYPE(hello, 1)));
2007-08-20 03:22:56 +02:00
if (!hello_en) CINELERRA_DIE;
2007-08-20 03:22:56 +02:00
hello_en->hello();
hello_en->goodbye(argv[1]);
2007-07-17 20:42:07 +02:00
2007-08-20 03:22:56 +02:00
cinelerra_interface_close (hello_en);
cinelerra_interface_close (hello_de);
2007-08-19 05:53:43 +02:00
}
return 0;
2007-07-17 20:42:07 +02:00
}