2
* Copyright (C) 2007 Michael Lamothe
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU Library General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
19
#ifndef __APPLICATION_H__
20
#define __APPLICATION_H__
22
#include "main_window.h"
23
#include "dvb_tuner.h"
24
#include "configuration.h"
27
#include "channel_manager.h"
30
#include "recording_manager.h"
31
#include "status_icon.h"
33
#define APPLICATION_NAME "Me TV"
34
#define CHECK_MAIN_THREAD Application::get_current().check_thread(__PRETTY_FUNCTION__);
39
IO::Channel* log_file;
40
Configuration configuration;
42
ChannelManager channel_manager;
45
MainWindow* main_window;
46
StatusIcon* status_icon;
47
GtkWidget* about_dialog;
48
GThread* stream_thread;
50
GStaticRecMutex stream_mutex;
51
GStaticRecMutex configuration_mutex;
52
GStaticRecMutex error_message_mutex;
53
GStaticRecMutex epg_mutex;
54
gboolean terminate_threads;
56
Glib::ustring recording_file_name;
57
FileStream* recording_file_stream;
58
UdpSocket* network_stream;
59
RecordingManager* recording_manager;
61
GSList* error_messages;
62
GSList* auto_surf_iterator;
64
Glib::ustring demux_path;
65
Glib::ustring dvr_path;
66
Glib::ustring exe_path;
67
Glib::ustring exe_directory;
68
Glib::ustring video_channel_name;
69
guint epg_event_list_size;
70
gboolean application_quit;
72
static gboolean on_timer(gpointer data);
73
static gpointer epg_thread_function(Application* application);
74
static gpointer stream_thread_function(Application* application);
75
static gpointer startup_thread_function(Application* application);
79
void start_epg_thread();
80
const Transponder& get_current_transponder();
81
void stream_loop(FileStream& input);
82
Glib::ustring fix_path(const Glib::ustring& path);
83
Glib::ustring get_configuration_path();
84
time_t last_auto_surf_time;
87
Application (int argc, char** argv);
90
static void run(int argc, char** argv);
91
static Application& get_current();
92
static Glib::ustring get_directory();
94
Configuration& get_configuration() { return configuration; }
96
void push_error_message(const Glib::ustring& message);
97
void check_error_messages();
98
void push_epg_event(const EpgEvent& event);
99
void check_epg_events();
101
IO::Channel& get_log_file();
102
Glade& get_glade() { return glade; }
103
Epg& get_epg() { return epg; }
104
RecordingManager& get_recording_manager();
106
ChannelManager& get_channel_manager() { return channel_manager; }
107
Channel& get_channel(const Glib::ustring& channel_name);
108
Channel& get_channel(int frequency, int service_id);
109
void change_channel (const Glib::ustring& channel_name, gboolean keep_auto_surf = false );
110
void change_channel (Channel& channel, gboolean keep_auto_surf = false );
112
Channel& get_video_channel();
113
const Glib::ustring& get_video_channel_name() const;
114
Glib::ustring get_video_event_title();
117
void start_record(const Glib::ustring& title);
118
void start_record(Channel& channel, const Glib::ustring& title);
119
void start_record_force(Channel& channel, const Glib::ustring& title);
120
Glib::ustring get_recording_file_name() const { return recording_file_name; }
121
void toggle_record();
122
void record(gboolean state);
124
void hide_controls();
126
void toggle_visibility();
128
void toggle_fullscreen();
129
void toggle_controls();
132
void mute(gboolean state);
134
void toggle_broadcast();
135
void broadcast(gboolean state);
137
void toggle_auto_surf();
138
void auto_surf(gboolean state);
140
void audio_channel(int channel);
141
void subtitle_channel(int channel);
145
gboolean check_main_thread(const Glib::ustring& caller);
147
void show_scheduled_recording_dialog();
148
void show_event_dialog (const Glib::ustring& channel_name, int event_id);
149
void show_scheduled_recording_dialog(const Glib::ustring& description);
150
void show_scheduled_recordings_dialog();
151
Glib::ustring get_test_path() const;
153
const Glib::ustring& get_exe_path() const { return exe_path; }
155
Glib::ustring get_status_message();