summaryrefslogtreecommitdiff
path: root/src/gstdlnasrc.h
blob: 5322d54192104a2eb18a5919c7fff42c3225da0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
/* Copyright (C) 2013 Cable Television Laboratories, Inc.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
 * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CABLE TELEVISION LABS INC. OR ITS
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef __GST_DLNA_SRC_H__
#define __GST_DLNA_SRC_H__

#include <gst/gst.h>
#include <gst/base/gstbasesrc.h>

G_BEGIN_DECLS

#define GST_TYPE_DLNA_SRC \
        (gst_dlna_src_get_type())
#define GST_DLNA_SRC(obj) \
        (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DLNA_SRC,GstDlnaSrc))
#define GST_DLNA_SRC_CLASS(klass) \
        (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DLNA_SRC,GstDlnaSrcClass))
#define GST_IS_DLNA_SRC(obj) \
        (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DLNA_SRC))
#define GST_IS_DLNA_SRC_CLASS(klass) \
        (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DLNA_SRC))

#define PLAYSPEEDS_MAX_CNT 64

typedef struct _GstDlnaSrc GstDlnaSrc;
typedef struct _GstDlnaSrcClass GstDlnaSrcClass;

typedef struct _GstDlnaSrcHeadResponse GstDlnaSrcHeadResponse;
typedef struct _GstDlnaSrcHeadResponseContentFeatures GstDlnaSrcHeadResponseContentFeatures;

/**
 * GstDlnaSrc:
 *
 * High-level dlna element
 */
struct _GstDlnaSrc
{
    GstBin bin;
    GstElement* http_src;
    GstElement* dtcp_decrypter;

    GstPad* src_pad;

    /* Name used to identify this element as source in playsrc2
       logging */
    gchar* cl_name;

    /* DTCP Key Storage */
    guint dtcp_blocksize;
    gchar* dtcp_key_storage;

    /* Stream info */
    gchar *uri;

    SoupSession *soup_session;
    SoupMessage *soup_msg;

    GstDlnaSrcHeadResponse* server_info;

    /* Current playback rate */
    gfloat rate;
    gfloat requested_rate;
    GstFormat requested_format;
    guint64 requested_start;
    guint64 requested_stop;

    guint32 time_seek_seqnum;
    guint64 time_seek_event_start;
    gboolean handled_time_seek_seqnum;

    gboolean is_uri_initialized;
    gboolean is_live;
    gboolean is_encrypted;

    gboolean byte_seek_supported;
    guint64 byte_start;
    guint64 byte_end;
    guint64 byte_total;

    gboolean time_seek_supported;
    gchar*  npt_start_str;
    gchar*  npt_end_str;
    gchar* npt_duration_str;
    guint64 npt_start_nanos;
    guint64 npt_end_nanos;
    guint64 npt_duration_nanos;
};

struct _GstDlnaSrcHeadResponse
{
    gchar* http_rev;
    gint http_rev_idx;

    guint ret_code;
    gint ret_code_idx;

    gchar* ret_msg;
    gint ret_msg_idx;

    guint64 content_length;
    gint content_length_idx;

    gchar* accept_ranges;
    gint accept_ranges_idx;
    gboolean accept_byte_ranges;

    guint64 content_range_start;
    guint64 content_range_end;
    guint64 content_range_total;
    gint content_range_idx;

    gint time_seek_idx;

    gchar* time_seek_npt_start_str;
    gchar* time_seek_npt_end_str;
    gchar* time_seek_npt_duration_str;
    guint64 time_seek_npt_start;
    guint64 time_seek_npt_end;
    guint64 time_seek_npt_duration;
    gint npt_seek_idx;

    guint64 time_byte_seek_start;
    guint64 time_byte_seek_end;
    guint64 time_byte_seek_total;
    gint byte_seek_idx;

    gint clear_text_idx;

    guint64 dtcp_range_start;
    guint64 dtcp_range_end;
    guint64 dtcp_range_total;
    gint dtcp_range_idx;

    gint available_range_idx;
    gchar* available_seek_npt_start_str;
    gchar* available_seek_npt_end_str;
    guint64 available_seek_npt_start;
    guint64 available_seek_npt_end;
    guint64 available_seek_start;
    guint64 available_seek_end;
    guint64 available_seek_cleartext_start;
    guint64 available_seek_cleartext_end;

    gchar* transfer_mode;
    gint transfer_mode_idx;

    gchar* transfer_encoding;
    gint transfer_encoding_idx;

    gchar* date;
    gint date_idx;

    gchar* server;
    gint server_idx;

    gchar* content_type;
    gint content_type_idx;

    gchar* dtcp_host;
    gint dtcp_host_idx;
    guint dtcp_port;
    gint dtcp_port_idx;
    gint content_format_idx;

    GstDlnaSrcHeadResponseContentFeatures* content_features;
    gint  content_features_idx;
};

struct _GstDlnaSrcHeadResponseContentFeatures
{
    gint  profile_idx;
    gchar* profile;

    gint  operations_idx;
    gboolean op_time_seek_supported;
    gboolean op_range_supported;

    gint playspeeds_idx;
    guint playspeeds_cnt;
    gchar* playspeed_strs[PLAYSPEEDS_MAX_CNT];
    gfloat playspeeds[PLAYSPEEDS_MAX_CNT];

    gint  flags_idx;
    gboolean flag_sender_paced_set;
    gboolean flag_limited_time_seek_set;
    gboolean flag_limited_byte_seek_set;
    gboolean flag_play_container_set;
    gboolean flag_so_increasing_set;
    gboolean flag_sn_increasing_set;
    gboolean flag_rtsp_pause_set;
    gboolean flag_streaming_mode_set;
    gboolean flag_interactive_mode_set;
    gboolean flag_background_mode_set;
    gboolean flag_stalling_set;
    gboolean flag_dlna_v15_set;
    gboolean flag_link_protected_set;
    gboolean flag_full_clear_text_set;
    gboolean flag_limited_clear_text_set;

    gint  conversion_idx;
    gboolean is_converted;
};

struct _GstDlnaSrcClass
{
    GstBinClass parent_class;
};

GType gst_dlna_src_get_type (void);

G_END_DECLS

#endif /* __GST_DLNA_SRC_H__ */