⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 start.c

📁 codec engine中的视频操作界面的历程
💻 C
字号:
/* * start.c * * ============================================================================ * Copyright (c) Texas Instruments Inc 2005 * * Use of this software is controlled by the terms and conditions found in the * license agreement under which this software has been supplied or provided. * ============================================================================ *//* Standard Linux headers */#include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>/* Davinci EVM utility libraries */#include <msp430lib.h>#include <simplewidget.h>/* Application header file */#include "interface.h"#define START_PICTURE_NTSC  "data/pics/startup_ntsc.png"#define START_PICTURE_PAL   "data/pics/startup_pal.png"enum InitLevels {    CREATEDINTERFACE = 1,    MSP430LIBINITIALIZED};static simplewidget_screen  simpleScreen = NULL;static simplewidget_png startImg         = NULL;/****************************************************************************** * uiCreate ******************************************************************************/static int uiCreate(void){    /* Initialize the screens on which to draw widgets */    if (simplewidget_screen_init(getDisplay(), SCREEN_WIDTH,                                 SCREEN_HEIGHT, &simpleScreen) == -1) {        ERR("Failed to initialize simplewidget screen\n");        return FAILURE;    }    if (getYFactor() == NTSC) {        /* Create the images for the buttons at the bottom of the screen */        if (simplewidget_png_create(START_PICTURE_NTSC, &startImg) == -1) {            ERR("Failed to create png image\n");            return FAILURE;        }    }    else {        /* Create the images for the buttons at the bottom of the screen */        if (simplewidget_png_create(START_PICTURE_PAL, &startImg) == -1) {            ERR("Failed to create png image\n");            return FAILURE;        }    }    return SUCCESS;}/****************************************************************************** * uiDraw ******************************************************************************/static int uiDraw(void){    /* Clear the OSD window */    simplewidget_screen_clear(simpleScreen, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);    if (simplewidget_png_show(startImg, simpleScreen, 0, 0) == -1) {        ERR("Failed to show png image\n");        return FAILURE;    }    return SUCCESS;}/****************************************************************************** * uiDelete ******************************************************************************/static int uiDelete(void){    if (startImg) {        simplewidget_png_delete(startImg);    }    if (simpleScreen) {        simplewidget_screen_exit(simpleScreen);    }    return SUCCESS;}/****************************************************************************** * keyAction ******************************************************************************/static int keyAction(enum msp430lib_keycode key, DemoEnv *envp, int *quitPtr){    switch(key) {        case MSP430LIB_KEYCODE_PLAY:            *quitPtr = TRUE;            break;        case MSP430LIB_KEYCODE_STOP:            *quitPtr = NOSELECTION;            break;        default:            DBG("Unknown button pressed.\n");    }    return SUCCESS;}/****************************************************************************** * interfaceFxn ******************************************************************************/int startupFxn(DemoEnv *envp){    enum InitLevels        initLevel = 0;    int                    status    = SUCCESS;    int                    quit      = 0;    enum msp430lib_keycode key;    if (uiCreate() == FAILURE) {        CLEANUP(FAILURE);    }    initLevel = CREATEDINTERFACE;    if (setOsdTransparency(0x77) == FAILURE) {        CLEANUP(FAILURE);    }    if (uiDraw() == FAILURE) {        CLEANUP(FAILURE);    }    if (msp430lib_init() == MSP430LIB_FAILURE) {        ERR("Failed to initialize msp430lib.\n");        CLEANUP(FAILURE);    }    initLevel = MSP430LIBINITIALIZED;    while (!quit) {        /* See if an IR remote key has been pressed */        if (msp430lib_get_ir_key(&key) == MSP430LIB_FAILURE) {            ERR("Failed to get IR value.\n");        }        DBG("Got IR key %#x from the MSP430\n", key);        /* If an IR key had been pressed, service it */        if (key != 0) {            if (keyAction(key, envp, &quit) == FAILURE) {                BREAK_LOOP(FAILURE);            }        }        usleep(500000);    }    if (quit == NOSELECTION) {        status = NOSELECTION;    }cleanup:    if (initLevel >= MSP430LIBINITIALIZED) {        msp430lib_exit();    }    if (initLevel >= CREATEDINTERFACE) {        uiDelete();    }    return status;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -