Merged from INCSCHED on 200505251!!!
[platform/upstream/gstreamer.git] / gstplay / gstplay.h
1 #ifndef __GSTPLAY_H__
2 #define __GSTPLAY_H__
3
4 #include <gst/gst.h>
5
6 #define GST_TYPE_PLAY          (gst_play_get_type ())
7 #define GST_PLAY(obj)          (GTK_CHECK_CAST ((obj), GST_TYPE_PLAY, GstPlay))
8 #define GST_PLAY_CLASS(klass)  (GTK_CHECK_CLASS_CAST ((klass), GST_TYPE_PLAY, GstPlayClass))
9 #define GST_IS_PLAY(obj)       (GTK_CHECK_TYPE ((obj), GST_TYPE_PLAY))
10 #define GST_IS_PLAY_CLASS(obj) (GTK_CHECK_CLASS_TYPE ((klass), GST_TYPE_PLAY))
11
12 typedef struct _GstPlay GstPlay;
13 typedef struct _GstPlayClass GstPlayClass;
14
15 typedef enum {
16         GST_PLAY_STOPPED,
17         GST_PLAY_PLAYING,
18         GST_PLAY_PAUSED,
19 } GstPlayState;
20
21 typedef enum {
22   GST_PLAY_OK,
23   GST_PLAY_UNKNOWN_MEDIA,
24   GST_PLAY_CANNOT_PLAY,
25   GST_PLAY_ERROR,
26 } GstPlayReturn;
27
28 typedef enum {
29         GST_PLAY_TYPE_AUDIO = (1 << 0),
30         GST_PLAY_TYPE_VIDEO = (1 << 1),
31 } GstPlayMediaTypeFlags;
32
33 struct _GstPlay {
34         GtkHBox parent;
35         
36         GstPlayState state;
37         GstPlayMediaTypeFlags flags;
38         
39         gpointer priv;
40 };
41
42 #define GST_PLAY_STATE(play)         ((play)->state)
43 #define GST_PLAY_MEDIA_TYPE(play)    ((play)->flags)
44 #define GST_PLAY_IS_AUDIO_TYPE(play) ((play)->flags & GST_PLAY_TYPE_AUDIO)
45 #define GST_PLAY_IS_VIDEO_TYPE(play) ((play)->flags & GST_PLAY_TYPE_VIDEO)
46
47 struct _GstPlayClass {
48         GtkHBoxClass parent_class;
49
50         void (*state_changed)   (GstPlay *play, GstPlayState state);
51         void (*frame_displayed) (GstPlay *play);
52         void (*audio_played)    (GstPlay *play);
53 };
54
55
56 GtkType         gst_play_get_type               (void);
57
58 /* setup the player */
59 GstPlay*        gst_play_new                    (void);
60 GstPlayReturn   gst_play_set_uri                (GstPlay *play, const guchar *uri);
61
62 /* control the player */
63 void            gst_play_play                   (GstPlay *play);
64 void            gst_play_pause                  (GstPlay *play);
65 void            gst_play_stop                   (GstPlay *play);
66
67 void            gst_play_mute                   (GstPlay *play, gboolean mute);
68
69 /* information about the media stream */
70 gulong          gst_play_get_media_size         (GstPlay *play);
71 gulong          gst_play_get_media_offset       (GstPlay *play);
72 gboolean        gst_play_media_can_seek         (GstPlay *play);
73 void            gst_play_media_seek             (GstPlay *play, gulong offset);
74
75 gulong          gst_play_get_media_total_time   (GstPlay *play);
76 gulong          gst_play_get_media_current_time (GstPlay *play);
77
78 /* set display stuff */
79 void            gst_play_set_display_size       ();
80
81 /* the autoplugged pipeline */
82 GstElement*     gst_play_get_pipeline           (GstPlay *play);
83
84 #endif /* __GSTPLAY_H__ */