libvo2 support

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1423 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
arpi 2001-07-30 02:00:54 +00:00
parent de654f5bfe
commit 57207b1f8b
5 changed files with 108 additions and 4 deletions

View File

@ -27,11 +27,19 @@ extern int fakemono; // defined in dec_audio.c
extern char *lirc_configfile; extern char *lirc_configfile;
#endif #endif
#ifndef USE_LIBVO2
extern int vo_doublebuffering; extern int vo_doublebuffering;
extern int vo_fsmode; extern int vo_fsmode;
extern int vo_dbpp; extern int vo_dbpp;
extern int osd_level; #endif
#ifdef USE_SUB
extern int sub_unicode; extern int sub_unicode;
#endif
#ifdef USE_OSD
extern int osd_level;
#endif
extern char *ao_outputfilename; extern char *ao_outputfilename;
extern int ao_pcm_waveheader; extern int ao_pcm_waveheader;
@ -77,14 +85,18 @@ struct config conf[]={
{"monitor_dotclock", &monitor_dotclock_str, CONF_TYPE_STRING, 0, 0, 0}, {"monitor_dotclock", &monitor_dotclock_str, CONF_TYPE_STRING, 0, 0, 0},
#endif #endif
{"encode", &encode_name, CONF_TYPE_STRING, 0, 0, 0}, {"encode", &encode_name, CONF_TYPE_STRING, 0, 0, 0},
#ifdef USE_SUB
{"sub", &sub_name, CONF_TYPE_STRING, 0, 0, 0}, {"sub", &sub_name, CONF_TYPE_STRING, 0, 0, 0},
{"subdelay", &sub_delay, CONF_TYPE_FLOAT, 0, 0.0, 10.0}, {"subdelay", &sub_delay, CONF_TYPE_FLOAT, 0, 0.0, 10.0},
{"subfps", &sub_fps, CONF_TYPE_FLOAT, 0, 0.0, 10.0}, {"subfps", &sub_fps, CONF_TYPE_FLOAT, 0, 0.0, 10.0},
{"noautosub", &sub_auto, CONF_TYPE_FLAG, 0, 1, 0}, {"noautosub", &sub_auto, CONF_TYPE_FLAG, 0, 1, 0},
{"unicode", &sub_unicode, CONF_TYPE_FLAG, 0, 0, 1}, {"unicode", &sub_unicode, CONF_TYPE_FLAG, 0, 0, 1},
{"nounicode", &sub_unicode, CONF_TYPE_FLAG, 0, 1, 0}, {"nounicode", &sub_unicode, CONF_TYPE_FLAG, 0, 1, 0},
#endif
#ifdef USE_OSD
{"font", &font_name, CONF_TYPE_STRING, 0, 0, 0}, {"font", &font_name, CONF_TYPE_STRING, 0, 0, 0},
{"ffactor", &font_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 10.0}, {"ffactor", &font_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 10.0},
#endif
{"bg", &play_in_bg, CONF_TYPE_FLAG, 0, 0, 1}, {"bg", &play_in_bg, CONF_TYPE_FLAG, 0, 0, 1},
{"nobg", &play_in_bg, CONF_TYPE_FLAG, 0, 1, 0}, {"nobg", &play_in_bg, CONF_TYPE_FLAG, 0, 1, 0},
{"sb", &seek_to_byte, CONF_TYPE_INT, CONF_MIN, 0, 0}, {"sb", &seek_to_byte, CONF_TYPE_INT, CONF_MIN, 0, 0},
@ -168,10 +180,13 @@ struct config conf[]={
{"flip", &flip, CONF_TYPE_FLAG, 0, -1, 1}, {"flip", &flip, CONF_TYPE_FLAG, 0, -1, 1},
{"noflip", &flip, CONF_TYPE_FLAG, 0, -1, 0}, {"noflip", &flip, CONF_TYPE_FLAG, 0, -1, 0},
#ifndef USE_LIBVO2
{"bpp", &vo_dbpp, CONF_TYPE_INT, CONF_RANGE, 0, 32}, {"bpp", &vo_dbpp, CONF_TYPE_INT, CONF_RANGE, 0, 32},
{"fsmode", &vo_fsmode, CONF_TYPE_INT, CONF_RANGE, 0, 15}, {"fsmode", &vo_fsmode, CONF_TYPE_INT, CONF_RANGE, 0, 15},
{"double", &vo_doublebuffering, CONF_TYPE_FLAG, 0, 0, 1}, {"double", &vo_doublebuffering, CONF_TYPE_FLAG, 0, 0, 1},
{"nodouble", &vo_doublebuffering, CONF_TYPE_FLAG, 0, 1, 0}, {"nodouble", &vo_doublebuffering, CONF_TYPE_FLAG, 0, 1, 0},
#endif
#ifdef HAVE_LIRC #ifdef HAVE_LIRC
{"lircconf", &lirc_configfile, CONF_TYPE_STRING, 0, 0, 0}, {"lircconf", &lirc_configfile, CONF_TYPE_STRING, 0, 0, 0},
#endif #endif

3
configure vendored
View File

@ -1795,6 +1795,9 @@ cat > $CCONF << EOF
/* -------- Generated by ./configure ----------- */ /* -------- Generated by ./configure ----------- */
#define USE_OSD
#define USE_SUB
/* Common data directory (for fonts, etc) */ /* Common data directory (for fonts, etc) */
#define DATADIR "$_datadir" #define DATADIR "$_datadir"

View File

@ -28,7 +28,11 @@ extern int frameratecode2framerate[16];
//#include <inttypes.h> //#include <inttypes.h>
//#include "libvo/img_format.h" //#include "libvo/img_format.h"
#ifdef USE_LIBVO2
#include "libvo2/libvo2.h"
#else
#include "libvo/video_out.h" #include "libvo/video_out.h"
#endif
#include "libmpeg2/mpeg2.h" #include "libmpeg2/mpeg2.h"
#include "libmpeg2/mpeg2_internal.h" #include "libmpeg2/mpeg2_internal.h"
@ -260,7 +264,11 @@ switch(sh_video->codec->driver){
return 1; return 1;
} }
#ifdef USE_LIBVO2
int decode_video(vo2_handle_t *video_out,sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame){
#else
int decode_video(vo_functions_t *video_out,sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame){ int decode_video(vo_functions_t *video_out,sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame){
#endif
unsigned int out_fmt=sh_video->codec->outfmt[sh_video->outfmtidx]; unsigned int out_fmt=sh_video->codec->outfmt[sh_video->outfmtidx];
int planar=(out_fmt==IMGFMT_YV12||out_fmt==IMGFMT_IYUV||out_fmt==IMGFMT_I420); int planar=(out_fmt==IMGFMT_YV12||out_fmt==IMGFMT_IYUV||out_fmt==IMGFMT_I420);
int blit_frame=0; int blit_frame=0;
@ -416,10 +424,17 @@ case 3:
} else } else
planes[0]=sh_video->our_out_buffer; planes[0]=sh_video->our_out_buffer;
case 2: case 2:
#ifdef USE_LIBVO2
if(planar)
vo2_draw_slice(video_out,planes,stride,sh_video->disp_w,sh_video->disp_h,0,0);
else
vo2_draw_frame(video_out,planes[0],sh_video->disp_w,sh_video->disp_w,sh_video->disp_h);
#else
if(planar) if(planar)
video_out->draw_slice(planes,stride,sh_video->disp_w,sh_video->disp_h,0,0); video_out->draw_slice(planes,stride,sh_video->disp_w,sh_video->disp_h,0,0);
else else
video_out->draw_frame(planes); video_out->draw_frame(planes);
#endif
t2=GetTimer()-t2;vout_time_usage+=t2*0.000001f; t2=GetTimer()-t2;vout_time_usage+=t2*0.000001f;
blit_frame=1; blit_frame=1;
break; break;

View File

@ -2,6 +2,10 @@
// .SUB // .SUB
//**************************************************************************// //**************************************************************************//
#include "config.h"
#ifdef USE_OSD
#include <stdio.h> #include <stdio.h>
#include "libvo/video_out.h" #include "libvo/video_out.h"
@ -104,3 +108,4 @@ void find_sub(subtitle* subtitles,int key){
vo_sub=NULL; // no sub here vo_sub=NULL; // no sub here
} }
#endif

View File

@ -33,10 +33,19 @@
#include "cfgparser.h" #include "cfgparser.h"
#include "cfg-mplayer-def.h" #include "cfg-mplayer-def.h"
#ifdef USE_SUB
#include "subreader.h" #include "subreader.h"
#endif
#ifdef USE_LIBVO2
#include "libvo2/libvo2.h"
#else
#include "libvo/video_out.h" #include "libvo/video_out.h"
#endif
//#ifdef USE_OSD
#include "libvo/sub.h" #include "libvo/sub.h"
//#endif
#include "libao2/audio_out.h" #include "libao2/audio_out.h"
@ -79,7 +88,9 @@ int verbose=0;
#define ABS(x) (((x)>=0)?(x):(-(x))) #define ABS(x) (((x)>=0)?(x):(-(x)))
#ifdef USE_SUB
void find_sub(subtitle* subtitles,int key); void find_sub(subtitle* subtitles,int key);
#endif
static int static int
usec_sleep(int usec_delay) usec_sleep(int usec_delay)
@ -186,7 +197,11 @@ int frameratecode2framerate[16] = {
//**************************************************************************// //**************************************************************************//
#ifdef USE_LIBVO2
static vo2_handle_t *video_out=NULL;
#else
static vo_functions_t *video_out=NULL; static vo_functions_t *video_out=NULL;
#endif
static ao_functions_t *audio_out=NULL; static ao_functions_t *audio_out=NULL;
float c_total=0; float c_total=0;
@ -321,7 +336,11 @@ void exit_player(char* how){
if ( nogui ) if ( nogui )
#endif #endif
getch2_disable(); getch2_disable();
#ifdef USE_LIBVO2
if(video_out) vo2_close(video_out);
#else
if(video_out) video_out->uninit(); if(video_out) video_out->uninit();
#endif
if(audio_out) audio_out->uninit(); if(audio_out) audio_out->uninit();
if(encode_name) avi_fixate(); if(encode_name) avi_fixate();
#ifdef HAVE_LIRC #ifdef HAVE_LIRC
@ -367,7 +386,11 @@ extern void skip_audio_frame(sh_audio_t *sh_audio);
// dec_video.c: // dec_video.c:
extern int init_video(sh_video_t *sh_video); extern int init_video(sh_video_t *sh_video);
#ifdef USE_LIBVO2
extern int decode_video(vo2_handle_t *video_out,sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame);
#else
extern int decode_video(vo_functions_t *video_out,sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame); extern int decode_video(vo_functions_t *video_out,sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame);
#endif
#include "mixer.h" #include "mixer.h"
#include "cfg-mplayer.h" #include "cfg-mplayer.h"
@ -404,7 +427,9 @@ if ((conffile = get_path("")) == NULL) {
int mplayer(int argc,char* argv[], char *envp[]){ int mplayer(int argc,char* argv[], char *envp[]){
#endif #endif
#ifdef USE_SUB
static subtitle* subtitles=NULL; static subtitle* subtitles=NULL;
#endif
static demuxer_t *demuxer=NULL; static demuxer_t *demuxer=NULL;
@ -458,6 +483,7 @@ int f; // filedes
printf("\n"); printf("\n");
} }
#ifndef USE_LIBVO2
if(video_driver && strcmp(video_driver,"help")==0){ if(video_driver && strcmp(video_driver,"help")==0){
printf("Available video output drivers:\n"); printf("Available video output drivers:\n");
i=0; i=0;
@ -468,6 +494,7 @@ int f; // filedes
printf("\n"); printf("\n");
exit(0); exit(0);
} }
#endif
if(audio_driver && strcmp(audio_driver,"help")==0){ if(audio_driver && strcmp(audio_driver,"help")==0){
printf("Available audio output drivers:\n"); printf("Available audio output drivers:\n");
i=0; i=0;
@ -489,6 +516,9 @@ if(!filename){
} }
} }
#ifdef USE_LIBVO2
video_out=vo2_new(video_driver);
#else
// check video_out driver name: // check video_out driver name:
if (video_driver) if (video_driver)
if ((i = strcspn(video_driver, ":")) > 0) if ((i = strcspn(video_driver, ":")) > 0)
@ -513,8 +543,9 @@ if(!filename){
video_out = video_out_drivers[i];break; video_out = video_out_drivers[i];break;
} }
} }
#endif
if(!video_out){ if(!video_out){
fprintf(stderr,"Invalid video output driver name: %s\nUse '-vo help' to get a list of available video drivers.\n",video_driver); fprintf(stderr,"Invalid video output driver name: %s\nUse '-vo help' to get a list of available video drivers.\n",video_driver?video_driver:"?");
return 0; return 0;
} }
@ -558,6 +589,7 @@ if(!parse_codec_cfg(get_path("codecs.conf"))){
} }
// check font // check font
#ifdef USE_OSD
if(font_name){ if(font_name){
vo_font=read_font_desc(font_name,font_factor,verbose>1); vo_font=read_font_desc(font_name,font_factor,verbose>1);
if(!vo_font) fprintf(stderr,"Can't load font: %s\n",font_name); if(!vo_font) fprintf(stderr,"Can't load font: %s\n",font_name);
@ -567,7 +599,9 @@ if(!parse_codec_cfg(get_path("codecs.conf"))){
if(!vo_font) if(!vo_font)
vo_font=read_font_desc(DATADIR"/font/font.desc",font_factor,verbose>1); vo_font=read_font_desc(DATADIR"/font/font.desc",font_factor,verbose>1);
} }
#endif
#ifdef USE_SUB
// check .sub // check .sub
if(sub_name){ if(sub_name){
subtitles=sub_read_file(sub_name); subtitles=sub_read_file(sub_name);
@ -580,7 +614,7 @@ if(!parse_codec_cfg(get_path("codecs.conf"))){
} }
if ( subtitles == NULL ) subtitles=sub_read_file(get_path("default.sub")); // try default: if ( subtitles == NULL ) subtitles=sub_read_file(get_path("default.sub")); // try default:
} }
#endif
if(vcd_track){ if(vcd_track){
//============ Open VideoCD track ============== //============ Open VideoCD track ==============
@ -812,7 +846,11 @@ for(i=0;i<CODECS_MAX_OUTFMT;i++){
int ret; int ret;
out_fmt=sh_video->codec->outfmt[i]; out_fmt=sh_video->codec->outfmt[i];
if(out_fmt==0xFFFFFFFF) continue; if(out_fmt==0xFFFFFFFF) continue;
#ifdef USE_LIBVO2
ret=vo2_query_format(video_out);
#else
ret=video_out->query_format(out_fmt); ret=video_out->query_format(out_fmt);
#endif
if(verbose) printf("vo_debug: query(%s) returned 0x%X\n",vo_format_name(out_fmt),ret); if(verbose) printf("vo_debug: query(%s) returned 0x%X\n",vo_format_name(out_fmt),ret);
if(ret) break; if(ret) break;
} }
@ -894,6 +932,7 @@ make_pipe(&keyb_fifo_get,&keyb_fifo_put);
if(screen_size_y<=8) screen_size_y*=sh_video->disp_h; if(screen_size_y<=8) screen_size_y*=sh_video->disp_h;
} }
#ifndef USE_LIBVO2
{ const vo_info_t *info = video_out->get_info(); { const vo_info_t *info = video_out->get_info();
printf("VO: [%s] %dx%d => %dx%d %s %s%s%s%s\n",info->short_name, printf("VO: [%s] %dx%d => %dx%d %s %s%s%s%s\n",info->short_name,
sh_video->disp_w,sh_video->disp_h, sh_video->disp_w,sh_video->disp_h,
@ -913,6 +952,7 @@ make_pipe(&keyb_fifo_get,&keyb_fifo_put);
if(strlen(info->comment) > 0) if(strlen(info->comment) > 0)
printf("VO: Comment: %s\n", info->comment); printf("VO: Comment: %s\n", info->comment);
} }
#endif
if(verbose) printf("video_out->init(%dx%d->%dx%d,flags=%d,'%s',0x%X)\n", if(verbose) printf("video_out->init(%dx%d->%dx%d,flags=%d,'%s',0x%X)\n",
sh_video->disp_w,sh_video->disp_h, sh_video->disp_w,sh_video->disp_h,
@ -929,6 +969,15 @@ make_pipe(&keyb_fifo_get,&keyb_fifo_put);
} }
#endif #endif
#ifdef USE_LIBVO2
if(!vo2_start(video_out,
sh_video->disp_w,sh_video->disp_h,out_fmt,0,
fullscreen|(vidmode<<1)|(softzoom<<2)|(flip<<3) )){
fprintf(stderr,"FATAL: Cannot initialize video driver!\n");
GUI_MSG( mplCantInitVideoDriver )
exit(1);
}
#else
if(video_out->init(sh_video->disp_w,sh_video->disp_h, if(video_out->init(sh_video->disp_w,sh_video->disp_h,
screen_size_x,screen_size_y, screen_size_x,screen_size_y,
fullscreen|(vidmode<<1)|(softzoom<<2)|(flip<<3), fullscreen|(vidmode<<1)|(softzoom<<2)|(flip<<3),
@ -937,6 +986,7 @@ make_pipe(&keyb_fifo_get,&keyb_fifo_put);
GUI_MSG( mplCantInitVideoDriver ) GUI_MSG( mplCantInitVideoDriver )
exit(1); exit(1);
} }
#endif
if(verbose) printf("INFO: Video OUT driver init OK!\n"); if(verbose) printf("INFO: Video OUT driver init OK!\n");
fflush(stdout); fflush(stdout);
@ -1292,7 +1342,11 @@ if(1)
} }
current_module="flip_page"; current_module="flip_page";
#ifdef USE_LIBVO2
if(blit_frame) vo2_flip(video_out,0);
#else
if(blit_frame) video_out->flip_page(); if(blit_frame) video_out->flip_page();
#endif
// usec_sleep(50000); // test only! // usec_sleep(50000); // test only!
} }
@ -1383,10 +1437,12 @@ if(1)
} }
#endif #endif
#ifdef USE_OSD
if(osd_visible){ if(osd_visible){
--osd_visible; --osd_visible;
if(!osd_visible) vo_osd_progbar_type=-1; // disable if(!osd_visible) vo_osd_progbar_type=-1; // disable
} }
#endif
if(osd_function==OSD_PAUSE){ if(osd_function==OSD_PAUSE){
printf("\n------ PAUSED -------\r");fflush(stdout); printf("\n------ PAUSED -------\r");fflush(stdout);
@ -1401,7 +1457,9 @@ if(1)
lirc_mp_getinput()<=0 && lirc_mp_getinput()<=0 &&
#endif #endif
(!f || getch2(20)<=0) && mplayer_get_key()<=0){ (!f || getch2(20)<=0) && mplayer_get_key()<=0){
#ifndef USE_LIBVO2
video_out->check_events(); video_out->check_events();
#endif
if(!f) usec_sleep(1000); // do not eat the CPU if(!f) usec_sleep(1000); // do not eat the CPU
} }
osd_function=OSD_PLAY; osd_function=OSD_PLAY;
@ -1485,12 +1543,14 @@ if(1)
} }
mixer_setvolume( mixer_l,mixer_r ); mixer_setvolume( mixer_l,mixer_r );
#ifdef USE_OSD
if(osd_level){ if(osd_level){
osd_visible=sh_video->fps; // 1 sec osd_visible=sh_video->fps; // 1 sec
vo_osd_progbar_type=OSD_VOLUME; vo_osd_progbar_type=OSD_VOLUME;
vo_osd_progbar_value=(mixer_l+mixer_r)*5/4; vo_osd_progbar_value=(mixer_l+mixer_r)*5/4;
//printf("volume: %d\n",vo_osd_progbar_value); //printf("volume: %d\n",vo_osd_progbar_value);
} }
#endif
} }
break; break;
case 'm': case 'm':
@ -1526,6 +1586,7 @@ if(1)
current_module=NULL; current_module=NULL;
} }
#ifdef USE_OSD
// Set OSD: // Set OSD:
if(osd_level){ if(osd_level){
int len=((demuxer->movi_end-demuxer->movi_start)>>8); int len=((demuxer->movi_end-demuxer->movi_start)>>8);
@ -1535,6 +1596,7 @@ if(1)
vo_osd_progbar_value=(demuxer->filepos-demuxer->movi_start)/len; vo_osd_progbar_value=(demuxer->filepos-demuxer->movi_start)/len;
} }
} }
#endif
c_total=0; c_total=0;
max_pts_correction=0.1; max_pts_correction=0.1;
@ -1545,6 +1607,7 @@ if(1)
rel_seek_secs=0; rel_seek_secs=0;
//================= Update OSD ==================== //================= Update OSD ====================
#ifdef USE_OSD
if(osd_level>=2){ if(osd_level>=2){
int pts=d_video->pts; int pts=d_video->pts;
if(pts==osd_last_pts-1) ++pts; else osd_last_pts=pts; if(pts==osd_last_pts-1) ++pts; else osd_last_pts=pts;
@ -1555,7 +1618,9 @@ if(1)
} }
// for(i=1;i<=11;i++) osd_text_buffer[10+i]=i;osd_text_buffer[10+i]=0; // for(i=1;i<=11;i++) osd_text_buffer[10+i]=i;osd_text_buffer[10+i]=0;
// vo_osd_text=osd_text_buffer; // vo_osd_text=osd_text_buffer;
#endif
#ifdef USE_SUB
// find sub // find sub
if(subtitles && d_video->pts>0){ if(subtitles && d_video->pts>0){
int pts=d_video->pts; int pts=d_video->pts;
@ -1564,6 +1629,7 @@ if(1)
find_sub(subtitles,sub_uses_time?(100*(pts+sub_delay)):((pts+sub_delay)*sub_fps)); // FIXME! frame counter... find_sub(subtitles,sub_uses_time?(100*(pts+sub_delay)):((pts+sub_delay)*sub_fps)); // FIXME! frame counter...
current_module=NULL; current_module=NULL;
} }
#endif
// DVD sub: // DVD sub:
{ unsigned char* packet=NULL; { unsigned char* packet=NULL;