forked from enlightenment/efl
Emotion: generic vlc player now uses eina_log
SVN revision: 82098
This commit is contained in:
parent
0ec613a4fa
commit
d9c28e87a2
|
@ -20,6 +20,14 @@
|
||||||
#include <vlc/vlc.h>
|
#include <vlc/vlc.h>
|
||||||
|
|
||||||
#include <Emotion_Generic_Plugin.h>
|
#include <Emotion_Generic_Plugin.h>
|
||||||
|
#include <Eina.h>
|
||||||
|
|
||||||
|
static int _em_vlc_log_dom = -1;
|
||||||
|
#define ERR(...) EINA_LOG_DOM_ERR(_em_vlc_log_dom, __VA_ARGS__)
|
||||||
|
#define DBG(...) EINA_LOG_DOM_DBG(_em_vlc_log_dom, __VA_ARGS__)
|
||||||
|
#define INF(...) EINA_LOG_DOM_INFO(_em_vlc_log_dom, __VA_ARGS__)
|
||||||
|
#define WRN(...) EINA_LOG_DOM_WARN(_em_vlc_log_dom, __VA_ARGS__)
|
||||||
|
#define CRIT(...) EINA_LOG_DOM_CRIT(_em_vlc_log_dom, __VA_ARGS__)
|
||||||
|
|
||||||
enum _Thread_Events {
|
enum _Thread_Events {
|
||||||
EM_THREAD_POSITION_CHANGED,
|
EM_THREAD_POSITION_CHANGED,
|
||||||
|
@ -80,8 +88,7 @@ _em_read_safe(int fd, void *buf, ssize_t size)
|
||||||
continue;
|
continue;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr, "could not read from fd %d: %s",
|
ERR("could not read from fd %d: %s", fd, strerror(errno));
|
||||||
fd, strerror(errno));
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -117,8 +124,7 @@ _em_write_safe(int fd, const void *buf, ssize_t size)
|
||||||
continue;
|
continue;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr, "could not write to fd %d: %s",
|
ERR("could not write to fd %d: %s", fd, strerror(errno));
|
||||||
fd, strerror(errno));
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -403,14 +409,14 @@ _file_set(struct _App *app)
|
||||||
app->m = libvlc_media_new_path(app->libvlc, app->filename);
|
app->m = libvlc_media_new_path(app->libvlc, app->filename);
|
||||||
if (!app->m)
|
if (!app->m)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "could not open path: \"%s\"\n", app->filename);
|
ERR("could not open path: \"%s\"", app->filename);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
app->mp = libvlc_media_player_new_from_media(app->m);
|
app->mp = libvlc_media_player_new_from_media(app->m);
|
||||||
if (!app->mp)
|
if (!app->mp)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "could not create new player from media.\n");
|
ERR("could not create new player from media.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -748,7 +754,7 @@ _process_thread_events(struct _App *app)
|
||||||
size = read(app->fd_read, &event, sizeof(event));
|
size = read(app->fd_read, &event, sizeof(event));
|
||||||
if (size != sizeof(event))
|
if (size != sizeof(event))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "player: problem when reading thread event. size = %zd\n", size);
|
ERR("player: problem when reading thread event. size = %zd", size);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -774,6 +780,24 @@ main(int argc, const char *argv[])
|
||||||
int tpipe[2]; // pipe for comunicating events from threads
|
int tpipe[2]; // pipe for comunicating events from threads
|
||||||
char cwidth[64], cheight[64], cpitch[64], chroma[64];
|
char cwidth[64], cheight[64], cpitch[64], chroma[64];
|
||||||
char buf[64];
|
char buf[64];
|
||||||
|
|
||||||
|
if (!eina_init())
|
||||||
|
{
|
||||||
|
EINA_LOG_CRIT("Can't initialize generic vlc player, eina failed.");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
_em_vlc_log_dom = eina_log_domain_register("emotion_generic_vlc",
|
||||||
|
EINA_COLOR_CYAN);
|
||||||
|
if (_em_vlc_log_dom < 0)
|
||||||
|
{
|
||||||
|
EINA_LOG_CRIT("Unable to register emotion_generic_vlc log domain.");
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!eina_log_domain_level_check(_em_vlc_log_dom, EINA_LOG_LEVEL_WARN))
|
||||||
|
eina_log_domain_level_set("emotion_generic_vlc", EINA_LOG_LEVEL_WARN);
|
||||||
|
|
||||||
const char *vlc_argv[] =
|
const char *vlc_argv[] =
|
||||||
{
|
{
|
||||||
"--quiet",
|
"--quiet",
|
||||||
|
@ -791,9 +815,9 @@ main(int argc, const char *argv[])
|
||||||
|
|
||||||
if (argc < 3)
|
if (argc < 3)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "player: missing paramters.\n");
|
ERR("missing parameters.");
|
||||||
fprintf(stderr, "syntax:\n\t%s <fd read> <fd write>\n", argv[0]);
|
ERR("syntax:\n\t%s <fd read> <fd write>", argv[0]);
|
||||||
return -1;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
app.em_read = atoi(argv[1]);
|
app.em_read = atoi(argv[1]);
|
||||||
|
@ -829,8 +853,8 @@ main(int argc, const char *argv[])
|
||||||
|
|
||||||
if (_em_cmd_read(&app) != EM_CMD_INIT)
|
if (_em_cmd_read(&app) != EM_CMD_INIT)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "player: wrong init command!\n");
|
ERR("wrong init command!");
|
||||||
return -1;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
int size;
|
int size;
|
||||||
|
@ -859,22 +883,18 @@ main(int argc, const char *argv[])
|
||||||
continue;
|
continue;
|
||||||
else if (r < 0)
|
else if (r < 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
ERR("an error ocurred on poll(): %s", strerror(errno));
|
||||||
"emotion_generic_vlc: an error ocurred on poll(): %s\n",
|
|
||||||
strerror(errno));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fds[0].revents & (POLLERR | POLLHUP | POLLNVAL))
|
if (fds[0].revents & (POLLERR | POLLHUP | POLLNVAL))
|
||||||
{
|
{
|
||||||
fputs("emotion_generic_vlc: error communicating with stdin\n",
|
ERR("error communicating with stdin", stderr);
|
||||||
stderr);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (fds[1].revents & (POLLERR | POLLHUP | POLLNVAL))
|
if (fds[1].revents & (POLLERR | POLLHUP | POLLNVAL))
|
||||||
{
|
{
|
||||||
fputs("emotion_generic_vlc: error communicating with thread\n",
|
ERR("error communicating with thread", stderr);
|
||||||
stderr);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -887,8 +907,10 @@ main(int argc, const char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
libvlc_release(app.libvlc);
|
libvlc_release(app.libvlc);
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
eina_shutdown();
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
#undef SEND_CMD_PARAM
|
#undef SEND_CMD_PARAM
|
||||||
|
|
Loading…
Reference in New Issue