Tizen 2.0 Release
[framework/multimedia/gst-plugins-good0.10.git] / ext / soup / gstsouphttpsrc.h
1 /* GStreamer
2  * Copyright (C) 2007-2008 Wouter Cloetens <wouter@mind.be>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
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  * Library General Public License for more 
13  */
14
15 #ifndef __GST_SOUP_HTTP_SRC_H__
16 #define __GST_SOUP_HTTP_SRC_H__
17
18 #include <gst/gst.h>
19 #include <gst/base/gstpushsrc.h>
20 #include <glib.h>
21
22 G_BEGIN_DECLS
23
24 #include <libsoup/soup.h>
25
26 #define GST_TYPE_SOUP_HTTP_SRC \
27   (gst_soup_http_src_get_type())
28 #define GST_SOUP_HTTP_SRC(obj) \
29   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SOUP_HTTP_SRC,GstSoupHTTPSrc))
30 #define GST_SOUP_HTTP_SRC_CLASS(klass) \
31   (G_TYPE_CHECK_CLASS_CAST((klass), \
32       GST_TYPE_SOUP_HTTP_SRC,GstSoupHTTPSrcClass))
33 #define GST_IS_SOUP_HTTP_SRC(obj) \
34   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SOUP_HTTP_SRC))
35 #define GST_IS_SOUP_HTTP_SRC_CLASS(klass) \
36   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SOUP_HTTP_SRC))
37
38 typedef struct _GstSoupHTTPSrc GstSoupHTTPSrc;
39 typedef struct _GstSoupHTTPSrcClass GstSoupHTTPSrcClass;
40
41 typedef enum {
42   GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_IDLE,
43   GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_QUEUED,
44   GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_RUNNING,
45   GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_CANCELLED,
46 } GstSoupHTTPSrcSessionIOStatus;
47
48 struct _GstSoupHTTPSrc {
49   GstPushSrc element;
50
51   gchar *location;             /* Full URI. */
52   gchar *user_agent;           /* User-Agent HTTP header. */
53   gboolean automatic_redirect; /* Follow redirects. */
54   SoupURI *proxy;              /* HTTP proxy URI. */
55   gchar *user_id;              /* Authentication user id for location URI. */
56   gchar *user_pw;              /* Authentication user password for location URI. */
57   gchar *proxy_id;             /* Authentication user id for proxy URI. */
58   gchar *proxy_pw;             /* Authentication user password for proxy URI. */
59   gchar **cookies;             /* HTTP request cookies. */
60   GMainContext *context;       /* I/O context. */
61   GMainLoop *loop;             /* Event loop. */
62   SoupSession *session;        /* Async context. */
63   GstSoupHTTPSrcSessionIOStatus session_io_status;
64                                /* Async I/O status. */
65   SoupMessage *msg;            /* Request message. */
66   GstFlowReturn ret;           /* Return code from callback. */
67   GstBuffer **outbuf;          /* Return buffer allocated by callback. */
68   gboolean interrupted;        /* Signal unlock(). */
69   gboolean retry;              /* Should attempt to reconnect. */
70
71   gboolean have_size;          /* Received and parsed Content-Length
72                                   header. */
73   guint64 file_size;
74   gint64 range_size;
75   guint64 content_size;        /* Value of Content-Length header. */
76   guint64 read_position;       /* Current position. */
77   gboolean seekable;           /* FALSE if the server does not support
78                                   Range. */
79   guint64 request_position;    /* Seek to this position. */
80   gboolean seeked;
81
82   /* Shoutcast/icecast metadata extraction handling. */
83   gboolean iradio_mode;
84   GstCaps *src_caps;
85   gchar *iradio_name;
86   gchar *iradio_genre;
87   gchar *iradio_url;
88   gchar *iradio_title;
89
90   GstStructure *extra_headers;
91
92   guint timeout;
93 #ifdef GST_EXT_SOUP_MODIFICATION
94   SoupCookieJar *cookie_jar;
95 #endif
96 };
97
98 struct _GstSoupHTTPSrcClass {
99   GstPushSrcClass parent_class;
100 };
101
102 GType gst_soup_http_src_get_type (void);
103
104 G_END_DECLS
105
106 #endif /* __GST_SOUP_HTTP_SRC_H__ */
107