Updated Slovenian translation
[banshee.git] / libbanshee / banshee-player-private.h
blob5286daf751f49ba0143cfc6a25560bedeb0f351e
1 //
2 // banshee-player-private.h
3 //
4 // Author:
5 // Aaron Bockover <abockover@novell.com>
6 // Julien Moutte <julien@fluendo.com>
7 //
8 // Copyright (C) 2005-2008 Novell, Inc.
9 // Copyright (C) 2010 Fluendo S.A.
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 #ifndef _BANSHEE_PLAYER_PRIVATE_H
32 #define _BANSHEE_PLAYER_PRIVATE_H
34 #ifdef HAVE_CONFIG_H
35 # include "config.h"
36 #endif
38 #include <string.h>
39 #include <gst/gst.h>
40 #include <gst/base/gstadapter.h>
41 #include <gdk/gdk.h>
42 #include <gst/fft/gstfftf32.h>
43 #include <gst/pbutils/pbutils.h>
45 #if defined(GDK_WINDOWING_X11)
46 # include <gdk/gdkx.h>
47 # include <gst/interfaces/xoverlay.h>
48 #elif defined(GDK_WINDOWING_WIN32)
49 # include <gdk/gdkwin32.h>
50 # include <gst/interfaces/xoverlay.h>
51 #endif
53 #include "banshee-gst.h"
55 #ifdef WIN32
56 #define P_INVOKE __declspec(dllexport)
57 #define MYEXPORT __declspec(dllexport)
58 #else
59 #define P_INVOKE
60 #define MYEXPORT
61 #endif
63 #define IS_BANSHEE_PLAYER(e) (e != NULL)
64 #define SET_CALLBACK(cb_name) { if(player != NULL) { player->cb_name = cb; } }
66 #define BANSHEE_CHECK_GST_VERSION(major,minor,micro) \
67 (GST_VERSION_MAJOR > (major) || \
68 (GST_VERSION_MAJOR == (major) && GST_VERSION_MINOR > (minor)) || \
69 (GST_VERSION_MAJOR == (major) && GST_VERSION_MINOR == (minor) && \
70 GST_VERSION_MICRO >= (micro)))
72 #if BANSHEE_CHECK_GST_VERSION(0,10,25)
73 #include <gst/interfaces/streamvolume.h>
74 #endif
76 #ifdef WIN32
77 #define bp_debug(x) banshee_log_debug ("player", x)
78 #define bp_debug2(x, a2) banshee_log_debug ("player", x, a2)
79 #define bp_debug3(x, a2, a3) banshee_log_debug ("player", x, a2, a3)
80 #define bp_debug4(x, a2, a3, a4) banshee_log_debug ("player", x, a2, a3, a4)
81 #define bp_debug5(x, a2, a3, a4, a5) banshee_log_debug ("player", x, a2, a3, a4, a5)
82 #else
83 #define bp_debug(x...) banshee_log_debug ("player", x)
84 #define bp_debug2(x...) banshee_log_debug ("player", x)
85 #define bp_debug3(x...) banshee_log_debug ("player", x)
86 #define bp_debug4(x...) banshee_log_debug ("player", x)
87 #define bp_debug5(x...) banshee_log_debug ("player", x)
88 #endif
90 typedef struct BansheePlayer BansheePlayer;
92 typedef void (* BansheePlayerEosCallback) (BansheePlayer *player);
93 typedef void (* BansheePlayerErrorCallback) (BansheePlayer *player, GQuark domain, gint code,
94 const gchar *error, const gchar *debug);
95 typedef void (* BansheePlayerStateChangedCallback) (BansheePlayer *player, GstState old_state,
96 GstState new_state, GstState pending_state);
97 typedef void (* BansheePlayerIterateCallback) (BansheePlayer *player);
98 typedef void (* BansheePlayerBufferingCallback) (BansheePlayer *player, gint buffering_progress);
99 typedef void (* BansheePlayerTagFoundCallback) (BansheePlayer *player, const gchar *tag, const GValue *value);
100 typedef void (* BansheePlayerVisDataCallback) (BansheePlayer *player, gint channels, gint samples, gfloat *data, gint bands, gfloat *spectrum);
101 typedef void (* BansheePlayerNextTrackStartingCallback) (BansheePlayer *player);
102 typedef void (* BansheePlayerAboutToFinishCallback) (BansheePlayer *player);
103 typedef GstElement * (* BansheePlayerVideoPipelineSetupCallback) (BansheePlayer *player, GstBus *bus);
104 typedef void (* BansheePlayerVideoPrepareWindowCallback) (BansheePlayer *player);
105 typedef void (* BansheePlayerVolumeChangedCallback) (BansheePlayer *player, gdouble new_volume);
106 typedef void (* BansheePlayerVideoGeometryNotifyCallback) (BansheePlayer *player, gint width, gint height, gint fps_n, gint fps_d, gint par_n, gint par_d);
108 typedef enum {
109 BP_VIDEO_DISPLAY_CONTEXT_UNSUPPORTED = 0,
110 BP_VIDEO_DISPLAY_CONTEXT_GDK_WINDOW = 1,
111 BP_VIDEO_DISPLAY_CONTEXT_CUSTOM = 2
112 } BpVideoDisplayContextType;
114 struct BansheePlayer {
115 // Player Callbacks
116 BansheePlayerEosCallback eos_cb;
117 BansheePlayerErrorCallback error_cb;
118 BansheePlayerStateChangedCallback state_changed_cb;
119 BansheePlayerIterateCallback iterate_cb;
120 BansheePlayerBufferingCallback buffering_cb;
121 BansheePlayerTagFoundCallback tag_found_cb;
122 BansheePlayerVisDataCallback vis_data_cb;
123 BansheePlayerNextTrackStartingCallback next_track_starting_cb;
124 BansheePlayerAboutToFinishCallback about_to_finish_cb;
125 BansheePlayerVideoPipelineSetupCallback video_pipeline_setup_cb;
126 BansheePlayerVideoPrepareWindowCallback video_prepare_window_cb;
127 BansheePlayerVolumeChangedCallback volume_changed_cb;
128 BansheePlayerVideoGeometryNotifyCallback video_geometry_notify_cb;
130 // Pipeline Elements
131 GstElement *playbin;
132 GstElement *audiotee;
133 GstElement *audiobin;
134 GstElement *equalizer;
135 GstElement *preamp;
136 GstElement *volume;
137 GstElement *rgvolume;
139 GstElement *before_rgvolume;
140 GstElement *after_rgvolume;
141 gboolean rgvolume_in_pipeline;
143 gint equalizer_status;
145 // Pipeline/Playback State
146 GMutex *video_mutex;
147 GMutex *replaygain_mutex;
148 GstState target_state;
149 gboolean buffering;
150 gchar *cdda_device;
151 gboolean in_gapless_transition;
152 gboolean supports_stream_volume;
153 gboolean audiosink_has_volume;
155 // Video State
156 BpVideoDisplayContextType video_display_context_type;
157 #if defined(GDK_WINDOWING_X11)
158 GstXOverlay *xoverlay;
159 GdkWindow *video_window;
160 XID video_window_xid;
161 #elif defined(GDK_WINDOWING_WIN32)
162 GstXOverlay *xoverlay;
163 GdkWindow *video_window;
164 HWND video_window_xid;
165 #endif
166 // Video geometry
167 gint width;
168 gint height;
169 gint fps_n;
170 gint fps_d;
171 gint par_n;
172 gint par_d;
174 // Visualization State
175 GstElement *vis_resampler;
176 GstAdapter *vis_buffer;
177 gboolean vis_enabled;
178 gboolean vis_thawing;
179 GstFFTF32 *vis_fft;
180 GstFFTF32Complex *vis_fft_buffer;
181 gfloat *vis_fft_sample_buffer;
183 // Plugin Installer State
184 GdkWindow *window;
185 GSList *missing_element_details;
186 GSList *missing_element_details_handled;
187 gboolean handle_missing_elements;
188 GstInstallPluginsContext *install_plugins_context;
190 // ReplayGain State
191 gboolean replaygain_enabled;
193 // ReplayGain history: stores the previous 10 scale factors
194 // and the current scale factor with the current at index 0
195 // and the oldest at index 10. History is used to compute
196 // gain on a track where no adjustment information is present.
197 // http://replaygain.hydrogenaudio.org/player_scale.html
198 gdouble rg_gain_history[10];
199 gint history_size;
202 #endif /* _BANSHEE_PLAYER_PRIVATE_H */