Code Search for Developers
 
 
  

subdisp.c from The Open2x Project at Krugle


Show subdisp.c syntax highlighted

/*
 *  - godori <ghcstop>, www.aesop-embedded.org
 *
 *    => Created. Jan, 2005
 */

#include <SDL.h>
#include "gvlib_export.h"


#include "subreader.h"
#include "fbdisp/gfxdev.h"
#include "fbdisp/fbs.h"
#include "subdisp.h"


extern subtitle *vo_sub;
extern int      subtitle_changed;

extern int g_FBStatus;

void framebuffer_on(int fbnum)
{
    int             err;
    Msgdummy        dummymsg,
                   *pdmsg;

    if (fbnum == 0)
    {

        memset((char *) &dummymsg, 0x00, sizeof(Msgdummy));
        pdmsg = &dummymsg;
        MSG(pdmsg) = MMSP2_FB_RGB_ON;
        LEN(pdmsg) = 0;
        if ((err = ioctl(SDL_videofd, FBMMSP2CTRL, pdmsg) < 0))
        {
            printf("FBMMSP2CTRL error\n");
        }
        printf("1 FBMMSP2CTRL rt msg = %d, size = %d\n", MSG(pdmsg), LEN(pdmsg));

        g_FBStatus = 0x01;
    }
    else if (fbnum == 1)
    {

        memset((char *) &dummymsg, 0x00, sizeof(Msgdummy));
        pdmsg = &dummymsg;
        MSG(pdmsg) = MMSP2_FB_RGB_ON;
        LEN(pdmsg) = 0;
        if ((err = ioctl(psd->fbfd, FBMMSP2CTRL, pdmsg) < 0))
        {
            printf("FBMMSP2CTRL error\n");
        }
        printf("1 FBMMSP2CTRL rt msg = %d, size = %d\n", MSG(pdmsg), LEN(pdmsg));





	    memset((char *) &dummymsg, 0x00, sizeof(Msgdummy));
	    pdmsg = &dummymsg;
	    MSG(pdmsg) = MMSP2_FB_RGB_COLOR_KEY;
	    LEN(pdmsg) = 0;
	    if ((err = ioctl(psd->fbfd, FBMMSP2CTRL, pdmsg) < 0))
	    {
	        printf("MMSP2_FB_RGB_COLOR_KEY error\n");
	    }
	    printf("1 FBMMSP2CTRL rt msg = %d, size = %d\n", MSG(pdmsg), LEN(pdmsg));



	    gfx_draw_sized_rect(psd, 0, 0, psd->planew, psd->planeh, RGB2PIXEL(0xCC,0xCC,0xCC));


        g_FBStatus = 0x02;
    }
    else
        printf("invalid fbnum\n");
}

void framebuffer_off(int fbnum)
{
    int             err;
    Msgdummy        dummymsg,
                   *pdmsg;

    if (fbnum == 0)
    {

        memset((char *) &dummymsg, 0x00, sizeof(Msgdummy));
        pdmsg = &dummymsg;
        MSG(pdmsg) = MMSP2_FB_RGB_OFF;
        LEN(pdmsg) = 0;
        if ((err = ioctl(SDL_videofd, FBMMSP2CTRL, pdmsg) < 0))
        {
            printf("FBMMSP2CTRL error\n");
        }
        printf("0 FBMMSP2CTRL rt msg = %d, size = %d\n", MSG(pdmsg), LEN(pdmsg));

        g_FBStatus &= ~0x01;
    }
    else if (fbnum == 1)
    {

        memset((char *) &dummymsg, 0x00, sizeof(Msgdummy));
        pdmsg = &dummymsg;
        MSG(pdmsg) = MMSP2_FB_RGB_OFF;
        LEN(pdmsg) = 0;
        if ((err = ioctl(psd->fbfd, FBMMSP2CTRL, pdmsg) < 0))
        {
            printf("FBMMSP2CTRL error\n");
        }
        printf("0 FBMMSP2CTRL rt msg = %d, size = %d\n", MSG(pdmsg), LEN(pdmsg));

        g_FBStatus &= ~0x02;
    }
    else
        printf("invalid fbnum\n");
}

int switch_fb0_to_fb1(void)
{
    int             err;
    Msgdummy        dummymsg,
                   *pdmsg;


    memset((char *) &dummymsg, 0x00, sizeof(Msgdummy));
    pdmsg = &dummymsg;
    MSG(pdmsg) = MMSP2_FB_RGB_OFF;
    LEN(pdmsg) = 0;
    if ((err = ioctl(SDL_videofd, FBMMSP2CTRL, pdmsg) < 0))
    {
        printf("FBMMSP2CTRL error\n");
    }
    printf("0 FBMMSP2CTRL rt msg = %d, size = %d\n", MSG(pdmsg), LEN(pdmsg));


    memset((char *) &dummymsg, 0x00, sizeof(Msgdummy));
    pdmsg = &dummymsg;
    MSG(pdmsg) = MMSP2_FB_RGB_ON;
    LEN(pdmsg) = 0;
    if ((err = ioctl(psd->fbfd, FBMMSP2CTRL, pdmsg) < 0))
    {
        printf("FBMMSP2CTRL error\n");
    }
    printf("1 FBMMSP2CTRL rt msg = %d, size = %d\n", MSG(pdmsg), LEN(pdmsg));





    memset((char *) &dummymsg, 0x00, sizeof(Msgdummy));
    pdmsg = &dummymsg;
    MSG(pdmsg) = MMSP2_FB_RGB_COLOR_KEY;
    LEN(pdmsg) = 0;
    if ((err = ioctl(psd->fbfd, FBMMSP2CTRL, pdmsg) < 0))
    {
        printf("MMSP2_FB_RGB_COLOR_KEY error\n");
    }
    printf("1 FBMMSP2CTRL rt msg = %d, size = %d\n", MSG(pdmsg), LEN(pdmsg));



    gfx_draw_sized_rect(psd, 0, 0, psd->planew, psd->planeh, RGB2PIXEL(0xCC,0xCC,0xCC));


	g_FBStatus = 0x02;
}

int switch_fb1_to_fb0(void)
{
    int             err;
    Msgdummy        dummymsg,
                   *pdmsg;


    memset((char *) &dummymsg, 0x00, sizeof(Msgdummy));
    pdmsg = &dummymsg;
    MSG(pdmsg) = MMSP2_FB_RGB_ON;
    LEN(pdmsg) = 0;
    if ((err = ioctl(SDL_videofd, FBMMSP2CTRL, pdmsg) < 0))
    {
        printf("FBMMSP2CTRL error\n");
    }
    printf("0 FBMMSP2CTRL rt msg = %d, size = %d\n", MSG(pdmsg), LEN(pdmsg));


    memset((char *) &dummymsg, 0x00, sizeof(Msgdummy));
    pdmsg = &dummymsg;
    MSG(pdmsg) = MMSP2_FB_RGB_OFF;
    LEN(pdmsg) = 0;
    if ((err = ioctl(psd->fbfd, FBMMSP2CTRL, pdmsg) < 0))
    {
        printf("FBMMSP2CTRL error\n");
    }
    printf("1 FBMMSP2CTRL rt msg = %d, size = %d\n", MSG(pdmsg), LEN(pdmsg));

	g_FBStatus = 0x01;
}


#ifdef GDEBUG
extern FILE    *dbg;
	#define gprintf(x...) fprintf(dbg, x)
#else
	#define gprintf(x...)
#endif

#if 0

int sub_disp(void)
{
    if ((quit_event == 1))
        return 1;

    if (vo_sub)
    {
        int             l;

        for (l = 0; l < vo_sub->lines; l++)
        {
            printf("%s\n", vo_sub->text[l]);
        }
        printf("\n");
        subtitle_changed = 0;
    }
    else
    {

        printf("clear ==============================\n");
        subtitle_changed = 0;
    }
}

#else

int sub_disp(void)
{


    if ((quit_event == 1))
        return 1;

    if(vo_sub)
    {
        int             l;
        int             x = 0;
        int             y = 240-60;



        gfx_draw_sized_rect(psd, 0, 240-60, psd->planew, psd->planeh, RGB2PIXEL(0xCC,0xCC,0xCC));

        for(l=0; l<vo_sub->lines; l++)
        {
            gfx_set_fg(psd, RGB2PIXEL(10, 10, 10));
            gfx_set_fc(psd, WHITE);


        	x = (320-(strlen(vo_sub->text[l])*7))/2;
            gfx_draw_mtext(psd, x, y, vo_sub->text[l]);
            y += 20;
        }

        subtitle_changed = 0;
    }
    else
    {


        gfx_draw_sized_rect(psd, 0, 240-60, psd->planew, psd->planeh, RGB2PIXEL(0xCC,0xCC,0xCC));

        subtitle_changed = 0;
    }

}

#endif





See more files for this project here

The Open2x Project

The Open2x project exists to provide an open source resource for the GP2X handheld console based on the MagicEyes MMSP2 processing platform and MP2520F SoC. The project hosts Linux kernel source for the GP2X, boot loader (U-Boot) source and more.

Project homepage: http://www.distant-earth.com/open2x
Programming language(s): Assembly,C,C++
License: other

  default_skin/
    asf.png
    avi.png
    body.png
    dat.png
    downarrow.png
    error.png
    ext.png
    ext_on.png
    folder.png
    full.png
    loading.png
    mpg.png
    nand.png
    nand_on.png
    normal.png
    resume.png
    save.png
    sd.png
    sd_on.png
    selectbar.png
    uparrow.png
    wmv.png
  etc/
    codecs.conf
    dvb-menu.conf
    example.conf
    input.conf
    inttypes.h
    menu.conf
    mplayer.desktop
    mplayer.ico
  fbdisp/
    Makefile
    fblin16.c
    fblin24.c
    fblin32.c
    fbs.h
    fontdisp.h
    fontout.c
    gfxdev.h
    gfxfontext.c
    gfxfontload.c
    gfxfontout.c
    gfxtype.h
    gulim_96_10_eng.c
    gulim_96_10_han.c
    main.c
    scr_fb.c
  help/
    help_diff.sh
    help_mp-bg.h
    help_mp-cs.h
    help_mp-de.h
    help_mp-dk.h
    help_mp-el.h
    help_mp-en.h
    help_mp-es.h
    help_mp-fr.h
    help_mp-hu.h
    help_mp-it.h
    help_mp-ja.h
    help_mp-ko.h
    help_mp-mk.h
    help_mp-nl.h
    help_mp-no.h
    help_mp-pl.h
    help_mp-pt_BR.h
    help_mp-ro.h
    help_mp-ru.h
  libaf/
  libao2/
  libmpcodecs/
  libmpdemux/
  loader/
  osdep/
  AUTHORS
  DirDisplay.c
  DirDisplay.h
  DirList.c
  DirList.h
  FontDisplay.c
  FontDisplay.h
  LICENSE
  Makefile
  bswap.h
  codec-cfg.c
  codec-cfg.h
  config.h
  config.mak
  csource.lst
  cx25874.h
  drawcontrol.c
  drawcontrol.h
  dualcpu.h
  filelistview.c
  filelistview.h
  find_sub.c
  g2player.h
  get_path.c
  glock.c
  glock.h
  guictrl.c
  guictrl.h
  gv.c
  gvlib_export.h
  help_mp.h
  i2c.h
  imgNumber.h
  imgbinary.h
  m_config.c
  m_config.h
  m_option.c
  m_option.h
  m_struct.c
  m_struct.h
  mangle.h
  mixer.c
  mixer.h
  mmsp2_940_if.c
  mmsp2_if.h
  mp_msg.c
  mp_msg.h
  mplayer.c
  mplayer.h
  open2x-mplayer.sh
  rtc_1024_table.h
  subdisp.c
  subdisp.h
  subreader.c
  subreader.h
  typed.h
  version.h
  vpp.h
  vpts_q.c
  wincetype.h