2 * Copyright (C) 2007-2008 Benjamin Otte <otte@gnome.org>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library 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 GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301 USA
20 #ifndef _SWFDEC_NET_STREAM_H_
21 #define _SWFDEC_NET_STREAM_H_
23 #include <swfdec/swfdec.h>
24 #include <swfdec/swfdec_as_relay.h>
25 #include <swfdec/swfdec_net_connection.h>
26 #include <swfdec/swfdec_flv_decoder.h>
27 #include <swfdec/swfdec_player_internal.h>
28 #include <swfdec/swfdec_sandbox.h>
29 #include <swfdec/swfdec_video_decoder.h>
30 #include <swfdec/swfdec_video_movie.h>
34 typedef struct _SwfdecNetStream SwfdecNetStream
;
35 typedef struct _SwfdecNetStreamClass SwfdecNetStreamClass
;
37 #define SWFDEC_TYPE_NET_STREAM (swfdec_net_stream_get_type())
38 #define SWFDEC_IS_NET_STREAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_NET_STREAM))
39 #define SWFDEC_IS_NET_STREAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_NET_STREAM))
40 #define SWFDEC_NET_STREAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_NET_STREAM, SwfdecNetStream))
41 #define SWFDEC_NET_STREAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_NET_STREAM, SwfdecNetStreamClass))
42 #define SWFDEC_NET_STREAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_NET_STREAM, SwfdecNetStreamClass))
44 struct _SwfdecNetStream
48 SwfdecNetConnection
* conn
; /* connection used for opening streams */
49 char * requested_url
; /* URL we have requested that isn't loaded yet */
50 SwfdecLoader
* loader
; /* input stream */
51 SwfdecSandbox
* sandbox
; /* sandbox to emit events in */
52 SwfdecFlvDecoder
* flvdecoder
; /* flv decoder */
53 gboolean playing
; /* TRUE if this stream is playing */
54 gboolean buffering
; /* TRUE if we're waiting for more input data */
55 gboolean error
; /* in error */
58 guint buffer_time
; /* buffering time in msecs */
61 guint current_time
; /* current playback timestamp */
62 guint next_time
; /* next video image at this timestamp */
63 SwfdecVideoDecoder
* decoder
; /* decoder used for decoding */
64 guint decoder_time
; /* last timestamp the decoder decoded */
65 cairo_surface_t
* surface
; /* current image */
66 SwfdecTimeout timeout
; /* timeout to advance to */
67 GList
* movies
; /* movies we're connected to */
70 SwfdecAudio
* audio
; /* audio stream or NULL when not playing */
73 struct _SwfdecNetStreamClass
75 SwfdecAsRelayClass relay_class
;
78 GType
swfdec_net_stream_get_type (void);
80 void swfdec_net_stream_set_url (SwfdecNetStream
* stream
,
82 void swfdec_net_stream_set_loader (SwfdecNetStream
* stream
,
83 SwfdecLoader
* loader
);
84 void swfdec_net_stream_set_playing (SwfdecNetStream
* stream
,
86 gboolean
swfdec_net_stream_get_playing (SwfdecNetStream
* stream
);
87 void swfdec_net_stream_set_buffer_time (SwfdecNetStream
* stream
,
89 double swfdec_net_stream_get_buffer_time (SwfdecNetStream
* stream
);
90 void swfdec_net_stream_seek (SwfdecNetStream
* stream
,