From: Maksym Veremeyenko Date: Wed, 22 Jun 2011 05:17:57 +0000 (+0300) Subject: library implementation skeleton added X-Git-Url: http://research.m1stereo.tv/gitweb?a=commitdiff_plain;h=2fa18b4bcda04deff180348cf675f571f79aad17;p=omnplay library implementation skeleton added --- diff --git a/configure.in b/configure.in index 26f678e..335daad 100644 --- a/configure.in +++ b/configure.in @@ -20,6 +20,10 @@ PKG_CHECK_MODULES(GTHREAD, [gthread-2.0 >= 2.26.0]) AC_SUBST(GTHREAD_CFLAGS) AC_SUBST(GTHREAD_LIBS) +PKG_CHECK_MODULES(CURL, [libcurl]) +AC_SUBST(CURL_CFLAGS) +AC_SUBST(CURL_LIBS) + AC_ARG_WITH([ommedia], [AS_HELP_STRING([--with-ommedia=path], [path to ommedia /Media API/])], [OMMEDIA_PATH=$withval], diff --git a/src/Makefile.am b/src/Makefile.am index f7b2fe1..3cd39b5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,7 +3,7 @@ INCLUDES = \ -DPACKAGE_DATA_DIR=\""$(datadir)"\" \ -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \ - @GTHREAD_CFLAGS@ @GTK_CFLAGS@ @OM_CFLAGS@ + @GTHREAD_CFLAGS@ @GTK_CFLAGS@ @OM_CFLAGS@ @CURL_CFLAGS@ bin_PROGRAMS = omnplay @@ -14,7 +14,8 @@ omnplay_SOURCES = \ ui_buttons.c ui_buttons.h \ opts.c opts.h \ playlist.c \ + library.c \ timecode.c timecode.h \ omnplay.cpp omnplay.h -omnplay_LDADD = @GTHREAD_LIBS@ @GTK_LIBS@ @OM_LIBS@ +omnplay_LDADD = @GTHREAD_LIBS@ @GTK_LIBS@ @OM_LIBS@ @CURL_LIBS@ diff --git a/src/library.c b/src/library.c new file mode 100644 index 0000000..27dabce --- /dev/null +++ b/src/library.c @@ -0,0 +1,45 @@ +/* + * playlist.c -- GTK+ 2 omnplay + * Copyright (C) 2011 Maksym Veremeyenko + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "omnplay.h" +#include "ui.h" +#include "timecode.h" + +void omnplay_library_load(omnplay_instance_t* app) +{ +}; + +void omnplay_library_save(omnplay_instance_t* app) +{ +}; + +void omnplay_library_refresh(omnplay_instance_t* app) +{ +}; diff --git a/src/omnplay.cpp b/src/omnplay.cpp index a58b8ee..5535828 100644 --- a/src/omnplay.cpp +++ b/src/omnplay.cpp @@ -873,7 +873,9 @@ static gboolean omnplay_button_click(omnplay_instance_t* app, control_buttons_t omnplay_ctl(app, button); break; case BUTTON_LIBRARY_ADD: + break; case BUTTON_LIBRARY_REFRESH: + omnplay_library_refresh(app); break; }; @@ -972,6 +974,11 @@ void omnplay_init(omnplay_instance_t* app) gtk_signal_connect(GTK_OBJECT(app->buttons[i]), "clicked", GTK_SIGNAL_FUNC( on_button_click), app ); + /* create lock */ + pthread_mutex_init(&app->library.lock, &attr); + + /* load library */ + omnplay_library_load(app); }; void omnplay_release(omnplay_instance_t* app) @@ -990,4 +997,10 @@ void omnplay_release(omnplay_instance_t* app) /* destroy lock */ pthread_mutex_destroy(&app->playlist.lock); + + /* load library */ + omnplay_library_save(app); + + /* destroy library lock */ + pthread_mutex_destroy(&app->library.lock); }; diff --git a/src/omnplay.h b/src/omnplay.h index c3b96c8..f94789d 100644 --- a/src/omnplay.h +++ b/src/omnplay.h @@ -85,6 +85,7 @@ typedef enum playlist_item_type } playlist_item_type_t; #define MAX_PLAYLIST_ITEMS 1024 +#define MAX_LIBRARY_ITEMS 10240 typedef struct playlist_item { @@ -139,6 +140,14 @@ typedef struct omnplay_instance char* path; GdkPixbuf *block_icons[8]; } playlist; + struct + { + playlist_item_t item[MAX_LIBRARY_ITEMS]; + int count; + char filename[PATH_MAX]; + char whois[PATH_MAX]; + pthread_mutex_t lock; + } library; } omnplay_instance_t; omnplay_instance_t* omnplay_create(int argc, char** argv); @@ -150,6 +159,9 @@ void omnplay_playlist_save(omnplay_instance_t* app); void omnplay_playlist_draw(omnplay_instance_t* app); void omnplay_playlist_draw_item(omnplay_instance_t* app, int idx); void omnplay_playlist_draw_item_rem(omnplay_instance_t* app, int idx, char* rem); +void omnplay_library_load(omnplay_instance_t* app); +void omnplay_library_save(omnplay_instance_t* app); +void omnplay_library_refresh(omnplay_instance_t* app); #ifdef __cplusplus }; diff --git a/src/opts.c b/src/opts.c index a5a9868..eb2868b 100644 --- a/src/opts.c +++ b/src/opts.c @@ -35,6 +35,8 @@ static const struct option long_options [] = { { "directory", required_argument, NULL, '0'}, { "player", required_argument, NULL, '1'}, + { "library", required_argument, NULL, '2'}, + { "whois", required_argument, NULL, '3'}, { "help", no_argument, NULL, 'h'}, { 0, 0, 0, 0} }; @@ -79,6 +81,16 @@ int omnplay_opt(int argc, char** argv, omnplay_instance_t* app) }; break; + /** --library */ + case '2': + strncpy(app->library.filename, optarg, PATH_MAX); + break; + + /** --whois */ + case '3': + strncpy(app->library.whois, optarg, PATH_MAX); + break; + default: fprintf(stderr, "ERROR: Incorrect argument!\n"); return 1;