forked from enlightenment/rage
add engine config (save/load and cmdline option) - no gui though
This commit is contained in:
parent
77aabdae63
commit
8f126343af
1
TODO
1
TODO
|
@ -8,7 +8,6 @@
|
||||||
* spu channel list/selection
|
* spu channel list/selection
|
||||||
* video channel list/selection
|
* video channel list/selection
|
||||||
* handle non-seekable content (eg streams)
|
* handle non-seekable content (eg streams)
|
||||||
* cmdline options
|
|
||||||
* add subtitle file cmdline
|
* add subtitle file cmdline
|
||||||
* loop all option
|
* loop all option
|
||||||
* show busy anim until opened cb or failure
|
* show busy anim until opened cb or failure
|
||||||
|
|
|
@ -18,4 +18,5 @@ main.c main.h \
|
||||||
video.c video.h \
|
video.c video.h \
|
||||||
winvid.c winvid.h \
|
winvid.c winvid.h \
|
||||||
win.c win.h \
|
win.c win.h \
|
||||||
winlist.c winlist.h
|
winlist.c winlist.h \
|
||||||
|
config.c config.h
|
||||||
|
|
|
@ -0,0 +1,77 @@
|
||||||
|
#include <Elementary.h>
|
||||||
|
#include "main.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
static Config *config = NULL;
|
||||||
|
static Eet_Data_Descriptor *edd_base = NULL;
|
||||||
|
|
||||||
|
void
|
||||||
|
config_init(void)
|
||||||
|
{
|
||||||
|
Eet_Data_Descriptor_Class eddc;
|
||||||
|
Eet_File *ef;
|
||||||
|
char buf[PATH_MAX];
|
||||||
|
|
||||||
|
elm_need_efreet();
|
||||||
|
efreet_init();
|
||||||
|
|
||||||
|
eet_eina_stream_data_descriptor_class_set
|
||||||
|
(&eddc, sizeof(eddc), "Config", sizeof(Config));
|
||||||
|
edd_base = eet_data_descriptor_stream_new(&eddc);
|
||||||
|
EET_DATA_DESCRIPTOR_ADD_BASIC
|
||||||
|
(edd_base, Config, "emotion_engine", emotion_engine, EET_T_STRING);
|
||||||
|
snprintf(buf, sizeof(buf), "%s/rage/config/standard/base.cfg", efreet_config_home_get());
|
||||||
|
ef = eet_open(buf, EET_FILE_MODE_READ);
|
||||||
|
if (ef)
|
||||||
|
{
|
||||||
|
config = eet_data_read(ef, edd_base, "config");
|
||||||
|
eet_close(ef);
|
||||||
|
}
|
||||||
|
if (!config)
|
||||||
|
{
|
||||||
|
config = calloc(1, sizeof(Config));
|
||||||
|
if (!config) abort();
|
||||||
|
// xine vlc gstreamer1
|
||||||
|
config->emotion_engine = eina_stringshare_add("gstreamer1");
|
||||||
|
config_save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
config_shutdown(void)
|
||||||
|
{
|
||||||
|
if (config->emotion_engine) eina_stringshare_del(config->emotion_engine);
|
||||||
|
free(config);
|
||||||
|
if (edd_base)
|
||||||
|
{
|
||||||
|
eet_data_descriptor_free(edd_base);
|
||||||
|
edd_base = NULL;
|
||||||
|
}
|
||||||
|
efreet_shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
Config *
|
||||||
|
config_get(void)
|
||||||
|
{
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
config_save(void)
|
||||||
|
{
|
||||||
|
Eet_File *ef;
|
||||||
|
Eina_Bool ok;
|
||||||
|
char buf[PATH_MAX], buf2[PATH_MAX];
|
||||||
|
|
||||||
|
snprintf(buf, sizeof(buf), "%s/rage/config/standard/", efreet_config_home_get());
|
||||||
|
ecore_file_mkpath(buf);
|
||||||
|
snprintf(buf, sizeof(buf), "%s/rage/config/standard/base.cfg.tmp", efreet_config_home_get());
|
||||||
|
snprintf(buf2, sizeof(buf2), "%s/rage/config/standard/base.cfg", efreet_config_home_get());
|
||||||
|
ef = eet_open(buf, EET_FILE_MODE_WRITE);
|
||||||
|
if (ef)
|
||||||
|
{
|
||||||
|
ok = eet_data_write(ef, edd_base, "config", config, 1);
|
||||||
|
eet_close(ef);
|
||||||
|
if (ok) ecore_file_mv(buf, buf2);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
#ifndef _CONFIG_H__
|
||||||
|
#define _CONFIG_H__ 1
|
||||||
|
|
||||||
|
typedef struct _Config Config;
|
||||||
|
|
||||||
|
struct _Config
|
||||||
|
{
|
||||||
|
const char *emotion_engine;
|
||||||
|
};
|
||||||
|
|
||||||
|
void config_init(void);
|
||||||
|
void config_shutdown(void);
|
||||||
|
Config *config_get(void);
|
||||||
|
void config_save(void);
|
||||||
|
|
||||||
|
#endif
|
|
@ -3,6 +3,7 @@
|
||||||
#include "win.h"
|
#include "win.h"
|
||||||
#include "winvid.h"
|
#include "winvid.h"
|
||||||
#include "winlist.h"
|
#include "winlist.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_cb_show_timeout(void *data)
|
_cb_show_timeout(void *data)
|
||||||
|
@ -30,9 +31,37 @@ elm_main(int argc, char **argv)
|
||||||
Eina_List *list = NULL;
|
Eina_List *list = NULL;
|
||||||
int i;
|
int i;
|
||||||
Inf *inf;
|
Inf *inf;
|
||||||
|
Config *config;
|
||||||
|
|
||||||
|
config_init();
|
||||||
|
config = config_get();
|
||||||
for (i = 1; i < argc; i++)
|
for (i = 1; i < argc; i++)
|
||||||
list = eina_list_append(list, eina_stringshare_add(argv[i]));
|
{
|
||||||
|
if ((!strcmp(argv[i], "-h")) ||
|
||||||
|
(!strcmp(argv[i], "-help")) ||
|
||||||
|
(!strcmp(argv[i], "--help")))
|
||||||
|
{
|
||||||
|
printf("Usage: rage [OPTIONS] [file1] [file2] [...]\n"
|
||||||
|
" Where OPTIONS can ben"
|
||||||
|
" -e ENGINE\n"
|
||||||
|
" ENGINE is one of gstreamer1, xine or vlc\n"
|
||||||
|
" The default is gtsreamer1\n"
|
||||||
|
" -h | -help | --help\n"
|
||||||
|
" This help\n");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
else if (!strcmp(argv[i], "-e"))
|
||||||
|
{
|
||||||
|
if (i < (argc - 1))
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
eina_stringshare_del(config->emotion_engine);
|
||||||
|
config->emotion_engine = eina_stringshare_add(argv[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
list = eina_list_append(list, eina_stringshare_add(argv[i]));
|
||||||
|
}
|
||||||
|
|
||||||
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
|
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
|
||||||
elm_app_compile_bin_dir_set(PACKAGE_BIN_DIR);
|
elm_app_compile_bin_dir_set(PACKAGE_BIN_DIR);
|
||||||
|
@ -68,6 +97,7 @@ elm_main(int argc, char **argv)
|
||||||
|
|
||||||
elm_run();
|
elm_run();
|
||||||
|
|
||||||
|
config_shutdown();
|
||||||
elm_shutdown();
|
elm_shutdown();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include <Emotion.h>
|
#include <Emotion.h>
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "rage_config.h"
|
#include "rage_config.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
typedef struct _Video Video;
|
typedef struct _Video Video;
|
||||||
|
|
||||||
|
@ -407,15 +408,7 @@ video_add(Evas_Object *parent)
|
||||||
Evas *e;
|
Evas *e;
|
||||||
Evas_Object *obj, *o;
|
Evas_Object *obj, *o;
|
||||||
Video *sd;
|
Video *sd;
|
||||||
char *modules[] =
|
Config *config;
|
||||||
{
|
|
||||||
NULL,
|
|
||||||
"gstreamer",
|
|
||||||
"xine",
|
|
||||||
"vlc",
|
|
||||||
"gstreamer1"
|
|
||||||
};
|
|
||||||
char *mod = NULL;
|
|
||||||
|
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
||||||
e = evas_object_evas_get(parent);
|
e = evas_object_evas_get(parent);
|
||||||
|
@ -429,8 +422,8 @@ video_add(Evas_Object *parent)
|
||||||
emotion_init();
|
emotion_init();
|
||||||
o = sd->o_vid = emotion_object_add(evas_object_evas_get(obj));
|
o = sd->o_vid = emotion_object_add(evas_object_evas_get(obj));
|
||||||
emotion_object_keep_aspect_set(o, EMOTION_ASPECT_KEEP_NONE);
|
emotion_object_keep_aspect_set(o, EMOTION_ASPECT_KEEP_NONE);
|
||||||
mod = modules[4];
|
config = config_get();
|
||||||
if (!emotion_object_init(o, mod))
|
if (!emotion_object_init(o, config->emotion_engine))
|
||||||
{
|
{
|
||||||
evas_object_del(sd->o_vid);
|
evas_object_del(sd->o_vid);
|
||||||
sd->o_vid = NULL;
|
sd->o_vid = NULL;
|
||||||
|
|
Loading…
Reference in New Issue