Add option pointer to vo struct

This commit is contained in:
Uoti Urpala 2008-04-19 07:04:55 +03:00
parent 5045066574
commit 8ec90e5e4f
3 changed files with 8 additions and 5 deletions

View File

@ -10,6 +10,7 @@
//#include <sys/mman.h>
#include "config.h"
#include "options.h"
#include "video_out.h"
#include "aspect.h"
#include "geometry.h"
@ -297,8 +298,9 @@ void list_video_out(void)
mp_msg(MSGT_GLOBAL, MSGL_INFO,"\n");
}
struct vo *init_best_video_out(char **vo_list)
struct vo *init_best_video_out(struct MPOpts *opts)
{
char **vo_list = opts->video_driver_list;
int i;
struct vo *vo = malloc(sizeof *vo);
// first try the preferred drivers, with their optional subdevice param:
@ -319,7 +321,7 @@ struct vo *init_best_video_out(char **vo_list)
const vo_info_t *info = video_driver->info;
if (!strcmp(info->short_name, name)) {
// name matches, try it
memset(vo, 0, sizeof *vo);
*vo = (struct vo){.opts = opts};
vo->driver = video_driver;
if (!vo_preinit(vo, vo_subdevice)) {
free(name);
@ -337,7 +339,7 @@ struct vo *init_best_video_out(char **vo_list)
vo_subdevice = NULL;
for (i = 0; video_out_drivers[i]; i++) {
const struct vo_driver *video_driver = video_out_drivers[i];
memset(vo, 0, sizeof *vo);
*vo = (struct vo){.opts = opts};
vo->driver = video_driver;
if (!vo_preinit(vo, vo_subdevice))
return vo; // success!

View File

@ -209,9 +209,10 @@ struct vo_old_functions {
struct vo {
const struct vo_driver *driver;
void *priv;
struct MPOpts *opts;
};
struct vo *init_best_video_out(char **vo_list);
struct vo *init_best_video_out(struct MPOpts *opts);
int vo_config(struct vo *vo, uint32_t width, uint32_t height,
uint32_t d_width, uint32_t d_height, uint32_t flags,
char *title, uint32_t format);

View File

@ -2143,7 +2143,7 @@ int reinit_video_chain(void) {
//shouldn't we set dvideo->id=-2 when we fail?
vo_config_count=0;
//if((mpctx->video_out->preinit(vo_subdevice))!=0){
if(!(mpctx->video_out=init_best_video_out(opts->video_driver_list))){
if(!(mpctx->video_out=init_best_video_out(opts))){
mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_ErrorInitializingVODevice);
goto err_out;
}