1 /* GStreamer
2  * Copyright (C) 2011 Andoni Morales Alastruey <ylatuya@gmail.com>
3  *
4  * gstfragment.h:
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  */
21 
22 #ifndef __GSTFRAGMENT_H__
23 #define __GSTFRAGMENT_H__
24 
25 #include <glib-object.h>
26 #include <gst/gst.h>
27 #include <gst/uridownloader/uridownloader-prelude.h>
28 
29 G_BEGIN_DECLS
30 
31 #define GST_TYPE_FRAGMENT (gst_fragment_get_type())
32 #define GST_FRAGMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FRAGMENT,GstFragment))
33 #define GST_FRAGMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FRAGMENT,GstFragmentClass))
34 #define GST_IS_FRAGMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FRAGMENT))
35 #define GST_IS_FRAGMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FRAGMENT))
36 
37 typedef struct _GstFragment GstFragment;
38 typedef struct _GstFragmentPrivate GstFragmentPrivate;
39 typedef struct _GstFragmentClass GstFragmentClass;
40 
41 struct _GstFragment
42 {
43   GObject parent;
44 
45   gchar * uri;                  /* URI of the fragment */
46   gchar * redirect_uri;         /* Redirect target if any */
47   gboolean redirect_permanent;  /* If the redirect is permanent */
48   gint64 range_start;
49   gint64 range_end;
50 
51   gchar * name;                 /* Name of the fragment */
52   gboolean completed;           /* Whether the fragment is complete or not */
53   guint64 download_start_time;  /* Epoch time when the download started */
54   guint64 download_stop_time;   /* Epoch time when the download finished */
55   guint64 start_time;           /* Start time of the fragment */
56   guint64 stop_time;            /* Stop time of the fragment */
57   gboolean index;               /* Index of the fragment */
58   gboolean discontinuous;       /* Whether this fragment is discontinuous or not */
59   GstStructure *headers;        /* HTTP request/response headers */
60 
61   GstFragmentPrivate *priv;
62 };
63 
64 struct _GstFragmentClass
65 {
66   GObjectClass parent_class;
67 };
68 
69 GST_URI_DOWNLOADER_API
70 GType gst_fragment_get_type (void);
71 
72 GST_URI_DOWNLOADER_API
73 GstBuffer * gst_fragment_get_buffer (GstFragment *fragment);
74 
75 GST_URI_DOWNLOADER_API
76 void gst_fragment_set_caps (GstFragment * fragment, GstCaps * caps);
77 
78 GST_URI_DOWNLOADER_API
79 GstCaps * gst_fragment_get_caps (GstFragment * fragment);
80 
81 GST_URI_DOWNLOADER_API
82 gboolean gst_fragment_add_buffer (GstFragment *fragment, GstBuffer *buffer);
83 
84 GST_URI_DOWNLOADER_API
85 GstFragment * gst_fragment_new (void);
86 
87 G_END_DECLS
88 #endif /* __GSTFRAGMENT_H__ */
89