[Mplayer-cvslog] CVS: main/libvo2 Makefile,NONE,1.1 img_format.c,NONE,1.1 img_format.h,NONE,1.1 vo2_sample.c,NONE,1.1

Arpi of Ize arpi at mplayer.dev.hu
Tue Jul 31 02:29:24 CEST 2001


Update of /cvsroot/mplayer/main/libvo2
In directory mplayer:/var/tmp.root/cvs-serv4666

Added Files:
	Makefile img_format.c img_format.h vo2_sample.c 
Log Message:
libvo2 base

--- NEW FILE ---

include ../config.mak

LIBNAME = libvo2.a

SRCS=draw.c libvo2.c vo2_sample.c vo2_mga.c img_format.c
OBJS=$(SRCS:.c=.o)

CFLAGS  = -Wall $(OPTFLAGS) -I. -I.. $(SDL_INC) $(X11_INC) $(EXTRA_INC)
# -I/usr/X11R6/include/

.SUFFIXES: .c .o

# .PHONY: all clean

.c.o:
	$(CC) -c $(CFLAGS) -o $@ $<

$(LIBNAME):     $(OBJS)
	$(AR) r $(LIBNAME) $(OBJS)

all:    $(LIBNAME)

clean:
	rm -f *.o *.a *~

distclean:
	rm -f Makefile.bak *.o *.a *~ .depend

dep:    depend

depend:
	$(CC) -MM $(CFLAGS) $(SRCS) 1>.depend

#
# include dependency files if they exist
#
ifneq ($(wildcard .depend),)
include .depend
endif

--- NEW FILE ---

#include "img_format.h"

char *vo_format_name(int format)
{
    switch(format)
    {
	case IMGFMT_RGB8: return("RGB 8-bit");
	case IMGFMT_RGB15: return("RGB 15-bit");
	case IMGFMT_RGB16: return("RGB 16-bit");
	case IMGFMT_RGB24: return("RGB 24-bit");
	case IMGFMT_RGB32: return("RGB 32-bit");
	case IMGFMT_BGR8: return("BGR 8-bit");
	case IMGFMT_BGR15: return("BGR 15-bit");
	case IMGFMT_BGR16: return("BGR 16-bit");
	case IMGFMT_BGR24: return("BGR 24-bit");
	case IMGFMT_BGR32: return("BGR 32-bit");
	case IMGFMT_YVU9: return("Planar YVU9");
	case IMGFMT_IF09: return("Planar IF09");
	case IMGFMT_YV12: return("Planar YV12");
	case IMGFMT_I420: return("Planar I420");
	case IMGFMT_IYUV: return("Planar IYUV");
	case IMGFMT_CLPL: return("Planar CLPL");
	case IMGFMT_IYU1: return("Packed IYU1");
	case IMGFMT_IYU2: return("Packed IYU2");
	case IMGFMT_UYVY: return("Packed UYVY");
	case IMGFMT_UYNV: return("Packed UYNV");
	case IMGFMT_cyuv: return("Packed CYUV");
	case IMGFMT_YUY2: return("Packed YUY2");
	case IMGFMT_YUNV: return("Packed YUNV");
	case IMGFMT_YVYU: return("Packed YVYU");
	case IMGFMT_Y41P: return("Packed Y41P");
	case IMGFMT_Y211: return("Packed Y211");
	case IMGFMT_Y41T: return("Packed Y41T");
	case IMGFMT_Y42T: return("Packed Y42T");
	case IMGFMT_V422: return("Packed V422");
	case IMGFMT_V655: return("Packed V655");
	case IMGFMT_CLJR: return("Packed CLJR");
	case IMGFMT_YUVP: return("Packed YUVP");
	case IMGFMT_UYVP: return("Packed UYVP");
    }
    return("Unknown");
}

--- NEW FILE ---

#ifndef __IMG_FORMAT_H
#define __IMG_FORMAT_H

/* RGB/BGR Formats */

#define IMGFMT_RGB_MASK 0xFFFFFF00
#define IMGFMT_RGB (('R'<<24)|('G'<<16)|('B'<<8))
#define IMGFMT_RGB8  (IMGFMT_RGB|8)
#define IMGFMT_RGB15 (IMGFMT_RGB|15)
#define IMGFMT_RGB16 (IMGFMT_RGB|16)
#define IMGFMT_RGB24 (IMGFMT_RGB|24)
#define IMGFMT_RGB32 (IMGFMT_RGB|32)

#define IMGFMT_BGR_MASK 0xFFFFFF00
#define IMGFMT_BGR (('B'<<24)|('G'<<16)|('R'<<8))
#define IMGFMT_BGR8 (IMGFMT_BGR|8)
#define IMGFMT_BGR15 (IMGFMT_BGR|15)
#define IMGFMT_BGR16 (IMGFMT_BGR|16)
#define IMGFMT_BGR24 (IMGFMT_BGR|24)
#define IMGFMT_BGR32 (IMGFMT_BGR|32)


/* Planar YUV Formats */

#define IMGFMT_YVU9 0x39555659
#define IMGFMT_IF09 0x39304649
#define IMGFMT_YV12 0x32315659
#define IMGFMT_I420 0x30323449
#define IMGFMT_IYUV 0x56555949
#define IMGFMT_CLPL 0x4C504C43

/* Packed YUV Formats */

#define IMGFMT_IYU1 0x31555949
#define IMGFMT_IYU2 0x32555949
#define IMGFMT_UYVY 0x59565955
#define IMGFMT_UYNV 0x564E5955
#define IMGFMT_cyuv 0x76757963
#define IMGFMT_YUY2 0x32595559
#define IMGFMT_YUNV 0x564E5559
#define IMGFMT_YVYU 0x55595659
#define IMGFMT_Y41P 0x50313459
#define IMGFMT_Y211 0x31313259
#define IMGFMT_Y41T 0x54313459
#define IMGFMT_Y42T 0x54323459
#define IMGFMT_V422 0x32323456
#define IMGFMT_V655 0x35353656
#define IMGFMT_CLJR 0x524A4C43
#define IMGFMT_YUVP 0x50565559
#define IMGFMT_UYVP 0x50565955

char *vo_format_name(int format);

#endif

--- NEW FILE ---

#include <stdio.h>
#include <stdlib.h>

#include "libvo2.h"
#include "img_format.h"

// Driver info:
static vo2_info_t info = {
        "dummy sample vo2 driver",
        "dummy",
        "Arpad Gereoffy <arpi at thot.banki.hu>",
        "does nothing"
};

// Local, driver-dependent data:  (do not use globals! -> reentrancy)
typedef struct {
    int double_buffering;
    int current_surface;
    vo2_surface_t surfaces[3];
} priv_t;

#include "vo2_def.h"

// open hardware/lib, get capabilities
// this function will be called first, before any other control() or start() calls
// return:  1=success  0=failed
vo2_handle_t* vo2_init_sample(){
    printf("vo2_sample: init()\n");

    return new_handle();
}

// control (get/set/query) device parameters
//  for example: query supported pixel formats, en/disable double buffering,
//  query hw/sw scaling capabilities, switch window/fullscreen,
//  get best matching resolution for a given image size etc...
static int control(void *p, int cmd, void* param){

    printf("vo2_sample: control(0x%X)\n",cmd);
    
    return -1;
}

// start drawing (set video mode, allocate image buffers etc.)
// w,h: requested surface size (actual size may be larger!!!)
// format: IMGFMT_* requested surface pixel format
// buffering: 0 - single temporary frame buffer (for draw_* stuff)
//            1 - single static buffer  (for win32 direct rendering)
//            2 - 2 static + 1 temp buffer (for mpeg direct rendering)
// flags: various things, like fullscreen, sw/hw zoom and vidmode change
// return: 1=success 0=fail (fail if pixel format or buffering not supported)
static int start(void *p, int w,int h,int format,int buffering,int flags){

    // open window / switch vidmode, set up surfaces etc...
    printf("vo2_sample: start() %dx%d  %s  %d  0x%X\n",w,h,vo_format_name(format),buffering,flags);


    return 1;
}

static int stop(void *p){
    // stop rendering, close device
    printf("vo2_sample: stop()\n");
    return 1;
}

// get destination surface (for direct rendering or generic draw_ functions)
// num: number of frame. 0 = temporary frame - can be dropped/modified
//                       1-2 = static frames - should not be modified
// Note:  mpeg will use 0,1,2 frames for B,Pf,Pb  (or fallback to 0-only)
//        win32 will use only 0
static vo2_surface_t* get_surface(void *p, int num){
    printf("vo2_sample: get_surface(%d)\n",num);
    return &((priv_t*)p)->surfaces[((priv_t*)p)->current_surface];
}

static void flip_image(void *p, int num){
    // we can assume that num is valid (get_surface(num) will return non-NULL)

    printf("vo2_sample: flip_image(%d)\n",num);
  
    // let's show surface[num]

//    if(double_buffering) current_surface=current_surface^1; // swap buffers
}







More information about the MPlayer-cvslog mailing list