user_interface.h 3.77 KB
Newer Older
1
/*
2
 * snappy - 0.2
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
 *
 * Copyright (C) 2011 Collabora Multimedia Ltd.
 * <luis.debethencourt@collabora.co.uk>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
 * USA
 */

#ifndef __USER_INTERFACE_H__
#define __USER_INTERFACE_H__

26 27
#include <gtk/gtk.h>

28
#include "gst_engine.h"
29
#include "screensaver.h"
30

31
#define CTL_SHOW_SEC 3
32
#define CTL_FADE_DURATION G_TIME_SPAN_MILLISECOND / 4
33

34
#define CTL_BORDER 0
35
#define SHADOW_CORRECT 15
36 37
#define CTL_SPACING 0

38 39
#define CONTROLS_WIDTH_RATIO 0.48f
#define CONTROLS_HEIGHT_RATIO 0.28f
40 41 42 43 44 45 46
#define CONTROLS_ASPECT_RATIO 4.0f

#define BG_W 986.0f
#define BG_H 162.0f
#define SHADOW_RIGHT 18.0f
#define SHADOW_BOTTOM 11.0f

Robert Swain's avatar
Robert Swain committed
47 48
#define MAIN_BOX_W 0.95f
#define MAIN_BOX_H 0.8f
49

50
#define PLAY_TOGGLE_RATIO 0.45f
51
#define TITLE_RATIO 0.04f
52
#define SEEK_WIDTH_RATIO 0.9f
Robert Swain's avatar
Robert Swain committed
53
#define SEEK_HEIGHT_RATIO 0.15f
54 55 56
#define SEEK_BORDER 2.0f
#define POS_RATIO 0.1f
#define VOLUME_ICON_RATIO 0.2f
Robert Swain's avatar
Robert Swain committed
57 58
#define VOLUME_WIDTH_RATIO 0.65f
#define VOLUME_HEIGHT_RATIO 0.05f
59 60 61 62 63

#define TITLE_LENGTH 40

#define SEC_IN_HOUR 3600
#define SEC_IN_MIN 60
64

65
#define PENALTY_TIME G_TIME_SPAN_MILLISECOND / 2
66

67 68 69
#define DEFAULT_WIDTH 640
#define DEFAULT_HEIGHT 480

70 71
G_BEGIN_DECLS

72 73 74 75 76 77 78
enum
{
  STREAM_AUDIO,
  STREAM_TEXT,
  STREAM_VIDEO
};

79
typedef struct _UserInterface UserInterface;
80 81 82

struct _UserInterface
{
83
  gboolean controls_showing, keep_showing_controls;
84
  gboolean blind, fullscreen, hide, penalty_box_active, tags;
85
  gboolean subtitles_available;
86

87
  gint title_length, controls_timeout, progress_id;
88 89
  guint media_width, media_height;
  guint stage_width, stage_height;
90
  gint64 media_duration;
91
  gfloat seek_width, seek_height;
92
  gfloat volume_width, volume_height;
93

94 95
  gchar *filename, *fileuri;
  gchar *play_png, *pause_png;
96
  gchar *segment_png;
97
  gchar *volume_low_png, *volume_high_png;
98
  gchar *subtitle_active_png, *subtitle_inactive_png;
99
  gchar *video_stream_toggle_png, *audio_stream_toggle_png;
Andoni Morales's avatar
Andoni Morales committed
100
  gchar *data_dir;
101
  gchar *duration_str;
102

103 104
  GList *uri_list;

105 106
  GtkWidget *window, *box, *clutter_widget;

107
  ClutterColor stage_color, control_color1, control_color2;
108

109
  ClutterActor *stage;
110 111 112 113
  ClutterActor *texture;
  ClutterActor *control_box;
  ClutterActor *control_bg, *control_title, *control_play_toggle;
  ClutterActor *control_seek1, *control_seek2, *control_seekbar;
114
  ClutterActor *control_pos;
115 116
  ClutterActor *volume_box;
  ClutterActor *volume_low, *volume_high;
117
  ClutterActor *subtitle_toggle;
118
  ClutterActor *video_stream_toggle, *audio_stream_toggle;
119
  ClutterActor *vol_int, *vol_int_bg, *volume_point;
120
  ClutterActor *info_box;
121
  ClutterActor *pos_n_vol_box;
122
  ClutterActor *main_box;
123

124
  ClutterLayoutManager *main_box_layout;
125
  ClutterLayoutManager *info_box_layout;
126
  ClutterLayoutManager *pos_n_vol_layout;
127

128
  GstEngine *engine;
129
  ScreenSaver *screensaver;
130 131 132
};

// Declaration of non-static functions
133
void interface_init (UserInterface * ui);
134
gboolean interface_is_it_last (UserInterface * ui);
135
gboolean interface_load_uri (UserInterface * ui, gchar * uri);
136
void interface_play_next_or_prev (UserInterface * ui, gboolean next);
137
void interface_start (UserInterface * ui, gchar * uri);
138
gboolean interface_update_controls (UserInterface * ui);
139 140 141

G_END_DECLS
#endif /* __USER_INTERFACE_H__ */