2 * Copyright (C) 2006-2007 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_LOADER_H_
21 #define _SWFDEC_LOADER_H_
23 #include <glib-object.h>
24 #include <libswfdec/swfdec_buffer.h>
25 #include <libswfdec/swfdec_url.h>
30 SWFDEC_LOADER_DATA_UNKNOWN
,
31 SWFDEC_LOADER_DATA_SWF
,
32 SWFDEC_LOADER_DATA_FLV
,
33 SWFDEC_LOADER_DATA_XML
,
34 SWFDEC_LOADER_DATA_TEXT
35 } SwfdecLoaderDataType
;
37 /* NB: actal numbers in SwfdecLoaderRequest are important for GetURL2 action */
39 SWFDEC_LOADER_REQUEST_DEFAULT
= 0,
40 SWFDEC_LOADER_REQUEST_GET
= 1,
41 SWFDEC_LOADER_REQUEST_POST
= 2
42 } SwfdecLoaderRequest
;
44 typedef struct _SwfdecLoader SwfdecLoader
;
45 typedef struct _SwfdecLoaderClass SwfdecLoaderClass
;
47 #define SWFDEC_TYPE_LOADER (swfdec_loader_get_type())
48 #define SWFDEC_IS_LOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_LOADER))
49 #define SWFDEC_IS_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_LOADER))
50 #define SWFDEC_LOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_LOADER, SwfdecLoader))
51 #define SWFDEC_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_LOADER, SwfdecLoaderClass))
52 #define SWFDEC_LOADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_LOADER, SwfdecLoaderClass))
59 guint state
; /* SwfdecLoaderState the loader is currently in */
60 SwfdecURL
* url
; /* the URL for this loader in UTF-8 - must be set on creation */
61 gulong size
; /* number of bytes in stream or 0 if unknown */
62 char * error
; /* error message if in error state or NULL */
63 gpointer target
; /* SwfdecLoaderTarget that gets notified about loading progress */
64 gpointer player
; /* SwfdecPlayer belonging to target or %NULL */
65 SwfdecBufferQueue
* queue
; /* SwfdecBufferQueue managing the input buffers */
66 SwfdecLoaderDataType data_type
; /* type this stream is in (identified by swfdec) */
69 struct _SwfdecLoaderClass
71 GObjectClass object_class
;
73 /* initialize the loader. The URL will be set already. */
74 void (* load
) (SwfdecLoader
* loader
,
75 SwfdecLoader
* parent
,
76 SwfdecLoaderRequest request
,
79 /* if open, close the loader. NB: you may not call push() or eof() after the loader has been closed */
80 void (* close
) (SwfdecLoader
* loader
);
83 GType
swfdec_loader_get_type (void);
85 void swfdec_loader_open (SwfdecLoader
* loader
,
87 void swfdec_loader_push (SwfdecLoader
* loader
,
88 SwfdecBuffer
* buffer
);
89 void swfdec_loader_eof (SwfdecLoader
* loader
);
90 void swfdec_loader_error (SwfdecLoader
* loader
,
93 swfdec_loader_get_url (SwfdecLoader
* loader
);
94 void swfdec_loader_set_size (SwfdecLoader
* loader
,
96 gulong
swfdec_loader_get_size (SwfdecLoader
* loader
);
97 gulong
swfdec_loader_get_loaded (SwfdecLoader
* loader
);
98 char * swfdec_loader_get_filename (SwfdecLoader
* loader
);
100 swfdec_loader_get_data_type (SwfdecLoader
* loader
);
102 const char * swfdec_loader_data_type_get_extension
103 (SwfdecLoaderDataType type
);