2 // banshee-player-private.h
5 // Aaron Bockover <abockover@novell.com>
6 // Julien Moutte <julien@fluendo.com>
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
40 #include <gst/base/gstadapter.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>
53 #include "banshee-gst.h"
56 #define P_INVOKE __declspec(dllexport)
57 #define MYEXPORT __declspec(dllexport)
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>
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)
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)
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
);
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
{
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
;
132 GstElement
*audiotee
;
133 GstElement
*audiobin
;
134 GstElement
*equalizer
;
137 GstElement
*rgvolume
;
139 GstElement
*before_rgvolume
;
140 GstElement
*after_rgvolume
;
141 gboolean rgvolume_in_pipeline
;
143 gint equalizer_status
;
145 // Pipeline/Playback State
147 GMutex
*replaygain_mutex
;
148 GstState target_state
;
151 gboolean in_gapless_transition
;
152 gboolean supports_stream_volume
;
153 gboolean audiosink_has_volume
;
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
;
174 // Visualization State
175 GstElement
*vis_resampler
;
176 GstAdapter
*vis_buffer
;
177 gboolean vis_enabled
;
178 gboolean vis_thawing
;
180 GstFFTF32Complex
*vis_fft_buffer
;
181 gfloat
*vis_fft_sample_buffer
;
183 // Plugin Installer State
185 GSList
*missing_element_details
;
186 GSList
*missing_element_details_handled
;
187 gboolean handle_missing_elements
;
188 GstInstallPluginsContext
*install_plugins_context
;
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];
202 #endif /* _BANSHEE_PLAYER_PRIVATE_H */