All pastes #310699 Raw Edit

Something

public text v1 · immutable
#310699 ·published 2007-01-09 00:28 UTC
rendered paste body
/********** Neuros OSD media test programs **********
Build from an environment where you did source neuros-bsp/neuros-env
arm-linux-gcc -I$PRJROOT/../Neuros-Cooler/include -I$PRJROOT/../Nano-X/src/include -lncooler -lcomnmsc -D BUILD_TARGET_ARM -o nagyz nagyz.c
*/

#include <signal.h>
#include <unistd.h>
#include "generic-nms.h"
#include "client-nms.h"
#include "nmsplugin.h"
#include "widgets.h"
#include "fb.h"
#include "application.h"
#include "linux/fb.h"
#include "rtc.h"

static void signalInit(void);

static void signal_handler(int signum)
{
    exit(0);
}

static
void signalInit(void)
{
    struct sigaction sa;

        memset(&sa, 0, sizeof(sa));
        sa.sa_handler = signal_handler;

    if (sigaction(SIGINT, &sa, NULL)){}
    if (sigaction(SIGTERM, &sa, NULL)){}
    if (sigaction(SIGQUIT, &sa, NULL)){}
}

int IsProbeModulesDone(void)
{
    int fd;
	fd = open("/mnt/tmpfs/modload.tmp", O_RDONLY);
	if (fd <= 0) return 1; // done.
	close(fd); 
	return 0;
}

int main(int argc, char *argv[])
{
    if (argc < 2) { printf("Please pass the full path to a media file as argument\nExiting.\n"); return 1; }
    signalInit();
    if (NmsInit())
    {
        printf("NMS initialization failed!\n");
        return 1;
    }
    NmsStart();
    NmsSetOutputMode(0);
    SetFrameBufferVDMode(0);

    AppCreate();

    printf( "screen_width: %d, screen_height: %d\n", ScreenWidth(), ScreenHeight() );
    FORM *widget = FormNew( 10, 10, 40, 40 );

    widget_prop_t wprop;
    WidgetGetProp( widget, &wprop );
    wprop.bgcolor=NCC_RED;
    wprop.fgcolor=NCC_BLACK;
    WidgetSetProp( widget, &wprop );
    WidgetShow(widget,TRUE);
    WidgetFocus(widget,TRUE);

    if (!IsProbeModulesDone()) { printf("Modules not loaded ?\n"); return -1; }

     NmsStopMonitor();
     NmsSetRepeatmode(0);
     NmsSetPlaymode(0);
     SetFrameBufferMode(fmMonitor);
    NmsPlay(0, argv[1]);
    for(;;){
        sleep(1);
    }

    NmsStopPlay();
   
   AppStart();
   AppStop();
}