Another off-by-one found by valgrind.
[monky] / src / audacious.h
index c7bde58..0e64cde 100644 (file)
@@ -1,11 +1,9 @@
-/* -------------------------------------------------------------------------
- * audacious.h:  conky support for Audacious audio player
- * 
- * http://audacious-media-player.org
- * 
- * Copyright (C) 2005  Philip Kovacs kovacsp3@comcast.net
+/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
+ * vim: ts=4 sw=4 noet ai cindent syntax=c
  *
- * $Id$
+ * audacious.h:  conky support for audacious music player
+ *
+ * Copyright (C) 2005-2007 Philip Kovacs pkovacs@users.sourceforge.net
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- * --------------------------------------------------------------------------- */
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
+ * USA.
+ *
+ */
 
 #ifndef AUDACIOUS_H
 #define AUDACIOUS_H
 
-/* 11 keys comprise the audacious information. */
-enum _audacious_keys {
-       AUDACIOUS_STATUS,
-       AUDACIOUS_SONG,
-       AUDACIOUS_SONG_LENGTH,
-       AUDACIOUS_SONG_LENGTH_SECONDS,
-       AUDACIOUS_SONG_LENGTH_FRAMES,
-       AUDACIOUS_SONG_OUTPUT_LENGTH,
-       AUDACIOUS_SONG_OUTPUT_LENGTH_SECONDS,
-       AUDACIOUS_SONG_OUTPUT_LENGTH_FRAMES,
-       AUDACIOUS_SONG_BITRATE,
-       AUDACIOUS_SONG_FREQUENCY,
-       AUDACIOUS_SONG_CHANNELS
+#include "timed_thread.h"
+
+enum _audacious_items {
+       AUDACIOUS_STATUS = 0,
+       AUDACIOUS_TITLE,
+       AUDACIOUS_LENGTH,
+       AUDACIOUS_LENGTH_SECONDS,
+       AUDACIOUS_POSITION,
+       AUDACIOUS_POSITION_SECONDS,
+       AUDACIOUS_BITRATE,
+       AUDACIOUS_FREQUENCY,
+       AUDACIOUS_CHANNELS,
+       AUDACIOUS_FILENAME,
+       AUDACIOUS_PLAYLIST_LENGTH,
+       AUDACIOUS_PLAYLIST_POSITION,
+       AUDACIOUS_MAIN_VOLUME,
 };
-               
-/* 11 slots for the audacious values */
-typedef char audacious_t[11][128];
+
+/* 12 slots for the audacious values */
+typedef char audacious_t[13][128];
+
+/* type for data exchange with main thread */
+typedef struct audacious_s {
+  audacious_t items;  /* e.g. items[AUDACIOUS_STATUS] */
+  int max_title_len;  /* e.g. ${audacious_title 50} */
+  timed_thread *p_timed_thread;
+} AUDACIOUS_S;
+
+/* create a worker thread for audacious media player status */
+int create_audacious_thread(void);
+
+/* destroy audacious media player worker thread */
+int destroy_audacious_thread(void);
 
 /* Service routine for the conky main thread */
 void update_audacious(void);
 
-/* Thread function */
+/* Thread functions */
 void *audacious_thread_func(void *);
 
 #endif