~audio-recorder/audio-recorder/trunk

« back to all changes in this revision

Viewing changes to src/dbus-player.h

  • Committer: Osmo Antero
  • Date: 2019-03-02 21:05:03 UTC
  • Revision ID: osmoma@gmail.com-20190302210503-xx6k0p0v6movm6us
Fix problem with duplicate messages from media players.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#define PLAYER_STATUS_PAUSED  3
25
25
#define PLAYER_STATUS_NOTIFY_MSG 7  // Send notification message to the GUI
26
26
 
27
 
#define MPRIS_STRLEN (FILENAME_MAX - 4) // Set to max filename (FILENAME_MAX) in Linux
 
27
#define MPRIS_STRLEN (MAX_PATH_LEN - 4) 
28
28
 
29
29
#define STR_DELIM_CH '\v' 
30
30
 
35
35
typedef void (*StartPlayer)(gpointer player_rec); // player_rec = (MediaPlayerRec*)
36
36
 
37
37
typedef struct {
 
38
    gint32 status;  // One of the PLAYER_STATUS_* values
 
39
 
38
40
    gchar title[MPRIS_STRLEN+1];  // Song title (or GUI message if status==PLAYER_STATUS_NOTIFY_MSG)
39
41
 
40
42
    gchar artist[MPRIS_STRLEN+1]; // Artist names ('\v' separated list of artist names)
51
53
    gint64 audioBitrate;
52
54
    gint32 discNumber;
53
55
 
54
 
    gint32 status;  // One of the PLAYER_STATUS_* values
55
 
 
56
56
    gint64 trackLength; // Total track length in microseconds
57
57
    gint64 trackPos;  // Current stream position in microseconds
58
58
 
76
76
 
77
77
    TrackInfo track;     // See TrackInfo
78
78
 
 
79
    TrackInfo prev_track; // TrackInfo. Lastly processed track (avoid duplicates)
 
80
 
 
81
    gint32 msg_count;     // Duplicate message count. Just for debugging.
 
82
 
79
83
    GetTrackInfo func_get_info;  // Function to get track data; title/artist/album/music genre/time etc.
80
84
    SignalFunction func_set_signals;   // Function to connect/disconnect DBus signals
81
85
    AppIsRunning func_check_is_running;// Function to check if the app is running
82
86
    StartPlayer func_start_app;  // Function to run/start the player
 
87
 
83
88
} MediaPlayerRec;
84
89
 
85
90
void dbus_player_init();
98
103
void dbus_player_player_changed(gchar *service_name);
99
104
 
100
105
// Called by media players when they have new data
101
 
void dbus_player_process_data(gpointer player);
 
106
void dbus_player_process_data(gpointer player_rec, gboolean restart);
102
107
 
103
108
gchar *get_base_name(gchar *service_name);
104
109
 
105
110
void get_details_from_desktop_file(MediaPlayerRec *pl, const gchar *desktop_file);
106
111
 
 
112
void dbus_player_reset_values(gchar *audio_source);
 
113
 
107
114
#endif
108
115
 
109
116