1 /*
2  * This file is part of MPlayer.
3  *
4  * MPlayer 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.
8  *
9  * MPlayer 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 General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with MPlayer; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef MPLAYER_GUI_INTERFACE_H
20 #define MPLAYER_GUI_INTERFACE_H
21 
22 #include "m_config.h"
23 #include "mp_core.h"
24 #include "playtree.h"
25 #include "libaf/af.h"
26 #include "libmpdemux/stheader.h"
27 #include "stream/stream.h"
28 
29 // These are in support of the non-GUI files that interact with
30 // the GUI and that only need to include interface.h for this.
31 // ------------------------------------------------------------
32 #include "app/cfg.h"
33 
34 extern int use_gui;             // this is defined in mplayer.c
35 // ------------------------------------------------------------
36 
37 /// Name of the GUI binary
38 #define gmplayer "gmplayer"
39 
40 /// gui() instructions
41 enum {
42     GUI_END_PLAY,
43     GUI_HANDLE_X_EVENT,
44     GUI_PREPARE,
45     GUI_REDRAW,
46     GUI_RUN_COMMAND,
47     GUI_RUN_MESSAGE,
48     GUI_SETUP_VIDEO_WINDOW,
49     GUI_SET_AUDIO,
50     GUI_SET_CONTEXT,
51     GUI_SET_STATE,
52     GUI_SET_STREAM,
53     GUI_SET_VOLUME_BALANCE,
54     GUI_SET_VIDEO
55 };
56 
57 /// guiPlaylist() instructions
58 enum {
59     GUI_PLAYLIST_INIT,
60     GUI_PLAYLIST_ADD
61 };
62 
63 //@{
64 /// Playing state
65 #define GUI_STOP  0
66 #define GUI_PLAY  1
67 #define GUI_PAUSE 2
68 //@}
69 
70 //@{
71 /// MediumChanged reason
72 #define GUI_MEDIUM_SAME 1
73 #define GUI_MEDIUM_NEW  2
74 //@}
75 
76 /// mplayer() instructions
77 enum {
78     MPLAYER_EXIT_GUI,
79     MPLAYER_LOAD_FONT,
80     MPLAYER_SET_AUTO_QUALITY,
81     MPLAYER_SET_BRIGHTNESS,
82     MPLAYER_SET_CONTRAST,
83     MPLAYER_SET_EQUALIZER,
84     MPLAYER_SET_EXTRA_STEREO,
85     MPLAYER_SET_FONT_AUTOSCALE,
86     MPLAYER_SET_FONT_BLUR,
87     MPLAYER_SET_FONT_ENCODING,
88     MPLAYER_SET_FONT_FACTOR,
89     MPLAYER_SET_FONT_OSDSCALE,
90     MPLAYER_SET_FONT_OUTLINE,
91     MPLAYER_SET_FONT_TEXTSCALE,
92     MPLAYER_SET_HUE,
93     MPLAYER_SET_PANSCAN,
94     MPLAYER_SET_SATURATION,
95     MPLAYER_SET_SUB_ENCODING
96 };
97 
98 typedef struct {
99     MPContext *mpcontext;
100     sh_video_t *sh_video;
101 
102     int VideoWindow;
103     int VideoWidth;
104     int VideoHeight;
105 
106     int Rotation;
107 
108     char *CodecName;
109 
110     int StreamType;
111     int AudioChannels;
112 
113     int AudioPassthrough;
114 
115     int AudioStreams;
116     stream_language_t AudioStream[32];
117 
118     int Subtitles;
119     stream_language_t Subtitle[32];
120 
121     char *Filename;           // public, read access by MPlayer
122     char *Title;
123     char *AudioFilename;
124     char *SubtitleFilename;
125     char *ImageFilename;
126 
127     int Tracks;
128     int Track;                // public, read access by MPlayer
129     int Chapters;
130     int Chapter;              // public, write access by MPlayer
131     int Angles;
132     int Angle;
133 
134     int Playing;              // public, read access by MPlayer
135 
136     int RunningTime;          // public, write access by MPlayer
137     int ElapsedTime;          // public, write access by MPlayer
138     float Position;           // public, write access by MPlayer
139 
140     float Volume;
141     float Balance;
142 
143     float LastVolume;
144     float ReplayGainVolume;
145     int MediumChanged;        // public, read access by MPlayer
146     int PlaylistNext;
147 
148     int Start;
149     int Stop;
150 } guiInterface_t;
151 
152 extern guiInterface_t guiInfo;
153 
154 void reset_stream_ids(void);
155 
156 /// @name MPlayer -> GUI
157 //@{
158 int gui(int what, void *data);
159 void guiDone(void);
160 void guiInit(void);
161 int guiPlaylist(int what, play_tree_t *playtree, m_config_t *config, int enqueue);
162 //@}
163 
164 /// @name GUI -> MPlayer
165 //@{
166 void mplayer(int what, float value, void *data);
167 void mplayerLoadSubtitle(const char *name);
168 void gmp_msg(int mod, int lev, const char *format, ...);
169 //@}
170 
171 #endif /* MPLAYER_GUI_INTERFACE_H */
172