user_interface.h 3.66 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
G_BEGIN_DECLS

69 70 71 72 73 74 75
enum
{
  STREAM_AUDIO,
  STREAM_TEXT,
  STREAM_VIDEO
};

76
typedef struct _UserInterface UserInterface;
77 78 79

struct _UserInterface
{
80
  gboolean controls_showing, keep_showing_controls;
81
  gboolean blind, fullscreen, hide, penalty_box_active, tags;
82

83
  gint title_length, controls_timeout, progress_id;
84 85
  guint media_width, media_height;
  guint stage_width, stage_height;
86
  gint64 media_duration;
87
  gfloat seek_width, seek_height;
88
  gfloat volume_width, volume_height;
89

90 91
  gchar *filename, *fileuri;
  gchar *play_png, *pause_png;
92
  gchar *segment_png;
93
  gchar *volume_low_png, *volume_high_png;
94
  gchar *subtitle_toggle_png;
95
  gchar *video_stream_toggle_png, *audio_stream_toggle_png;
Andoni Morales's avatar
Andoni Morales committed
96
  gchar *data_dir;
97
  gchar *duration_str;
98

99 100
  GList *uri_list;

101 102
  GtkWidget *window, *box, *clutter_widget;

103
  ClutterColor stage_color, control_color1, control_color2;
104

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

120
  ClutterLayoutManager *main_box_layout;
121
  ClutterLayoutManager *info_box_layout;
122
  ClutterLayoutManager *pos_n_vol_layout;
123

124
  GstEngine *engine;
125
  ScreenSaver *screensaver;
126 127 128
};

// Declaration of non-static functions
129
void interface_init (UserInterface * ui);
130
gboolean interface_is_it_last (UserInterface * ui);
131
gboolean interface_load_uri (UserInterface * ui, gchar * uri);
132
void interface_play_next_or_prev (UserInterface * ui, gboolean next);
133
void interface_start (UserInterface * ui, gchar * uri);
134
gboolean interface_update_controls (UserInterface * ui);
135 136 137

G_END_DECLS
#endif /* __USER_INTERFACE_H__ */