user_interface.h 3.37 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 26
 *
 * 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__

#include "gst_engine.h"
27
#include "screensaver.h"
28

29
#define CTL_SHOW_SEC 3
30
#define CTL_FADE_DURATION G_TIME_SPAN_MILLISECOND / 4
31

32
#define CTL_BORDER 0
33
#define SHADOW_CORRECT 15
34 35 36 37 38 39 40 41 42 43 44
#define CTL_SPACING 0

#define CONTROLS_WIDTH_RATIO 0.8f
#define CONTROLS_HEIGHT_RATIO 0.25f
#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
45 46
#define MAIN_BOX_W 0.95f
#define MAIN_BOX_H 0.8f
47 48 49 50

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

#define TITLE_LENGTH 40

#define SEC_IN_HOUR 3600
#define SEC_IN_MIN 60
62

63
#define PENALTY_TIME G_TIME_SPAN_MILLISECOND / 2
64

65 66
G_BEGIN_DECLS

67 68 69 70 71 72 73
enum
{
  STREAM_AUDIO,
  STREAM_TEXT,
  STREAM_VIDEO
};

74
typedef struct _UserInterface UserInterface;
75 76 77

struct _UserInterface
{
78
  gboolean controls_showing, keep_showing_controls;
79
  gboolean blind, fullscreen, hide, penalty_box_active, tags;
80

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

88 89
  gchar *filename, *fileuri;
  gchar *play_png, *pause_png;
90
  gchar *segment_png;
91
  gchar *volume_low_png, *volume_high_png;
92
  gchar *subtitle_toggle_png;
93
  gchar *video_stream_toggle_png, *audio_stream_toggle_png;
94
  gchar *duration_str;
95

96 97
  GList *uri_list;

98
  ClutterColor stage_color, control_color1, control_color2;
99

100
  ClutterActor *stage;
101 102 103 104
  ClutterActor *texture;
  ClutterActor *control_box;
  ClutterActor *control_bg, *control_title, *control_play_toggle;
  ClutterActor *control_seek1, *control_seek2, *control_seekbar;
105
  ClutterActor *control_pos;
106 107
  ClutterActor *volume_box;
  ClutterActor *volume_low, *volume_high;
108
  ClutterActor *subtitle_toggle;
109
  ClutterActor *video_stream_toggle, *audio_stream_toggle;
110
  ClutterActor *vol_int, *vol_int_bg, *volume_point;
111
  ClutterActor *info_box;
112
  ClutterActor *main_box;
113

114
  GstEngine *engine;
115
  ScreenSaver *screensaver;
116 117 118
};

// Declaration of non-static functions
119
void interface_init (UserInterface * ui);
120
gboolean interface_load_uri (UserInterface * ui, gchar * uri);
121
void interface_play_next_or_prev (UserInterface * ui, gboolean next);
122
void interface_start (UserInterface * ui, gchar * uri);
123
gboolean interface_update_controls (UserInterface * ui);
124 125 126

G_END_DECLS
#endif /* __USER_INTERFACE_H__ */