leo_sobral@2
|
1 |
/* vim: set sw=2: -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2; c-indent-level: 2 -*- */
|
leo_sobral@2
|
2 |
/* GStreamer MythTV Plug-in
|
leo_sobral@2
|
3 |
* Copyright (C) <2006> Rosfran Borges <rosfran.borges@indt.org.br>
|
leo_sobral@2
|
4 |
*
|
leo_sobral@2
|
5 |
* This library is free software; you can redistribute it and/or
|
rosfran@30
|
6 |
* modify it under the terms of the GNU Library Lesser General
|
rosfran@30
|
7 |
* Public License as published by the Free Software Foundation; either
|
leo_sobral@2
|
8 |
* version 2 of the License, or (at your option) any later version.
|
leo_sobral@2
|
9 |
*
|
leo_sobral@2
|
10 |
* This library is distributed in the hope that it will be useful,
|
leo_sobral@2
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
leo_sobral@2
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
leo_sobral@2
|
13 |
* Library General Public License for more
|
leo_sobral@2
|
14 |
*/
|
rosfran@124
|
15 |
/**
|
rosfran@124
|
16 |
* When using the LiveTV content, put the location URI in the following
|
rosfran@124
|
17 |
* format:
|
rosfran@124
|
18 |
*
|
rosfran@124
|
19 |
* myth://mythtv:mythtv@xxx.xxx.xxx.xxx:6543/#mythconverg
|
rosfran@124
|
20 |
*
|
rosfran@124
|
21 |
* Where the first field is the protocol (myth), the second and third are user
|
rosfran@124
|
22 |
* name (mythtv) and password (mythtv), then backend host name and port number,
|
rosfran@124
|
23 |
* and the last field is the database name (mythconverg).
|
rosfran@124
|
24 |
*/
|
leo_sobral@2
|
25 |
|
leo_sobral@2
|
26 |
#ifdef HAVE_CONFIG_H
|
leo_sobral@2
|
27 |
#include "config.h"
|
leo_sobral@2
|
28 |
#endif
|
leo_sobral@2
|
29 |
|
leo_sobral@2
|
30 |
#include "gstmythtvsrc.h"
|
rosfran@52
|
31 |
#include <gmyth/gmyth_file_transfer.h>
|
rosfran@52
|
32 |
#include <gmyth/gmyth_livetv.h>
|
leo_sobral@2
|
33 |
|
leo_sobral@2
|
34 |
#include <gmyth/gmyth_socket.h>
|
leo_sobral@2
|
35 |
#include <gmyth/gmyth_tvchain.h>
|
leo_sobral@2
|
36 |
|
leo_sobral@2
|
37 |
#include <string.h>
|
leo_sobral@2
|
38 |
#include <unistd.h>
|
leo_sobral@2
|
39 |
|
leo_sobral@2
|
40 |
GST_DEBUG_CATEGORY_STATIC (mythtvsrc_debug);
|
leo_sobral@2
|
41 |
#define GST_CAT_DEFAULT mythtvsrc_debug
|
leo_sobral@2
|
42 |
|
rosfran@95
|
43 |
#define GST_GMYTHTV_ID_NUM 1
|
rosfran@70
|
44 |
|
rosfran@70
|
45 |
#define GST_GMYTHTV_CHANNEL_NUM 1000
|
leo_sobral@2
|
46 |
|
rosfran@52
|
47 |
#define GMYTHTV_VERSION_DEFAULT 30
|
rosfran@61
|
48 |
|
rosfran@90
|
49 |
#define GMYTHTV_TRANSFER_MAX_WAITS 100
|
leo_sobral@2
|
50 |
|
rosfran@102
|
51 |
#define GMYTHTV_TRANSFER_MAX_RESENDS 5
|
rosfran@102
|
52 |
|
rosfran@90
|
53 |
#define GMYTHTV_TRANSFER_MAX_BUFFER 128*1024
|
rosfran@30
|
54 |
//( 32*1024 )
|
leo_sobral@2
|
55 |
|
leo_sobral@2
|
56 |
/* 4*1024 ??? */
|
rosfran@98
|
57 |
#define MAX_READ_SIZE 4*1024
|
rosfran@30
|
58 |
//( 32*1024 )
|
leo_sobral@2
|
59 |
|
rosfran@98
|
60 |
#define GST_FLOW_ERROR_NO_DATA -101
|
rosfran@70
|
61 |
|
rosfran@124
|
62 |
#define REQUEST_MAX_SIZE 64*1024
|
rosfran@124
|
63 |
|
rosfran@142
|
64 |
#define INTERNAL_BUFFER_SIZE 90*1024
|
rosfran@90
|
65 |
|
leo_sobral@2
|
66 |
/* stablish a maximum iteration value to the IS_RECORDING message */
|
leo_sobral@2
|
67 |
static guint wait_to_transfer = 0;
|
leo_sobral@2
|
68 |
|
leo_sobral@2
|
69 |
static const GstElementDetails gst_mythtv_src_details =
|
rosfran@30
|
70 |
GST_ELEMENT_DETAILS ( "MythTV client source",
|
leo_sobral@2
|
71 |
"Source/Network",
|
leo_sobral@2
|
72 |
"Control and receive data as a client over the network via raw socket connections using the MythTV protocol",
|
rosfran@30
|
73 |
"Rosfran Borges <rosfran.borges@indt.org.br>" );
|
leo_sobral@2
|
74 |
|
rosfran@81
|
75 |
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ( "src",
|
leo_sobral@2
|
76 |
GST_PAD_SRC,
|
leo_sobral@2
|
77 |
GST_PAD_ALWAYS,
|
rosfran@30
|
78 |
GST_STATIC_CAPS ("video/x-nuv") );
|
rosfran@81
|
79 |
|
leo_sobral@2
|
80 |
enum
|
leo_sobral@2
|
81 |
{
|
leo_sobral@2
|
82 |
PROP_0,
|
leo_sobral@2
|
83 |
PROP_LOCATION,
|
leo_sobral@2
|
84 |
PROP_URI,
|
leo_sobral@2
|
85 |
#ifndef GST_DISABLE_GST_DEBUG
|
rosfran@40
|
86 |
PROP_GMYTHTV_DBG,
|
leo_sobral@2
|
87 |
#endif
|
rosfran@40
|
88 |
PROP_GMYTHTV_VERSION,
|
rosfran@40
|
89 |
PROP_GMYTHTV_LIVE,
|
rosfran@40
|
90 |
PROP_GMYTHTV_LIVEID,
|
rosfran@52
|
91 |
PROP_GMYTHTV_LIVE_CHAINID,
|
rosfran@70
|
92 |
PROP_GMYTHTV_ENABLE_TIMING_POSITION,
|
rosfran@70
|
93 |
PROP_GMYTHTV_CHANNEL_NUM
|
leo_sobral@2
|
94 |
};
|
leo_sobral@2
|
95 |
|
leo_sobral@2
|
96 |
static void gst_mythtv_src_finalize (GObject * gobject);
|
leo_sobral@2
|
97 |
|
rosfran@100
|
98 |
static GstFlowReturn gst_mythtv_src_create ( GstPushSrc* psrc, GstBuffer** outbuf );
|
rosfran@52
|
99 |
|
leo_sobral@2
|
100 |
static gboolean gst_mythtv_src_start (GstBaseSrc * bsrc);
|
leo_sobral@2
|
101 |
static gboolean gst_mythtv_src_stop (GstBaseSrc * bsrc);
|
leo_sobral@2
|
102 |
static gboolean gst_mythtv_src_get_size (GstBaseSrc * bsrc, guint64 * size);
|
rosfran@87
|
103 |
static gboolean gst_mythtv_src_is_seekable( GstBaseSrc *push_src );
|
rosfran@87
|
104 |
|
rosfran@106
|
105 |
/*
|
rosfran@106
|
106 |
static void gst_mythtv_src_get_times (GstBaseSrc * src, GstBuffer * buffer,
|
rosfran@106
|
107 |
GstClockTime * start, GstClockTime * end);
|
rosfran@106
|
108 |
*/
|
rosfran@98
|
109 |
|
rosfran@100
|
110 |
static gboolean gst_mythtv_src_do_seek( GstBaseSrc *base, GstSegment *segment );
|
rosfran@52
|
111 |
|
rosfran@52
|
112 |
static gboolean gst_mythtv_src_next_program_chain ( GstMythtvSrc *src );
|
rosfran@52
|
113 |
|
rosfran@52
|
114 |
static GstStateChangeReturn
|
rosfran@52
|
115 |
gst_mythtv_src_change_state (GstElement * element, GstStateChange transition);
|
leo_sobral@2
|
116 |
|
leo_sobral@2
|
117 |
static void gst_mythtv_src_set_property (GObject * object, guint prop_id,
|
leo_sobral@2
|
118 |
const GValue * value, GParamSpec * pspec);
|
leo_sobral@2
|
119 |
static void gst_mythtv_src_get_property (GObject * object, guint prop_id,
|
leo_sobral@2
|
120 |
GValue * value, GParamSpec * pspec);
|
leo_sobral@2
|
121 |
|
rosfran@30
|
122 |
static void gst_mythtv_src_uri_handler_init (gpointer g_iface, gpointer iface_data);
|
rosfran@30
|
123 |
|
rosfran@87
|
124 |
static gboolean gst_mythtv_src_handle_query (GstPad * pad, GstQuery * query);
|
rosfran@87
|
125 |
|
rosfran@90
|
126 |
static gboolean gst_mythtv_src_handle_event (GstPad * pad, GstEvent * event);
|
rosfran@30
|
127 |
|
rosfran@102
|
128 |
static gint do_read_request_response (GstMythtvSrc * src, guint size, GByteArray *data_ptr);
|
rosfran@90
|
129 |
|
rosfran@90
|
130 |
GStaticRecMutex th_mutex = G_STATIC_REC_MUTEX_INIT;
|
leo_sobral@2
|
131 |
|
rosfran@52
|
132 |
static void
|
leo_sobral@2
|
133 |
_urihandler_init (GType type)
|
leo_sobral@2
|
134 |
{
|
leo_sobral@2
|
135 |
static const GInterfaceInfo urihandler_info = {
|
leo_sobral@2
|
136 |
gst_mythtv_src_uri_handler_init,
|
leo_sobral@2
|
137 |
NULL,
|
leo_sobral@2
|
138 |
NULL
|
leo_sobral@2
|
139 |
};
|
leo_sobral@2
|
140 |
|
leo_sobral@2
|
141 |
g_type_add_interface_static (type, GST_TYPE_URI_HANDLER, &urihandler_info);
|
leo_sobral@2
|
142 |
|
leo_sobral@2
|
143 |
GST_DEBUG_CATEGORY_INIT (mythtvsrc_debug, "mythtvsrc", 0,
|
leo_sobral@2
|
144 |
"MythTV src");
|
leo_sobral@2
|
145 |
}
|
leo_sobral@2
|
146 |
|
rosfran@100
|
147 |
GST_BOILERPLATE_FULL (GstMythtvSrc, gst_mythtv_src, GstPushSrc,
|
rosfran@100
|
148 |
GST_TYPE_PUSH_SRC, _urihandler_init)
|
rosfran@30
|
149 |
|
rosfran@87
|
150 |
static void
|
leo_sobral@2
|
151 |
gst_mythtv_src_base_init (gpointer g_class)
|
leo_sobral@2
|
152 |
{
|
leo_sobral@2
|
153 |
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
leo_sobral@2
|
154 |
|
leo_sobral@2
|
155 |
gst_element_class_add_pad_template (element_class,
|
leo_sobral@2
|
156 |
gst_static_pad_template_get (&srctemplate));
|
rosfran@81
|
157 |
|
leo_sobral@2
|
158 |
gst_element_class_set_details (element_class, &gst_mythtv_src_details);
|
rosfran@52
|
159 |
|
rosfran@52
|
160 |
element_class->change_state = gst_mythtv_src_change_state;
|
rosfran@81
|
161 |
|
leo_sobral@2
|
162 |
}
|
leo_sobral@2
|
163 |
|
rosfran@30
|
164 |
static void
|
leo_sobral@2
|
165 |
gst_mythtv_src_class_init (GstMythtvSrcClass * klass)
|
leo_sobral@2
|
166 |
{
|
rosfran@63
|
167 |
GObjectClass *gobject_class;
|
rosfran@100
|
168 |
GstPushSrcClass *gstpushsrc_class;
|
leo_sobral@2
|
169 |
GstBaseSrcClass *gstbasesrc_class;
|
leo_sobral@2
|
170 |
|
leo_sobral@2
|
171 |
gobject_class = (GObjectClass *) klass;
|
leo_sobral@2
|
172 |
gstbasesrc_class = (GstBaseSrcClass *) klass;
|
rosfran@100
|
173 |
gstpushsrc_class = (GstPushSrcClass *) klass;
|
leo_sobral@2
|
174 |
|
leo_sobral@2
|
175 |
gobject_class->set_property = gst_mythtv_src_set_property;
|
leo_sobral@2
|
176 |
gobject_class->get_property = gst_mythtv_src_get_property;
|
leo_sobral@2
|
177 |
gobject_class->finalize = gst_mythtv_src_finalize;
|
leo_sobral@2
|
178 |
|
leo_sobral@2
|
179 |
g_object_class_install_property
|
leo_sobral@2
|
180 |
(gobject_class, PROP_LOCATION,
|
leo_sobral@2
|
181 |
g_param_spec_string ("location", "Location",
|
leo_sobral@2
|
182 |
"The location. In the form:"
|
leo_sobral@2
|
183 |
"\n\t\t\tmyth://a.com/file.nuv"
|
leo_sobral@2
|
184 |
"\n\t\t\tmyth://a.com:23223/file.nuv "
|
leo_sobral@2
|
185 |
"\n\t\t\ta.com/file.nuv - default scheme 'myth'",
|
leo_sobral@2
|
186 |
"", G_PARAM_READWRITE));
|
leo_sobral@2
|
187 |
|
leo_sobral@2
|
188 |
g_object_class_install_property
|
leo_sobral@2
|
189 |
(gobject_class, PROP_URI,
|
leo_sobral@2
|
190 |
g_param_spec_string ("uri", "Uri",
|
leo_sobral@2
|
191 |
"The location in form of a URI (deprecated; use location)",
|
leo_sobral@2
|
192 |
"", G_PARAM_READWRITE));
|
leo_sobral@2
|
193 |
|
leo_sobral@2
|
194 |
g_object_class_install_property
|
rosfran@40
|
195 |
(gobject_class, PROP_GMYTHTV_VERSION,
|
leo_sobral@2
|
196 |
g_param_spec_int ("mythtv-version", "mythtv-version",
|
rosfran@70
|
197 |
"Change MythTV version",
|
leo_sobral@2
|
198 |
26, 30, 26, G_PARAM_READWRITE));
|
leo_sobral@2
|
199 |
|
leo_sobral@2
|
200 |
g_object_class_install_property
|
rosfran@40
|
201 |
(gobject_class, PROP_GMYTHTV_LIVEID,
|
leo_sobral@2
|
202 |
g_param_spec_int ("mythtv-live-id", "mythtv-live-id",
|
rosfran@70
|
203 |
"Change MythTV version",
|
rosfran@40
|
204 |
0, 200, GST_GMYTHTV_ID_NUM, G_PARAM_READWRITE));
|
leo_sobral@2
|
205 |
|
leo_sobral@2
|
206 |
g_object_class_install_property
|
rosfran@40
|
207 |
(gobject_class, PROP_GMYTHTV_LIVE_CHAINID,
|
leo_sobral@2
|
208 |
g_param_spec_string ("mythtv-live-chainid", "mythtv-live-chainid",
|
rosfran@70
|
209 |
"Sets the MythTV chain ID (from TV Chain)",
|
leo_sobral@2
|
210 |
"", G_PARAM_READWRITE));
|
leo_sobral@2
|
211 |
|
leo_sobral@2
|
212 |
g_object_class_install_property
|
rosfran@40
|
213 |
(gobject_class, PROP_GMYTHTV_LIVE,
|
leo_sobral@2
|
214 |
g_param_spec_boolean ("mythtv-live", "mythtv-live",
|
leo_sobral@2
|
215 |
"Enable MythTV Live TV content streaming",
|
leo_sobral@2
|
216 |
FALSE, G_PARAM_READWRITE));
|
leo_sobral@2
|
217 |
|
rosfran@52
|
218 |
g_object_class_install_property
|
rosfran@52
|
219 |
(gobject_class, PROP_GMYTHTV_ENABLE_TIMING_POSITION,
|
rosfran@52
|
220 |
g_param_spec_boolean ("mythtv-enable-timing-position", "mythtv-enable-timing-position",
|
rosfran@52
|
221 |
"Enable MythTV Live TV content size continuous updating",
|
rosfran@52
|
222 |
FALSE, G_PARAM_READWRITE));
|
rosfran@70
|
223 |
|
rosfran@70
|
224 |
g_object_class_install_property
|
rosfran@70
|
225 |
(gobject_class, PROP_GMYTHTV_CHANNEL_NUM,
|
rosfran@70
|
226 |
g_param_spec_int ("mythtv-channel", "mythtv-channel",
|
rosfran@70
|
227 |
"Change MythTV channel number",
|
rosfran@71
|
228 |
0, 99999, GST_GMYTHTV_CHANNEL_NUM, G_PARAM_READWRITE));
|
rosfran@52
|
229 |
|
leo_sobral@2
|
230 |
#ifndef GST_DISABLE_GST_DEBUG
|
leo_sobral@2
|
231 |
g_object_class_install_property
|
rosfran@40
|
232 |
(gobject_class, PROP_GMYTHTV_DBG,
|
leo_sobral@2
|
233 |
g_param_spec_boolean ("mythtv-debug", "mythtv-debug",
|
leo_sobral@2
|
234 |
"Enable MythTV debug messages",
|
leo_sobral@2
|
235 |
FALSE, G_PARAM_READWRITE));
|
leo_sobral@2
|
236 |
#endif
|
leo_sobral@2
|
237 |
|
leo_sobral@2
|
238 |
gstbasesrc_class->start = gst_mythtv_src_start;
|
leo_sobral@2
|
239 |
gstbasesrc_class->stop = gst_mythtv_src_stop;
|
leo_sobral@2
|
240 |
gstbasesrc_class->get_size = gst_mythtv_src_get_size;
|
rosfran@87
|
241 |
gstbasesrc_class->is_seekable = gst_mythtv_src_is_seekable;
|
rosfran@81
|
242 |
|
rosfran@98
|
243 |
//gstbasesrc_class->get_times = gst_mythtv_src_get_times;
|
rosfran@98
|
244 |
|
rosfran@100
|
245 |
gstbasesrc_class->do_seek = gst_mythtv_src_do_seek;
|
rosfran@100
|
246 |
gstpushsrc_class->create = gst_mythtv_src_create;
|
rosfran@52
|
247 |
|
leo_sobral@2
|
248 |
GST_DEBUG_CATEGORY_INIT (mythtvsrc_debug, "mythtvsrc", 0,
|
leo_sobral@2
|
249 |
"MythTV Client Source");
|
leo_sobral@2
|
250 |
}
|
leo_sobral@2
|
251 |
|
rosfran@30
|
252 |
static void
|
leo_sobral@2
|
253 |
gst_mythtv_src_init (GstMythtvSrc * this, GstMythtvSrcClass * g_class)
|
leo_sobral@2
|
254 |
{
|
leo_sobral@2
|
255 |
this->file_transfer = NULL;
|
leo_sobral@2
|
256 |
|
leo_sobral@2
|
257 |
this->unique_setup = FALSE;
|
leo_sobral@2
|
258 |
|
rosfran@40
|
259 |
this->mythtv_version = GMYTHTV_VERSION_DEFAULT;
|
rosfran@70
|
260 |
|
rosfran@70
|
261 |
this->state = GST_MYTHTV_SRC_FILE_TRANSFER;
|
leo_sobral@2
|
262 |
|
leo_sobral@2
|
263 |
this->bytes_read = 0;
|
rosfran@63
|
264 |
|
rosfran@63
|
265 |
this->prev_content_size = 0;
|
leo_sobral@2
|
266 |
|
rosfran@52
|
267 |
this->content_size = 0;
|
leo_sobral@2
|
268 |
this->read_offset = 0;
|
leo_sobral@2
|
269 |
|
rosfran@61
|
270 |
this->content_size_last = 0;
|
rosfran@61
|
271 |
|
leo_sobral@2
|
272 |
this->live_tv = FALSE;
|
rosfran@52
|
273 |
|
rosfran@52
|
274 |
this->enable_timing_position = FALSE;
|
rosfran@52
|
275 |
this->update_prog_chain = FALSE;
|
leo_sobral@2
|
276 |
|
leo_sobral@2
|
277 |
this->user_agent = g_strdup ("mythtvsrc");
|
rosfran@52
|
278 |
this->mythtv_caps = NULL;
|
rosfran@52
|
279 |
this->update_prog_chain = FALSE;
|
rosfran@52
|
280 |
|
rosfran@70
|
281 |
this->channel_num = 0;
|
rosfran@70
|
282 |
|
rosfran@52
|
283 |
this->eos = FALSE;
|
rosfran@30
|
284 |
|
rosfran@98
|
285 |
this->bytes_queue = NULL;
|
rosfran@70
|
286 |
|
rosfran@81
|
287 |
this->th_mutex = NULL;
|
rosfran@81
|
288 |
|
rosfran@87
|
289 |
gst_base_src_set_format( GST_BASE_SRC( this ), GST_FORMAT_BYTES );
|
leo_sobral@2
|
290 |
|
rosfran@106
|
291 |
/* gst_base_src_set_live ( GST_BASE_SRC( this ), TRUE ); */
|
rosfran@81
|
292 |
|
rosfran@90
|
293 |
gst_pad_set_event_function ( GST_BASE_SRC_PAD(GST_BASE_SRC(this)),
|
rosfran@90
|
294 |
gst_mythtv_src_handle_event );
|
rosfran@87
|
295 |
gst_pad_set_query_function ( GST_BASE_SRC_PAD(GST_BASE_SRC(this)),
|
rosfran@87
|
296 |
gst_mythtv_src_handle_query );
|
rosfran@30
|
297 |
|
leo_sobral@2
|
298 |
}
|
leo_sobral@2
|
299 |
|
rosfran@30
|
300 |
static void
|
leo_sobral@2
|
301 |
gst_mythtv_src_finalize (GObject * gobject)
|
leo_sobral@2
|
302 |
{
|
leo_sobral@2
|
303 |
GstMythtvSrc *this = GST_MYTHTV_SRC (gobject);
|
rosfran@114
|
304 |
|
rosfran@81
|
305 |
if ( this->th_read_ahead != NULL ) {
|
rosfran@114
|
306 |
gst_task_stop( this->th_read_ahead );
|
rosfran@114
|
307 |
this->th_read_ahead = NULL;
|
rosfran@81
|
308 |
}
|
leo_sobral@2
|
309 |
|
leo_sobral@2
|
310 |
if (this->mythtv_caps) {
|
leo_sobral@2
|
311 |
gst_caps_unref (this->mythtv_caps);
|
leo_sobral@2
|
312 |
this->mythtv_caps = NULL;
|
leo_sobral@2
|
313 |
}
|
leo_sobral@2
|
314 |
|
leo_sobral@2
|
315 |
if (this->file_transfer) {
|
leo_sobral@2
|
316 |
g_object_unref (this->file_transfer);
|
leo_sobral@2
|
317 |
this->file_transfer = NULL;
|
leo_sobral@2
|
318 |
}
|
leo_sobral@2
|
319 |
|
rosfran@114
|
320 |
if (this->spawn_livetv) {
|
rosfran@70
|
321 |
g_object_unref (this->spawn_livetv);
|
rosfran@52
|
322 |
this->spawn_livetv = NULL;
|
rosfran@52
|
323 |
}
|
rosfran@118
|
324 |
|
rosfran@118
|
325 |
if (this->backend_info) {
|
rosfran@118
|
326 |
g_object_unref (this->backend_info);
|
rosfran@118
|
327 |
this->backend_info = NULL;
|
rosfran@118
|
328 |
}
|
rosfran@52
|
329 |
|
leo_sobral@2
|
330 |
if (this->uri_name) {
|
leo_sobral@2
|
331 |
g_free (this->uri_name);
|
leo_sobral@2
|
332 |
}
|
leo_sobral@2
|
333 |
|
leo_sobral@2
|
334 |
if (this->user_agent) {
|
leo_sobral@2
|
335 |
g_free (this->user_agent);
|
leo_sobral@2
|
336 |
}
|
rosfran@114
|
337 |
|
rosfran@100
|
338 |
if ( this->bytes_queue ) {
|
rosfran@114
|
339 |
g_byte_array_free( this->bytes_queue, TRUE );
|
rosfran@114
|
340 |
this->bytes_queue = NULL;
|
rosfran@100
|
341 |
}
|
leo_sobral@2
|
342 |
|
leo_sobral@2
|
343 |
G_OBJECT_CLASS (parent_class)->finalize (gobject);
|
leo_sobral@2
|
344 |
}
|
leo_sobral@2
|
345 |
|
rosfran@37
|
346 |
static gint
|
rosfran@102
|
347 |
do_read_request_response (GstMythtvSrc * src, guint size, GByteArray *data_ptr)
|
leo_sobral@2
|
348 |
{
|
rosfran@37
|
349 |
gint read = 0;
|
rosfran@52
|
350 |
guint sizetoread = size;
|
rosfran@142
|
351 |
gint max_iters = GMYTHTV_TRANSFER_MAX_RESENDS;
|
rosfran@102
|
352 |
|
rosfran@106
|
353 |
GST_LOG_OBJECT( src, "Starting: [%s] Reading %d bytes...\n", __FUNCTION__, sizetoread );
|
leo_sobral@2
|
354 |
|
rosfran@30
|
355 |
/* Loop sending the Myth File Transfer request:
|
leo_sobral@2
|
356 |
* Retry whilst authentication fails and we supply it. */
|
rosfran@37
|
357 |
gint len = 0;
|
rosfran@70
|
358 |
|
rosfran@102
|
359 |
while ( sizetoread == size && --max_iters > 0) {
|
rosfran@61
|
360 |
|
rosfran@61
|
361 |
len = gmyth_file_transfer_read( src->file_transfer,
|
rosfran@102
|
362 |
data_ptr, sizetoread, TRUE );
|
leo_sobral@2
|
363 |
|
leo_sobral@2
|
364 |
if ( len > 0 ) {
|
rosfran@81
|
365 |
read += len;
|
leo_sobral@2
|
366 |
sizetoread -= len;
|
rosfran@52
|
367 |
}
|
rosfran@90
|
368 |
else if ( len < 0 )
|
rosfran@52
|
369 |
{
|
rosfran@90
|
370 |
read = -1;
|
rosfran@61
|
371 |
|
rosfran@52
|
372 |
if ( src->live_tv == FALSE )
|
rosfran@52
|
373 |
{
|
rosfran@90
|
374 |
goto eos;
|
rosfran@52
|
375 |
}
|
rosfran@52
|
376 |
else
|
rosfran@52
|
377 |
{
|
rosfran@90
|
378 |
if ( len == GMYTHTV_FILE_TRANSFER_READ_ERROR ) { /* -314 */
|
rosfran@90
|
379 |
src->update_prog_chain = TRUE;
|
rosfran@90
|
380 |
goto done;
|
rosfran@100
|
381 |
}
|
rosfran@90
|
382 |
goto done;
|
rosfran@90
|
383 |
}
|
rosfran@30
|
384 |
|
rosfran@142
|
385 |
} else if ( len == 0 )
|
rosfran@142
|
386 |
goto done;
|
rosfran@61
|
387 |
|
rosfran@30
|
388 |
if ( read == sizetoread )
|
rosfran@90
|
389 |
goto done;
|
rosfran@100
|
390 |
}
|
rosfran@61
|
391 |
|
rosfran@102
|
392 |
if ( ( read < 0 && !src->live_tv ) || max_iters == 0 )
|
rosfran@61
|
393 |
goto eos;
|
rosfran@61
|
394 |
|
rosfran@30
|
395 |
goto done;
|
leo_sobral@2
|
396 |
|
leo_sobral@2
|
397 |
eos:
|
leo_sobral@2
|
398 |
src->eos = TRUE;
|
rosfran@61
|
399 |
|
leo_sobral@2
|
400 |
done:
|
leo_sobral@2
|
401 |
return read;
|
leo_sobral@2
|
402 |
}
|
leo_sobral@2
|
403 |
|
rosfran@30
|
404 |
static GstFlowReturn
|
rosfran@81
|
405 |
gst_mythtv_src_create ( GstPushSrc* psrc, GstBuffer** outbuf )
|
rosfran@81
|
406 |
{
|
rosfran@81
|
407 |
GstMythtvSrc *src;
|
rosfran@81
|
408 |
GstFlowReturn ret = GST_FLOW_OK;
|
rosfran@81
|
409 |
gint read = -1;
|
rosfran@90
|
410 |
|
rosfran@81
|
411 |
src = GST_MYTHTV_SRC ( psrc );
|
rosfran@90
|
412 |
|
rosfran@81
|
413 |
/* The caller should know the number of bytes and not read beyond EOS. */
|
rosfran@81
|
414 |
if (G_UNLIKELY (src->eos))
|
rosfran@81
|
415 |
goto eos;
|
rosfran@81
|
416 |
if ( G_UNLIKELY (src->update_prog_chain) )
|
rosfran@81
|
417 |
goto change_progchain;
|
rosfran@95
|
418 |
|
rosfran@90
|
419 |
//g_static_rec_mutex_lock( &th_mutex );
|
rosfran@106
|
420 |
GST_DEBUG_OBJECT( src, "[%s] offset = %llu, size = %d...\n", __FUNCTION__,
|
rosfran@100
|
421 |
src->read_offset, MAX_READ_SIZE );
|
rosfran@95
|
422 |
|
rosfran@118
|
423 |
GST_DEBUG_OBJECT ( src, "[%s]\t\tCreate: buffer_remain: %d, buffer_size = %d.\n", __FUNCTION__,
|
rosfran@118
|
424 |
(gint) src->buffer_remain, src->bytes_queue->len );
|
rosfran@95
|
425 |
|
rosfran@100
|
426 |
/* just get from the byte array, no network effort... */
|
rosfran@142
|
427 |
if ( ( src->buffer_remain = src->bytes_queue->len ) < MAX_READ_SIZE &&
|
rosfran@142
|
428 |
abs( src->content_size - src->bytes_read ) > MAX_READ_SIZE ) {
|
rosfran@124
|
429 |
//( ( INTERNAL_BUFFER_SIZE - src->buffer_remain ) >= REQUEST_MAX_SIZE ) ) {
|
rosfran@124
|
430 |
GByteArray *buffer = NULL;
|
rosfran@142
|
431 |
guint buffer_size_inter = ( INTERNAL_BUFFER_SIZE - src->buffer_remain );
|
rosfran@142
|
432 |
if ( buffer_size_inter > REQUEST_MAX_SIZE )
|
rosfran@142
|
433 |
buffer_size_inter = REQUEST_MAX_SIZE;
|
rosfran@124
|
434 |
|
rosfran@142
|
435 |
buffer = g_byte_array_new();
|
rosfran@95
|
436 |
|
rosfran@142
|
437 |
read = do_read_request_response( src, buffer_size_inter, buffer );
|
rosfran@142
|
438 |
|
rosfran@142
|
439 |
if (G_UNLIKELY (read < 0)) {
|
rosfran@142
|
440 |
if ( src->live_tv )
|
rosfran@142
|
441 |
goto change_progchain;
|
rosfran@142
|
442 |
else
|
rosfran@142
|
443 |
goto read_error;
|
rosfran@142
|
444 |
} else if (G_UNLIKELY (read == 0) && !src->live_tv )
|
rosfran@151
|
445 |
goto done;
|
rosfran@142
|
446 |
|
rosfran@142
|
447 |
if ( G_UNLIKELY (src->update_prog_chain) )
|
rosfran@142
|
448 |
goto change_progchain;
|
rosfran@142
|
449 |
|
rosfran@151
|
450 |
src->bytes_queue = g_byte_array_append( src->bytes_queue, buffer->data, read );
|
rosfran@142
|
451 |
if ( read > buffer_size_inter )
|
rosfran@142
|
452 |
GST_WARNING_OBJECT( src, "\n\n\n[%s]\t\tINCREASED buffer size! Backend sent more than we ask him... (%d)\n\n\n",
|
rosfran@142
|
453 |
__FUNCTION__, abs( read - buffer_size_inter ) );
|
rosfran@142
|
454 |
|
rosfran@142
|
455 |
src->buffer_remain += read;
|
rosfran@142
|
456 |
|
rosfran@142
|
457 |
if ( buffer != NULL ) {
|
rosfran@142
|
458 |
g_byte_array_free( buffer, TRUE );
|
rosfran@142
|
459 |
buffer = NULL;
|
rosfran@142
|
460 |
}
|
rosfran@124
|
461 |
|
rosfran@124
|
462 |
GST_DEBUG_OBJECT( src, "[%s]\tBYTES READ (actual) = %d, BYTES READ (cumulative) = %llu, "\
|
rosfran@124
|
463 |
"OFFSET = %llu, CONTENT SIZE = %llu.\n", __FUNCTION__, read, src->bytes_read,
|
rosfran@124
|
464 |
src->read_offset, src->content_size );
|
rosfran@100
|
465 |
|
rosfran@81
|
466 |
}
|
rosfran@98
|
467 |
|
rosfran@100
|
468 |
guint buffer_size = ( src->buffer_remain < MAX_READ_SIZE) ? src->buffer_remain : MAX_READ_SIZE;
|
rosfran@100
|
469 |
|
rosfran@100
|
470 |
/* Create the buffer. */
|
rosfran@100
|
471 |
ret = gst_pad_alloc_buffer ( GST_BASE_SRC_PAD (GST_BASE_SRC (psrc)),
|
rosfran@152
|
472 |
GST_BUFFER_OFFSET_NONE, buffer_size,
|
rosfran@100
|
473 |
GST_PAD_CAPS (GST_BASE_SRC_PAD (GST_BASE_SRC (psrc))), outbuf );
|
rosfran@81
|
474 |
|
rosfran@100
|
475 |
if (G_UNLIKELY (ret != GST_FLOW_OK)) {
|
rosfran@100
|
476 |
if ( src->live_tv )
|
rosfran@100
|
477 |
goto change_progchain;
|
rosfran@100
|
478 |
else
|
rosfran@100
|
479 |
goto done;
|
rosfran@100
|
480 |
}
|
rosfran@152
|
481 |
//*outbuf = gst_buffer_new_and_alloc( buffer_size );
|
rosfran@100
|
482 |
|
rosfran@100
|
483 |
/* gets the first buffer_size bytes from the byte array buffer variable */
|
rosfran@151
|
484 |
//guint8 *buf = g_memdup( src->bytes_queue->data, buffer_size );
|
rosfran@95
|
485 |
|
rosfran@106
|
486 |
GST_DEBUG_OBJECT( src, "[%s] read from network? %s!, buffer_remain = %d\n", __FUNCTION__,
|
rosfran@100
|
487 |
read == -1 ? "NO, got from buffer" : "YES, go see the backend's log file", src->buffer_remain );
|
rosfran@95
|
488 |
|
rosfran@100
|
489 |
GST_BUFFER_SIZE (*outbuf) = buffer_size;
|
rosfran@152
|
490 |
//GST_BUFFER_MALLOCDATA( *outbuf ) = g_malloc0( GST_BUFFER_SIZE (*outbuf) );
|
rosfran@152
|
491 |
//GST_BUFFER_DATA( *outbuf ) = GST_BUFFER_MALLOCDATA( *outbuf );
|
rosfran@151
|
492 |
g_memmove( GST_BUFFER_DATA( (*outbuf) ), src->bytes_queue->data, GST_BUFFER_SIZE(*outbuf) );
|
rosfran@95
|
493 |
GST_BUFFER_OFFSET (*outbuf) = src->read_offset;
|
rosfran@95
|
494 |
GST_BUFFER_OFFSET_END (*outbuf) = src->read_offset + GST_BUFFER_SIZE (*outbuf);
|
rosfran@95
|
495 |
|
rosfran@95
|
496 |
src->buffer_remain -= GST_BUFFER_SIZE (*outbuf);
|
rosfran@95
|
497 |
|
rosfran@95
|
498 |
src->read_offset += GST_BUFFER_SIZE (*outbuf);
|
rosfran@95
|
499 |
src->bytes_read += GST_BUFFER_SIZE (*outbuf);
|
rosfran@106
|
500 |
GST_DEBUG_OBJECT( src, "[%s]\t\tBuffer output with size: %d\n", __FUNCTION__, GST_BUFFER_SIZE (*outbuf) );
|
rosfran@100
|
501 |
|
rosfran@100
|
502 |
/* flushs the newly buffer got from byte array */
|
rosfran@100
|
503 |
src->bytes_queue = g_byte_array_remove_range( src->bytes_queue, 0, buffer_size );
|
rosfran@95
|
504 |
|
rosfran@106
|
505 |
GST_DEBUG_OBJECT( src, "Got buffer: [%s]\t\tBUFFER --->SIZE = %d, OFFSET = %llu, "\
|
rosfran@95
|
506 |
"OFFSET_END = %llu.\n\n", __FUNCTION__, GST_BUFFER_SIZE (*outbuf),
|
rosfran@95
|
507 |
GST_BUFFER_OFFSET (*outbuf), GST_BUFFER_OFFSET_END (*outbuf) );
|
rosfran@95
|
508 |
|
rosfran@142
|
509 |
GST_DEBUG_OBJECT( src, "[%s]\tCONTENT_SIZE = %llu, BYTES_READ = %llu.\n", __FUNCTION__,
|
rosfran@142
|
510 |
src->content_size, src->bytes_read );
|
rosfran@142
|
511 |
|
rosfran@142
|
512 |
if ( G_UNLIKELY (src->eos) || ( !src->live_tv && ( src->bytes_read >= src->content_size ) ) )
|
rosfran@142
|
513 |
goto eos;
|
rosfran@90
|
514 |
|
rosfran@81
|
515 |
done:
|
rosfran@90
|
516 |
{
|
rosfran@81
|
517 |
const gchar *reason = gst_flow_get_name (ret);
|
rosfran@81
|
518 |
|
rosfran@81
|
519 |
GST_DEBUG_OBJECT (src, "DONE task, reason %s", reason);
|
rosfran@90
|
520 |
return ret;
|
rosfran@90
|
521 |
}
|
rosfran@81
|
522 |
eos:
|
rosfran@81
|
523 |
{
|
rosfran@81
|
524 |
const gchar *reason = gst_flow_get_name (ret);
|
rosfran@81
|
525 |
|
rosfran@81
|
526 |
GST_DEBUG_OBJECT (src, "pausing task, reason %s", reason);
|
rosfran@81
|
527 |
return GST_FLOW_UNEXPECTED;
|
rosfran@81
|
528 |
}
|
rosfran@81
|
529 |
/* ERRORS */
|
rosfran@81
|
530 |
read_error:
|
rosfran@81
|
531 |
{
|
rosfran@81
|
532 |
GST_ELEMENT_ERROR (src, RESOURCE, READ,
|
rosfran@81
|
533 |
(NULL), ("Could not read any bytes (%i, %s)", read,
|
rosfran@90
|
534 |
src->uri_name));
|
rosfran@81
|
535 |
return GST_FLOW_ERROR;
|
rosfran@81
|
536 |
}
|
rosfran@81
|
537 |
change_progchain:
|
rosfran@81
|
538 |
{
|
rosfran@81
|
539 |
GST_ELEMENT_ERROR (src, RESOURCE, READ,
|
rosfran@90
|
540 |
(NULL), ("Seek failed, go to the next program info... (%i, %s)", read,
|
rosfran@90
|
541 |
src->uri_name));
|
rosfran@90
|
542 |
|
rosfran@90
|
543 |
gst_pad_push_event ( GST_BASE_SRC_PAD (GST_BASE_SRC (psrc)),
|
rosfran@90
|
544 |
gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, 0, -1, 0 ) );
|
rosfran@90
|
545 |
// go to the next program chain
|
rosfran@90
|
546 |
src->unique_setup = FALSE;
|
rosfran@90
|
547 |
src->update_prog_chain = TRUE;
|
rosfran@90
|
548 |
|
rosfran@90
|
549 |
gst_mythtv_src_next_program_chain( src );
|
rosfran@90
|
550 |
|
rosfran@70
|
551 |
return GST_FLOW_ERROR_NO_DATA;
|
rosfran@37
|
552 |
}
|
rosfran@30
|
553 |
|
leo_sobral@2
|
554 |
}
|
rosfran@98
|
555 |
|
rosfran@52
|
556 |
gint64
|
rosfran@30
|
557 |
gst_mythtv_src_get_position ( GstMythtvSrc* src )
|
leo_sobral@2
|
558 |
{
|
rosfran@30
|
559 |
|
rosfran@52
|
560 |
gint64 size_tmp = 0;
|
rosfran@71
|
561 |
guint max_tries = 2;
|
rosfran@71
|
562 |
if (src->live_tv == TRUE && ( abs( src->content_size - src->bytes_read ) <
|
rosfran@71
|
563 |
GMYTHTV_TRANSFER_MAX_BUFFER ) ) {
|
rosfran@71
|
564 |
|
rosfran@30
|
565 |
get_file_pos:
|
rosfran@61
|
566 |
g_usleep( 10 );
|
rosfran@114
|
567 |
size_tmp = gmyth_recorder_get_file_position( src->spawn_livetv->recorder );
|
rosfran@52
|
568 |
if ( size_tmp > ( src->content_size + GMYTHTV_TRANSFER_MAX_BUFFER ) )
|
rosfran@61
|
569 |
src->content_size = size_tmp;
|
rosfran@61
|
570 |
else if ( size_tmp > 0 && --max_tries > 0 )
|
rosfran@61
|
571 |
goto get_file_pos;
|
rosfran@106
|
572 |
GST_LOG_OBJECT( src, "\t[%s]\tGET_POSITION: file_position = %lld\n",
|
rosfran@61
|
573 |
__FUNCTION__, size_tmp );
|
rosfran@71
|
574 |
/* sets the last content size amount before it can be updated */
|
rosfran@71
|
575 |
src->prev_content_size = src->content_size;
|
rosfran@30
|
576 |
}
|
rosfran@52
|
577 |
|
rosfran@30
|
578 |
return src->content_size;
|
rosfran@30
|
579 |
|
leo_sobral@2
|
580 |
}
|
leo_sobral@2
|
581 |
|
rosfran@87
|
582 |
static gboolean
|
rosfran@87
|
583 |
gst_mythtv_src_do_seek( GstBaseSrc *base, GstSegment *segment )
|
rosfran@87
|
584 |
{
|
rosfran@87
|
585 |
GstMythtvSrc *src = GST_MYTHTV_SRC( base );
|
rosfran@90
|
586 |
gint64 new_offset = -1;
|
rosfran@90
|
587 |
gint64 actual_seek = segment->start;
|
rosfran@87
|
588 |
gboolean ret = TRUE;
|
rosfran@87
|
589 |
|
rosfran@106
|
590 |
GST_LOG_OBJECT( src, "[%s]DO Seek called! (start = %lld, stop = %lld)\n", __FUNCTION__,
|
rosfran@106
|
591 |
segment->start, segment->stop );
|
rosfran@90
|
592 |
|
rosfran@90
|
593 |
if ( segment->format == GST_FORMAT_TIME )
|
rosfran@90
|
594 |
{
|
rosfran@90
|
595 |
goto done;
|
rosfran@90
|
596 |
//actual_seek = ( ( segment->start / 1000 ) * 28 ) * 4000;
|
rosfran@90
|
597 |
}
|
rosfran@106
|
598 |
GST_LOG_OBJECT( src, "[%s]Trying to seek at the value (actual_seek = %lld, read_offset = %lld)\n", __FUNCTION__, actual_seek, src->read_offset );
|
rosfran@87
|
599 |
/* verify if it needs to seek */
|
rosfran@90
|
600 |
if ( src->read_offset != actual_seek )
|
rosfran@87
|
601 |
{
|
rosfran@87
|
602 |
|
rosfran@87
|
603 |
new_offset = gmyth_file_transfer_seek( src->file_transfer, segment->start, SEEK_SET );
|
rosfran@87
|
604 |
|
rosfran@106
|
605 |
GST_LOG_OBJECT( src, "[%s] Segment offset start = %lld, SRC Offset = %lld, NEW actual backend SEEK Offset = %lld.\n",
|
rosfran@106
|
606 |
__FUNCTION__, segment->start, src->read_offset, new_offset );
|
rosfran@87
|
607 |
if ( G_UNLIKELY (new_offset < 0 ) )
|
rosfran@87
|
608 |
{
|
rosfran@87
|
609 |
ret = FALSE;
|
rosfran@87
|
610 |
if ( src->live_tv )
|
rosfran@87
|
611 |
goto change_progchain;
|
rosfran@87
|
612 |
else
|
rosfran@87
|
613 |
goto eos;
|
rosfran@87
|
614 |
}
|
rosfran@87
|
615 |
|
rosfran@87
|
616 |
src->read_offset = new_offset;
|
rosfran@87
|
617 |
|
rosfran@90
|
618 |
if ( ret == FALSE ) {
|
rosfran@106
|
619 |
GST_INFO_OBJECT( src, "[%s] Failed to set the SEEK on segment!\n", __FUNCTION__ );
|
rosfran@90
|
620 |
}
|
rosfran@90
|
621 |
|
rosfran@87
|
622 |
}
|
rosfran@90
|
623 |
|
rosfran@90
|
624 |
done:
|
rosfran@87
|
625 |
return ret;
|
rosfran@87
|
626 |
|
rosfran@87
|
627 |
eos:
|
rosfran@87
|
628 |
{
|
rosfran@87
|
629 |
|
rosfran@87
|
630 |
GST_DEBUG_OBJECT (src, "EOS found on seeking!!!");
|
rosfran@87
|
631 |
return FALSE;
|
rosfran@87
|
632 |
}
|
rosfran@87
|
633 |
change_progchain:
|
rosfran@87
|
634 |
{
|
rosfran@87
|
635 |
GST_ELEMENT_ERROR (src, RESOURCE, READ,
|
rosfran@87
|
636 |
(NULL), ("Seek failed, go to the next program info... (%i, %s)", read,
|
rosfran@87
|
637 |
src->uri_name));
|
rosfran@87
|
638 |
|
rosfran@87
|
639 |
gst_pad_push_event ( GST_BASE_SRC_PAD (base),
|
rosfran@87
|
640 |
gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, 0, -1, 0 ) );
|
rosfran@87
|
641 |
/* go to the next program chain */
|
rosfran@87
|
642 |
src->unique_setup = FALSE;
|
rosfran@87
|
643 |
src->update_prog_chain = TRUE;
|
rosfran@87
|
644 |
|
rosfran@87
|
645 |
gst_mythtv_src_next_program_chain( src );
|
rosfran@87
|
646 |
|
rosfran@87
|
647 |
return TRUE;
|
rosfran@87
|
648 |
}
|
rosfran@87
|
649 |
|
rosfran@87
|
650 |
}
|
rosfran@87
|
651 |
|
leo_sobral@2
|
652 |
/* create a socket for connecting to remote server */
|
rosfran@30
|
653 |
static gboolean
|
leo_sobral@2
|
654 |
gst_mythtv_src_start ( GstBaseSrc * bsrc )
|
leo_sobral@2
|
655 |
{
|
leo_sobral@2
|
656 |
GstMythtvSrc *src = GST_MYTHTV_SRC (bsrc);
|
melunko@159
|
657 |
GMythURI *gmyth_uri = NULL;
|
melunko@159
|
658 |
gchar* filename = NULL;
|
leo_sobral@2
|
659 |
|
leo_sobral@2
|
660 |
GString *chain_id_local = NULL;
|
leo_sobral@2
|
661 |
gboolean ret = TRUE;
|
rosfran@90
|
662 |
|
rosfran@71
|
663 |
if ( G_UNLIKELY (src->update_prog_chain) )
|
rosfran@71
|
664 |
goto change_progchain;
|
rosfran@30
|
665 |
|
leo_sobral@2
|
666 |
if (src->unique_setup == FALSE) {
|
leo_sobral@2
|
667 |
src->unique_setup = TRUE;
|
leo_sobral@2
|
668 |
} else {
|
leo_sobral@2
|
669 |
goto done;
|
leo_sobral@2
|
670 |
}
|
leo_sobral@2
|
671 |
|
melunko@159
|
672 |
printf ("XXX %s %d\n", __FUNCTION__, __LINE__);
|
melunko@159
|
673 |
src->backend_info = gmyth_backend_info_new_with_uri( src->uri_name );
|
melunko@159
|
674 |
|
melunko@159
|
675 |
printf ("XXX %s %d\n", __FUNCTION__, __LINE__);
|
leo_sobral@2
|
676 |
if ( src->live_tv ) {
|
rosfran@40
|
677 |
src->spawn_livetv = gmyth_livetv_new( );
|
rosfran@118
|
678 |
if ( gmyth_livetv_setup( src->spawn_livetv, src->backend_info ) == FALSE ) {
|
rosfran@30
|
679 |
ret = FALSE;
|
rosfran@30
|
680 |
goto init_failed;
|
rosfran@70
|
681 |
}
|
rosfran@52
|
682 |
|
melunko@159
|
683 |
printf ("XXX %s %d\n", __FUNCTION__, __LINE__);
|
leo_sobral@2
|
684 |
/* set up the uri variable */
|
leo_sobral@2
|
685 |
src->uri_name = g_strdup( src->spawn_livetv->proginfo->pathname->str );
|
leo_sobral@2
|
686 |
chain_id_local = gmyth_tvchain_get_id( src->spawn_livetv->tvchain );
|
leo_sobral@2
|
687 |
if ( chain_id_local != NULL ) {
|
leo_sobral@2
|
688 |
src->live_chain_id = g_strdup( chain_id_local->str );
|
rosfran@114
|
689 |
GST_INFO_OBJECT( src, "\t[%s]\tLocal chain ID = %s.\n", __FUNCTION__, src->live_chain_id );
|
leo_sobral@2
|
690 |
}
|
rosfran@114
|
691 |
|
melunko@159
|
692 |
printf ("XXX %s %d\n", __FUNCTION__, __LINE__);
|
rosfran@70
|
693 |
src->live_tv_id = src->spawn_livetv->recorder->recorder_num;
|
rosfran@106
|
694 |
GST_LOG_OBJECT( src, "[%s] LiveTV id = %d, URI path = %s.\n", __FUNCTION__, src->live_tv_id, src->uri_name );
|
leo_sobral@2
|
695 |
}
|
leo_sobral@2
|
696 |
|
melunko@159
|
697 |
printf ("XXX %s %d\n", __FUNCTION__, __LINE__);
|
melunko@159
|
698 |
src->file_transfer = gmyth_file_transfer_new( src->backend_info );
|
leo_sobral@2
|
699 |
|
melunko@159
|
700 |
printf ("XXX %s %d\n", __FUNCTION__, __LINE__);
|
leo_sobral@2
|
701 |
if ( src->file_transfer == NULL ) {
|
leo_sobral@2
|
702 |
goto init_failed;
|
leo_sobral@2
|
703 |
}
|
rosfran@124
|
704 |
GST_INFO_OBJECT( src, "[%s] uri = %s.\n", __FUNCTION__, src->uri_name );
|
melunko@159
|
705 |
printf ("XXX %s %d\n", __FUNCTION__, __LINE__);
|
melunko@159
|
706 |
gmyth_uri = gmyth_uri_new_with_value (src->uri_name);
|
melunko@159
|
707 |
printf ("XXX %s %d\n", __FUNCTION__, __LINE__);
|
melunko@159
|
708 |
|
melunko@159
|
709 |
filename = gmyth_uri_get_path (gmyth_uri);
|
melunko@159
|
710 |
printf ("XXX %s %d\n", __FUNCTION__, __LINE__);
|
melunko@159
|
711 |
ret = gmyth_file_transfer_open( src->file_transfer, filename);
|
melunko@159
|
712 |
printf ("XXX %s %d\n", __FUNCTION__, __LINE__);
|
melunko@159
|
713 |
g_object_unref (gmyth_uri);
|
melunko@159
|
714 |
printf ("XXX %s %d\n", __FUNCTION__, __LINE__);
|
leo_sobral@2
|
715 |
|
leo_sobral@2
|
716 |
if ( src->live_tv == TRUE && ret == TRUE ) {
|
leo_sobral@2
|
717 |
/* loop finished, set the max tries variable to zero again... */
|
leo_sobral@2
|
718 |
wait_to_transfer = 0;
|
leo_sobral@2
|
719 |
|
rosfran@70
|
720 |
while ( wait_to_transfer++ < GMYTHTV_TRANSFER_MAX_WAITS &&
|
rosfran@108
|
721 |
( gmyth_livetv_is_recording( src->spawn_livetv ) == FALSE ) )
|
rosfran@110
|
722 |
g_usleep( 500 );
|
rosfran@110
|
723 |
|
rosfran@110
|
724 |
/* IS_RECORDING again, just like the MythTV backend does... */
|
rosfran@110
|
725 |
gmyth_livetv_is_recording( src->spawn_livetv );
|
rosfran@110
|
726 |
|
rosfran@124
|
727 |
sleep( 3 );
|
rosfran@110
|
728 |
|
leo_sobral@2
|
729 |
}
|
leo_sobral@2
|
730 |
/* sets the FileTransfer instance connection (video/audio download) */
|
rosfran@114
|
731 |
//ret = gmyth_file_transfer_setup( &(src->file_transfer), src->live_tv );
|
leo_sobral@2
|
732 |
|
leo_sobral@2
|
733 |
if ( ret == FALSE ) {
|
leo_sobral@2
|
734 |
#ifndef GST_DISABLE_GST_DEBUG
|
leo_sobral@2
|
735 |
if ( src->mythtv_msgs_dbg )
|
rosfran@106
|
736 |
GST_INFO_OBJECT( src, "MythTV FileTransfer request failed when setting up socket connection!\n" );
|
leo_sobral@2
|
737 |
#endif
|
leo_sobral@2
|
738 |
goto begin_req_failed;
|
leo_sobral@2
|
739 |
}
|
leo_sobral@2
|
740 |
|
leo_sobral@2
|
741 |
src->content_size = src->file_transfer->filesize;
|
leo_sobral@2
|
742 |
|
rosfran@71
|
743 |
src->do_start = FALSE;
|
rosfran@114
|
744 |
|
rosfran@114
|
745 |
/* this is used for the buffer cache */
|
rosfran@100
|
746 |
src->bytes_queue = g_byte_array_sized_new( INTERNAL_BUFFER_SIZE );
|
rosfran@90
|
747 |
src->buffer_remain = 0;
|
rosfran@114
|
748 |
|
rosfran@124
|
749 |
gst_pad_push_event ( GST_BASE_SRC_PAD (GST_BASE_SRC (src)),
|
rosfran@124
|
750 |
gst_event_new_new_segment ( TRUE, 1.0, GST_FORMAT_TIME, 0, src->content_size, 0 ) );
|
rosfran@90
|
751 |
|
rosfran@30
|
752 |
done:
|
rosfran@30
|
753 |
return TRUE;
|
rosfran@30
|
754 |
|
rosfran@30
|
755 |
/* ERRORS */
|
rosfran@30
|
756 |
init_failed:
|
rosfran@30
|
757 |
{
|
rosfran@30
|
758 |
if (src->spawn_livetv != NULL )
|
rosfran@30
|
759 |
g_object_unref( src->spawn_livetv );
|
rosfran@30
|
760 |
|
rosfran@30
|
761 |
GST_ELEMENT_ERROR (src, LIBRARY, INIT,
|
rosfran@30
|
762 |
(NULL), ("Could not initialize MythTV library (%i, %s)", ret, src->uri_name));
|
rosfran@30
|
763 |
return FALSE;
|
rosfran@30
|
764 |
}
|
rosfran@30
|
765 |
begin_req_failed:
|
rosfran@30
|
766 |
{
|
rosfran@30
|
767 |
GST_ELEMENT_ERROR (src, LIBRARY, INIT,
|
rosfran@30
|
768 |
(NULL), ("Could not begin request sent to MythTV server (%i, %s)", ret, src->uri_name));
|
rosfran@30
|
769 |
return FALSE;
|
rosfran@30
|
770 |
}
|
rosfran@71
|
771 |
change_progchain:
|
rosfran@71
|
772 |
{
|
rosfran@71
|
773 |
GST_ELEMENT_ERROR (src, RESOURCE, READ,
|
rosfran@90
|
774 |
(NULL), ("Seek failed, go to the next program info... (%s)",
|
rosfran@90
|
775 |
src->uri_name));
|
rosfran@90
|
776 |
|
rosfran@90
|
777 |
gst_pad_push_event ( GST_BASE_SRC_PAD (GST_BASE_SRC (src)),
|
rosfran@90
|
778 |
gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, 0, -1, 0 ) );
|
rosfran@90
|
779 |
|
rosfran@90
|
780 |
// go to the next program chain
|
rosfran@90
|
781 |
src->unique_setup = FALSE;
|
rosfran@90
|
782 |
src->update_prog_chain = TRUE;
|
rosfran@90
|
783 |
|
rosfran@90
|
784 |
gst_mythtv_src_next_program_chain( src );
|
rosfran@90
|
785 |
|
rosfran@71
|
786 |
return TRUE;
|
rosfran@71
|
787 |
}
|
rosfran@30
|
788 |
}
|
leo_sobral@2
|
789 |
|
rosfran@52
|
790 |
/* create a new socket for connecting to the next program chain */
|
rosfran@52
|
791 |
static gboolean
|
rosfran@52
|
792 |
gst_mythtv_src_next_program_chain ( GstMythtvSrc *src )
|
rosfran@52
|
793 |
{
|
rosfran@52
|
794 |
GString *chain_id_local = NULL;
|
rosfran@52
|
795 |
|
rosfran@52
|
796 |
gboolean ret = TRUE;
|
rosfran@61
|
797 |
|
rosfran@52
|
798 |
if ( !src->live_tv )
|
rosfran@61
|
799 |
goto init_failed;
|
rosfran@70
|
800 |
|
rosfran@70
|
801 |
if (src->unique_setup == FALSE) {
|
rosfran@70
|
802 |
src->unique_setup = TRUE;
|
rosfran@70
|
803 |
} else {
|
rosfran@70
|
804 |
goto done;
|
rosfran@70
|
805 |
}
|
rosfran@81
|
806 |
|
rosfran@81
|
807 |
GST_PAD_STREAM_LOCK( GST_BASE_SRC_PAD (GST_BASE_SRC (src)) );
|
rosfran@61
|
808 |
|
rosfran@52
|
809 |
if (src->file_transfer) {
|
rosfran@52
|
810 |
g_object_unref (src->file_transfer);
|
rosfran@52
|
811 |
src->file_transfer = NULL;
|
rosfran@52
|
812 |
}
|
rosfran@61
|
813 |
|
rosfran@52
|
814 |
if (src->uri_name) {
|
rosfran@52
|
815 |
g_free (src->uri_name);
|
rosfran@52
|
816 |
}
|
rosfran@61
|
817 |
|
rosfran@52
|
818 |
if ( src->live_tv ) {
|
rosfran@61
|
819 |
if ( gmyth_livetv_next_program_chain( src->spawn_livetv ) == FALSE ) {
|
rosfran@106
|
820 |
GST_INFO_OBJECT( src, "\n\n[%s]\t\tFailed to go to the next program chain!!!\n\n", __FUNCTION__ );
|
rosfran@61
|
821 |
ret = FALSE;
|
rosfran@61
|
822 |
goto init_failed;
|
rosfran@52
|
823 |
}
|
rosfran@52
|
824 |
/* set up the uri variable */
|
rosfran@52
|
825 |
src->uri_name = g_strdup( src->spawn_livetv->proginfo->pathname->str );
|
rosfran@52
|
826 |
chain_id_local = gmyth_tvchain_get_id( src->spawn_livetv->tvchain );
|
rosfran@52
|
827 |
if ( chain_id_local != NULL ) {
|
rosfran@52
|
828 |
src->live_chain_id = g_strdup( chain_id_local->str );
|
rosfran@106
|
829 |
GST_DEBUG_OBJECT( src, "\t[%s]\tLocal chain ID = %s.\n", __FUNCTION__, src->live_chain_id );
|
rosfran@52
|
830 |
}
|
rosfran@70
|
831 |
src->live_tv_id = src->spawn_livetv->recorder->recorder_num;
|
rosfran@106
|
832 |
GST_LOG_OBJECT( src, "[%s] LiveTV id = %d, URI path = %s.\n", __FUNCTION__, src->live_tv_id, src->uri_name );
|
rosfran@52
|
833 |
}
|
rosfran@52
|
834 |
|
melunko@159
|
835 |
// we do not need to create a new file transfer, just close the previous one and open with the new file name
|
melunko@159
|
836 |
// src->file_transfer = gmyth_file_transfer_new( src->backend_info);
|
melunko@159
|
837 |
gmyth_file_transfer_close (src->backend_info);
|
rosfran@52
|
838 |
|
rosfran@52
|
839 |
if ( src->file_transfer == NULL ) {
|
rosfran@52
|
840 |
goto init_failed;
|
rosfran@52
|
841 |
}
|
rosfran@114
|
842 |
|
melunko@159
|
843 |
GMythURI *myth_uri = gmyth_uri_new_with_value (src->uri_name);
|
melunko@159
|
844 |
ret = gmyth_file_transfer_open( src->file_transfer, gmyth_uri_get_path (myth_uri) );
|
melunko@159
|
845 |
g_object_unref (myth_uri);
|
rosfran@52
|
846 |
|
rosfran@52
|
847 |
if ( src->live_tv == TRUE && ret == TRUE ) {
|
rosfran@52
|
848 |
/* loop finished, set the max tries variable to zero again... */
|
rosfran@52
|
849 |
wait_to_transfer = 0;
|
rosfran@61
|
850 |
|
rosfran@61
|
851 |
g_usleep( 200 );
|
rosfran@52
|
852 |
|
rosfran@52
|
853 |
while ( wait_to_transfer++ < GMYTHTV_TRANSFER_MAX_WAITS &&
|
rosfran@108
|
854 |
( gmyth_livetv_is_recording( src->spawn_livetv ) == FALSE ) )
|
rosfran@61
|
855 |
g_usleep( 1000 );
|
rosfran@52
|
856 |
}
|
rosfran@52
|
857 |
|
rosfran@52
|
858 |
|
rosfran@52
|
859 |
if ( ret == FALSE ) {
|
rosfran@52
|
860 |
#ifndef GST_DISABLE_GST_DEBUG
|
rosfran@52
|
861 |
if ( src->mythtv_msgs_dbg )
|
rosfran@106
|
862 |
GST_ERROR_OBJECT( src, "MythTV FileTransfer request failed when setting up socket connection!\n" );
|
rosfran@52
|
863 |
#endif
|
rosfran@52
|
864 |
goto begin_req_failed;
|
rosfran@52
|
865 |
}
|
rosfran@61
|
866 |
src->content_size_last = src->content_size;
|
rosfran@61
|
867 |
|
rosfran@61
|
868 |
src->content_size = src->file_transfer->filesize;
|
rosfran@87
|
869 |
if ( src->live_tv ) {
|
rosfran@87
|
870 |
wait_to_transfer = 0;
|
rosfran@87
|
871 |
while ( wait_to_transfer++ < GMYTHTV_TRANSFER_MAX_WAITS && src->content_size < GMYTHTV_TRANSFER_MAX_BUFFER )
|
rosfran@87
|
872 |
src->content_size = gst_mythtv_src_get_position( src );
|
rosfran@87
|
873 |
}
|
rosfran@63
|
874 |
|
rosfran@81
|
875 |
src->read_offset = 0;
|
rosfran@70
|
876 |
|
rosfran@100
|
877 |
if ( src->bytes_queue != NULL ) {
|
rosfran@100
|
878 |
g_byte_array_free( src->bytes_queue, TRUE );
|
rosfran@100
|
879 |
}
|
rosfran@100
|
880 |
|
rosfran@100
|
881 |
src->bytes_queue = g_byte_array_sized_new( INTERNAL_BUFFER_SIZE );
|
rosfran@100
|
882 |
|
rosfran@114
|
883 |
//gst_pad_push_event ( GST_BASE_SRC_PAD (GST_BASE_SRC (src)),
|
rosfran@114
|
884 |
// gst_event_new_new_segment ( TRUE, 1.0, GST_FORMAT_TIME, 0, src->content_size, 0 ) );
|
rosfran@114
|
885 |
|
rosfran@70
|
886 |
done:
|
rosfran@81
|
887 |
src->update_prog_chain = FALSE;
|
rosfran@81
|
888 |
|
rosfran@81
|
889 |
GST_PAD_STREAM_UNLOCK( GST_BASE_SRC_PAD (GST_BASE_SRC (src)) );
|
rosfran@81
|
890 |
|
rosfran@52
|
891 |
return TRUE;
|
rosfran@52
|
892 |
|
rosfran@52
|
893 |
/* ERRORS */
|
rosfran@52
|
894 |
init_failed:
|
rosfran@52
|
895 |
{
|
rosfran@52
|
896 |
if (src->spawn_livetv != NULL )
|
rosfran@52
|
897 |
g_object_unref( src->spawn_livetv );
|
rosfran@52
|
898 |
|
rosfran@52
|
899 |
GST_ELEMENT_ERROR (src, LIBRARY, INIT,
|
rosfran@52
|
900 |
(NULL), ("Could not initialize MythTV library (%i, %s)", ret, src->uri_name));
|
rosfran@52
|
901 |
return FALSE;
|
rosfran@52
|
902 |
}
|
rosfran@52
|
903 |
begin_req_failed:
|
rosfran@52
|
904 |
{
|
rosfran@52
|
905 |
GST_ELEMENT_ERROR (src, LIBRARY, INIT,
|
rosfran@52
|
906 |
(NULL), ("Could not begin request sent to MythTV server (%i, %s)", ret, src->uri_name));
|
rosfran@52
|
907 |
return FALSE;
|
rosfran@52
|
908 |
}
|
rosfran@61
|
909 |
|
rosfran@52
|
910 |
}
|
rosfran@52
|
911 |
|
rosfran@30
|
912 |
static gboolean
|
leo_sobral@2
|
913 |
gst_mythtv_src_get_size (GstBaseSrc * bsrc, guint64 * size)
|
leo_sobral@2
|
914 |
{
|
rosfran@31
|
915 |
GstMythtvSrc *src = GST_MYTHTV_SRC (bsrc);
|
rosfran@30
|
916 |
gboolean ret = TRUE;
|
rosfran@106
|
917 |
GST_LOG_OBJECT( src, "[%s] Differs from previous content size: %d (max.: %d)\n", __FUNCTION__,
|
rosfran@63
|
918 |
abs( src->content_size - src->prev_content_size ), GMYTHTV_TRANSFER_MAX_BUFFER );
|
rosfran@98
|
919 |
|
rosfran@100
|
920 |
if ( src->live_tv ) {
|
rosfran@98
|
921 |
ret = FALSE;
|
rosfran@100
|
922 |
} else if ( src->live_tv && src->enable_timing_position && ( abs( src->content_size - src->bytes_read ) <
|
rosfran@70
|
923 |
GMYTHTV_TRANSFER_MAX_BUFFER ) ) {
|
rosfran@70
|
924 |
|
rosfran@114
|
925 |
gint64 new_offset = gmyth_recorder_get_file_position( src->spawn_livetv->recorder );
|
rosfran@70
|
926 |
if ( new_offset > 0 && new_offset > src->content_size ) {
|
rosfran@70
|
927 |
src->content_size = new_offset;
|
rosfran@70
|
928 |
} else if ( new_offset < src->content_size ) {
|
rosfran@70
|
929 |
src->update_prog_chain = TRUE;
|
rosfran@70
|
930 |
}
|
rosfran@61
|
931 |
|
leo_sobral@2
|
932 |
}
|
leo_sobral@2
|
933 |
|
leo_sobral@2
|
934 |
*size = src->content_size;
|
rosfran@106
|
935 |
GST_LOG_OBJECT( src, "[%s] Content size = %lld\n", __FUNCTION__, src->content_size );
|
rosfran@87
|
936 |
|
rosfran@30
|
937 |
return ret;
|
rosfran@30
|
938 |
|
leo_sobral@2
|
939 |
}
|
leo_sobral@2
|
940 |
|
leo_sobral@2
|
941 |
/* close the socket and associated resources
|
leo_sobral@2
|
942 |
* used both to recover from errors and go to NULL state */
|
rosfran@52
|
943 |
static gboolean
|
leo_sobral@2
|
944 |
gst_mythtv_src_stop (GstBaseSrc * bsrc)
|
leo_sobral@2
|
945 |
{
|
leo_sobral@2
|
946 |
GstMythtvSrc *src;
|
leo_sobral@2
|
947 |
|
leo_sobral@2
|
948 |
src = GST_MYTHTV_SRC (bsrc);
|
leo_sobral@2
|
949 |
|
leo_sobral@2
|
950 |
if (src->uri_name) {
|
leo_sobral@2
|
951 |
g_free (src->uri_name);
|
leo_sobral@2
|
952 |
src->uri_name = NULL;
|
leo_sobral@2
|
953 |
}
|
leo_sobral@2
|
954 |
|
leo_sobral@2
|
955 |
if (src->mythtv_caps) {
|
leo_sobral@2
|
956 |
gst_caps_unref (src->mythtv_caps);
|
leo_sobral@2
|
957 |
src->mythtv_caps = NULL;
|
leo_sobral@2
|
958 |
}
|
leo_sobral@2
|
959 |
|
melunko@159
|
960 |
if (src->backend_info != NULL) {
|
melunko@159
|
961 |
g_object_unref (src->backend_info);
|
melunko@159
|
962 |
src->backend_info = NULL;
|
melunko@159
|
963 |
}
|
melunko@159
|
964 |
|
melunko@159
|
965 |
if (src->file_transfer != NULL) {
|
melunko@159
|
966 |
gmyth_file_transfer_close (src->file_transfer);
|
melunko@159
|
967 |
g_object_unref (src->file_transfer);
|
melunko@159
|
968 |
src->file_transfer = NULL;
|
melunko@159
|
969 |
}
|
melunko@159
|
970 |
|
leo_sobral@2
|
971 |
src->eos = FALSE;
|
leo_sobral@2
|
972 |
|
leo_sobral@2
|
973 |
return TRUE;
|
leo_sobral@2
|
974 |
}
|
leo_sobral@2
|
975 |
|
rosfran@30
|
976 |
static gboolean
|
leo_sobral@2
|
977 |
gst_mythtv_src_handle_event (GstPad * pad, GstEvent * event)
|
leo_sobral@2
|
978 |
{
|
leo_sobral@2
|
979 |
GstMythtvSrc *src = GST_MYTHTV_SRC (GST_PAD_PARENT (pad));
|
rosfran@52
|
980 |
gint64 cont_size = 0;
|
rosfran@90
|
981 |
gboolean ret = FALSE;
|
leo_sobral@2
|
982 |
|
leo_sobral@2
|
983 |
switch (GST_EVENT_TYPE (event)) {
|
rosfran@30
|
984 |
case GST_EVENT_EOS:
|
rosfran@106
|
985 |
GST_WARNING_OBJECT( src, "[%s] Got EOS event!!!\n", __FUNCTION__ );
|
rosfran@61
|
986 |
|
rosfran@61
|
987 |
if ( src->live_tv ) {
|
rosfran@61
|
988 |
cont_size = gst_mythtv_src_get_position (src);
|
rosfran@61
|
989 |
if ( cont_size > src->content_size ) {
|
rosfran@61
|
990 |
src->content_size = cont_size;
|
rosfran@61
|
991 |
src->eos = FALSE;
|
rosfran@61
|
992 |
} else {
|
rosfran@61
|
993 |
src->eos = TRUE;
|
rosfran@61
|
994 |
gst_element_set_state ( GST_ELEMENT (src), GST_STATE_NULL );
|
rosfran@61
|
995 |
gst_element_set_locked_state ( GST_ELEMENT (src), FALSE );
|
rosfran@61
|
996 |
}
|
rosfran@114
|
997 |
}
|
rosfran@30
|
998 |
break;
|
leo_sobral@2
|
999 |
default:
|
rosfran@90
|
1000 |
ret = gst_pad_event_default (pad, event);
|
leo_sobral@2
|
1001 |
}
|
leo_sobral@2
|
1002 |
|
rosfran@90
|
1003 |
return ret;
|
leo_sobral@2
|
1004 |
}
|
leo_sobral@2
|
1005 |
|
rosfran@30
|
1006 |
static gboolean
|
rosfran@30
|
1007 |
gst_mythtv_src_is_seekable( GstBaseSrc *push_src )
|
leo_sobral@2
|
1008 |
{
|
rosfran@100
|
1009 |
return TRUE;
|
leo_sobral@2
|
1010 |
}
|
rosfran@87
|
1011 |
|
rosfran@87
|
1012 |
static gboolean
|
rosfran@87
|
1013 |
gst_mythtv_src_handle_query (GstPad * pad, GstQuery * query)
|
rosfran@87
|
1014 |
{
|
rosfran@87
|
1015 |
gboolean res = FALSE;
|
rosfran@87
|
1016 |
GstMythtvSrc *myth = GST_MYTHTV_SRC (gst_pad_get_parent (pad));
|
rosfran@114
|
1017 |
GstFormat formt;
|
rosfran@87
|
1018 |
|
rosfran@87
|
1019 |
switch (GST_QUERY_TYPE (query)) {
|
rosfran@87
|
1020 |
case GST_QUERY_POSITION:
|
rosfran@114
|
1021 |
{
|
rosfran@114
|
1022 |
gint64 pos = -1;
|
rosfran@114
|
1023 |
gst_query_parse_position (query, &formt, &pos );
|
rosfran@87
|
1024 |
res = TRUE;
|
rosfran@124
|
1025 |
if ( formt == GST_FORMAT_BYTES ) {
|
rosfran@124
|
1026 |
gst_query_set_position (query, formt, pos = myth->read_offset );
|
rosfran@114
|
1027 |
GST_DEBUG_OBJECT (myth, "POS %lld (BYTES).\n", pos );
|
rosfran@124
|
1028 |
} else if ( formt == GST_FORMAT_TIME ) {
|
rosfran@114
|
1029 |
GST_DEBUG_OBJECT (myth, "POS %lld (TIME).\n", pos );
|
rosfran@124
|
1030 |
res = gst_pad_query_default(pad, query);
|
rosfran@124
|
1031 |
}
|
rosfran@87
|
1032 |
break;
|
rosfran@114
|
1033 |
}
|
rosfran@87
|
1034 |
case GST_QUERY_DURATION:
|
rosfran@114
|
1035 |
{
|
rosfran@87
|
1036 |
#if 0
|
rosfran@87
|
1037 |
if (myth->duration != 0) {
|
rosfran@87
|
1038 |
gint64 total;
|
rosfran@87
|
1039 |
gint64 fps;
|
rosfran@87
|
1040 |
|
rosfran@87
|
1041 |
fps = nuv->h->i_fpsn / nuv->h->i_fpsd;
|
rosfran@87
|
1042 |
total = gst_util_uint64_scale_int (GST_SECOND, nuv->h->i_video_blocks, fps);
|
rosfran@114
|
1043 |
}
|
rosfran@81
|
1044 |
#endif
|
rosfran@114
|
1045 |
gint64 dur = -1;
|
rosfran@124
|
1046 |
gst_query_parse_duration ( query, &formt, &dur );
|
rosfran@124
|
1047 |
if ( formt == GST_FORMAT_BYTES ) {
|
rosfran@124
|
1048 |
gst_query_set_duration (query, formt, dur = myth->content_size);
|
rosfran@114
|
1049 |
GST_DEBUG_OBJECT (myth, "DURATION %lld (BYTES).\n", dur );
|
rosfran@124
|
1050 |
} else if ( formt == GST_FORMAT_TIME ) {
|
rosfran@114
|
1051 |
GST_DEBUG_OBJECT (myth, "DURATION %lld (TIME).\n", dur );
|
rosfran@124
|
1052 |
gst_query_ref(query);
|
rosfran@124
|
1053 |
res = gst_pad_query_default(pad, query);
|
rosfran@124
|
1054 |
}
|
rosfran@114
|
1055 |
res = TRUE;
|
rosfran@70
|
1056 |
break;
|
rosfran@114
|
1057 |
}
|
rosfran@70
|
1058 |
default:
|
rosfran@114
|
1059 |
{
|
rosfran@124
|
1060 |
res = gst_pad_query_default(pad, query);
|
rosfran@87
|
1061 |
break;
|
rosfran@114
|
1062 |
}
|
rosfran@70
|
1063 |
}
|
rosfran@61
|
1064 |
|
rosfran@87
|
1065 |
gst_object_unref (myth);
|
rosfran@61
|
1066 |
|
rosfran@70
|
1067 |
return res;
|
rosfran@61
|
1068 |
}
|
rosfran@61
|
1069 |
|
rosfran@52
|
1070 |
static GstStateChangeReturn
|
rosfran@52
|
1071 |
gst_mythtv_src_change_state (GstElement * element, GstStateChange transition)
|
rosfran@52
|
1072 |
{
|
rosfran@87
|
1073 |
GstStateChangeReturn ret = GST_STATE_CHANGE_FAILURE;//GST_STATE_CHANGE_NO_PREROLL;
|
rosfran@52
|
1074 |
GstMythtvSrc *src = GST_MYTHTV_SRC (element);
|
rosfran@52
|
1075 |
|
rosfran@52
|
1076 |
switch (transition) {
|
rosfran@52
|
1077 |
case GST_STATE_CHANGE_NULL_TO_READY:
|
rosfran@87
|
1078 |
//src->do_start = TRUE;
|
rosfran@87
|
1079 |
//src->unique_setup = FALSE;
|
rosfran@52
|
1080 |
break;
|
rosfran@52
|
1081 |
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
rosfran@124
|
1082 |
GST_INFO_OBJECT( src, "[%s] READY to PAUSED called!\n", __FUNCTION__ );
|
rosfran@124
|
1083 |
break;
|
rosfran@52
|
1084 |
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
rosfran@124
|
1085 |
GST_INFO_OBJECT( src, "[%s] PAUSED to PLAYING called!\n", __FUNCTION__ );
|
rosfran@124
|
1086 |
if ( src->live_tv ) {
|
rosfran@124
|
1087 |
if ( !gmyth_recorder_send_frontend_ready_command( src->spawn_livetv->recorder ) )
|
rosfran@124
|
1088 |
GST_WARNING_OBJECT( src, "[%s] Couldn't send the FRONTEND_READY message to the backend!", __FUNCTION__ );
|
rosfran@124
|
1089 |
else
|
rosfran@124
|
1090 |
GST_DEBUG_OBJECT( src, "[%s] Message FRONTEND_READY was sent to the backend!", __FUNCTION__ );
|
rosfran@124
|
1091 |
}
|
rosfran@124
|
1092 |
|
rosfran@52
|
1093 |
break;
|
rosfran@52
|
1094 |
default:
|
rosfran@52
|
1095 |
break;
|
rosfran@52
|
1096 |
}
|
rosfran@61
|
1097 |
|
rosfran@61
|
1098 |
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
rosfran@52
|
1099 |
if (ret == GST_STATE_CHANGE_FAILURE)
|
rosfran@52
|
1100 |
return ret;
|
rosfran@52
|
1101 |
|
rosfran@52
|
1102 |
switch (transition) {
|
rosfran@52
|
1103 |
case GST_STATE_CHANGE_READY_TO_NULL:
|
rosfran@106
|
1104 |
GST_INFO_OBJECT( src, "[%s] READY to NULL called!\n", __FUNCTION__ );
|
rosfran@52
|
1105 |
break;
|
rosfran@61
|
1106 |
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
rosfran@106
|
1107 |
GST_INFO_OBJECT( src, "[%s] PLAYING to PAUSED called!\n", __FUNCTION__ );
|
rosfran@52
|
1108 |
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
rosfran@106
|
1109 |
GST_INFO_OBJECT( src, "[%s] PAUSED to READY called!\n", __FUNCTION__ );
|
rosfran@124
|
1110 |
if ( src->live_tv ) {
|
rosfran@110
|
1111 |
if ( !gmyth_recorder_send_frontend_ready_command( src->spawn_livetv->recorder ) )
|
rosfran@110
|
1112 |
GST_WARNING_OBJECT( src, "[%s] Couldn't send the FRONTEND_READY message to the backend!", __FUNCTION__ );
|
rosfran@110
|
1113 |
else
|
rosfran@110
|
1114 |
GST_DEBUG_OBJECT( src, "[%s] Message FRONTEND_READY was sent to the backend!", __FUNCTION__ );
|
rosfran@81
|
1115 |
|
rosfran@98
|
1116 |
/*
|
rosfran@98
|
1117 |
|
rosfran@81
|
1118 |
gst_pad_push_event ( GST_BASE_SRC_PAD (GST_BASE_SRC (src)),
|
rosfran@81
|
1119 |
gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, 0, -1, 0 ) );
|
rosfran@81
|
1120 |
|
rosfran@70
|
1121 |
src->read_offset = 0;
|
rosfran@70
|
1122 |
src->bytes_read = 0;
|
rosfran@81
|
1123 |
src->unique_setup = FALSE;
|
rosfran@70
|
1124 |
gst_mythtv_src_next_program_chain( src );
|
rosfran@98
|
1125 |
*/
|
rosfran@61
|
1126 |
}
|
rosfran@98
|
1127 |
|
rosfran@61
|
1128 |
break;
|
rosfran@52
|
1129 |
default:
|
rosfran@52
|
1130 |
break;
|
rosfran@52
|
1131 |
}
|
rosfran@52
|
1132 |
|
rosfran@52
|
1133 |
return ret;
|
rosfran@52
|
1134 |
}
|
rosfran@52
|
1135 |
|
rosfran@30
|
1136 |
static void
|
leo_sobral@2
|
1137 |
gst_mythtv_src_set_property (GObject * object, guint prop_id,
|
leo_sobral@2
|
1138 |
const GValue * value, GParamSpec * pspec)
|
leo_sobral@2
|
1139 |
{
|
leo_sobral@2
|
1140 |
GstMythtvSrc *mythtvsrc = GST_MYTHTV_SRC (object);
|
leo_sobral@2
|
1141 |
|
leo_sobral@2
|
1142 |
GST_OBJECT_LOCK (mythtvsrc);
|
leo_sobral@2
|
1143 |
switch (prop_id) {
|
leo_sobral@2
|
1144 |
case PROP_URI:
|
leo_sobral@2
|
1145 |
case PROP_LOCATION:
|
leo_sobral@2
|
1146 |
{
|
leo_sobral@2
|
1147 |
if (!g_value_get_string (value)) {
|
leo_sobral@2
|
1148 |
GST_WARNING ("location property cannot be NULL");
|
leo_sobral@2
|
1149 |
goto done;
|
leo_sobral@2
|
1150 |
}
|
leo_sobral@2
|
1151 |
|
leo_sobral@2
|
1152 |
if (mythtvsrc->uri_name != NULL) {
|
leo_sobral@2
|
1153 |
g_free (mythtvsrc->uri_name);
|
leo_sobral@2
|
1154 |
mythtvsrc->uri_name = NULL;
|
leo_sobral@2
|
1155 |
}
|
leo_sobral@2
|
1156 |
mythtvsrc->uri_name = g_value_dup_string (value);
|
leo_sobral@2
|
1157 |
|
leo_sobral@2
|
1158 |
break;
|
leo_sobral@2
|
1159 |
}
|
leo_sobral@2
|
1160 |
#ifndef GST_DISABLE_GST_DEBUG
|
rosfran@40
|
1161 |
case PROP_GMYTHTV_DBG:
|
leo_sobral@2
|
1162 |
{
|
leo_sobral@2
|
1163 |
mythtvsrc->mythtv_msgs_dbg = g_value_get_boolean (value);
|
leo_sobral@2
|
1164 |
break;
|
leo_sobral@2
|
1165 |
}
|
leo_sobral@2
|
1166 |
#endif
|
rosfran@40
|
1167 |
case PROP_GMYTHTV_VERSION:
|
leo_sobral@2
|
1168 |
{
|
leo_sobral@2
|
1169 |
mythtvsrc->mythtv_version = g_value_get_int (value);
|
leo_sobral@2
|
1170 |
break;
|
leo_sobral@2
|
1171 |
}
|
rosfran@40
|
1172 |
case PROP_GMYTHTV_LIVEID:
|
leo_sobral@2
|
1173 |
{
|
leo_sobral@2
|
1174 |
mythtvsrc->live_tv_id = g_value_get_int (value);
|
leo_sobral@2
|
1175 |
break;
|
leo_sobral@2
|
1176 |
}
|
rosfran@40
|
1177 |
case PROP_GMYTHTV_LIVE:
|
leo_sobral@2
|
1178 |
{
|
leo_sobral@2
|
1179 |
mythtvsrc->live_tv = g_value_get_boolean (value);
|
leo_sobral@2
|
1180 |
break;
|
leo_sobral@2
|
1181 |
}
|
rosfran@52
|
1182 |
case PROP_GMYTHTV_ENABLE_TIMING_POSITION:
|
rosfran@52
|
1183 |
{
|
rosfran@52
|
1184 |
mythtvsrc->enable_timing_position = g_value_get_boolean (value);
|
rosfran@52
|
1185 |
break;
|
rosfran@52
|
1186 |
}
|
rosfran@40
|
1187 |
case PROP_GMYTHTV_LIVE_CHAINID:
|
leo_sobral@2
|
1188 |
{
|
leo_sobral@2
|
1189 |
if (!g_value_get_string (value)) {
|
leo_sobral@2
|
1190 |
GST_WARNING ("MythTV Live chainid property cannot be NULL");
|
leo_sobral@2
|
1191 |
goto done;
|
leo_sobral@2
|
1192 |
}
|
leo_sobral@2
|
1193 |
|
leo_sobral@2
|
1194 |
if (mythtvsrc->live_chain_id != NULL) {
|
leo_sobral@2
|
1195 |
g_free (mythtvsrc->live_chain_id);
|
leo_sobral@2
|
1196 |
mythtvsrc->live_chain_id = NULL;
|
leo_sobral@2
|
1197 |
}
|
leo_sobral@2
|
1198 |
mythtvsrc->live_chain_id = g_value_dup_string (value);
|
leo_sobral@2
|
1199 |
break;
|
leo_sobral@2
|
1200 |
}
|
rosfran@70
|
1201 |
case PROP_GMYTHTV_CHANNEL_NUM:
|
rosfran@70
|
1202 |
{
|
rosfran@70
|
1203 |
mythtvsrc->channel_num = g_value_get_int (value);
|
rosfran@70
|
1204 |
break;
|
rosfran@70
|
1205 |
}
|
leo_sobral@2
|
1206 |
default:
|
leo_sobral@2
|
1207 |
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
leo_sobral@2
|
1208 |
break;
|
leo_sobral@2
|
1209 |
}
|
leo_sobral@2
|
1210 |
GST_OBJECT_UNLOCK (mythtvsrc);
|
leo_sobral@2
|
1211 |
done:
|
leo_sobral@2
|
1212 |
return;
|
leo_sobral@2
|
1213 |
}
|
leo_sobral@2
|
1214 |
|
rosfran@100
|
1215 |
static void
|
leo_sobral@2
|
1216 |
gst_mythtv_src_get_property (GObject * object, guint prop_id,
|
leo_sobral@2
|
1217 |
GValue * value, GParamSpec * pspec)
|
leo_sobral@2
|
1218 |
{
|
leo_sobral@2
|
1219 |
GstMythtvSrc *mythtvsrc = GST_MYTHTV_SRC (object);
|
leo_sobral@2
|
1220 |
|
leo_sobral@2
|
1221 |
GST_OBJECT_LOCK (mythtvsrc);
|
leo_sobral@2
|
1222 |
switch (prop_id) {
|
leo_sobral@2
|
1223 |
case PROP_URI:
|
leo_sobral@2
|
1224 |
case PROP_LOCATION:
|
leo_sobral@2
|
1225 |
{
|
leo_sobral@2
|
1226 |
gchar *str = g_strdup( "" );
|
leo_sobral@2
|
1227 |
|
leo_sobral@2
|
1228 |
if ( mythtvsrc->uri_name == NULL ) {
|
leo_sobral@2
|
1229 |
g_free (mythtvsrc->uri_name);
|
leo_sobral@2
|
1230 |
mythtvsrc->uri_name = NULL;
|
leo_sobral@2
|
1231 |
} else {
|
leo_sobral@2
|
1232 |
str = g_strdup( mythtvsrc->uri_name );
|
leo_sobral@2
|
1233 |
}
|
leo_sobral@2
|
1234 |
g_value_set_string ( value, str );
|
leo_sobral@2
|
1235 |
break;
|
leo_sobral@2
|
1236 |
}
|
leo_sobral@2
|
1237 |
#ifndef GST_DISABLE_GST_DEBUG
|
rosfran@40
|
1238 |
case PROP_GMYTHTV_DBG:
|
leo_sobral@2
|
1239 |
g_value_set_boolean ( value, mythtvsrc->mythtv_msgs_dbg );
|
leo_sobral@2
|
1240 |
break;
|
leo_sobral@2
|
1241 |
#endif
|
rosfran@40
|
1242 |
case PROP_GMYTHTV_VERSION:
|
leo_sobral@2
|
1243 |
{
|
leo_sobral@2
|
1244 |
g_value_set_int ( value, mythtvsrc->mythtv_version );
|
leo_sobral@2
|
1245 |
break;
|
leo_sobral@2
|
1246 |
}
|
rosfran@40
|
1247 |
case PROP_GMYTHTV_LIVEID:
|
leo_sobral@2
|
1248 |
{
|
leo_sobral@2
|
1249 |
g_value_set_int ( value, mythtvsrc->live_tv_id );
|
leo_sobral@2
|
1250 |
break;
|
leo_sobral@2
|
1251 |
}
|
rosfran@40
|
1252 |
case PROP_GMYTHTV_LIVE:
|
leo_sobral@2
|
1253 |
g_value_set_boolean ( value, mythtvsrc->live_tv );
|
leo_sobral@2
|
1254 |
break;
|
rosfran@52
|
1255 |
case PROP_GMYTHTV_ENABLE_TIMING_POSITION:
|
rosfran@52
|
1256 |
g_value_set_boolean ( value, mythtvsrc->enable_timing_position );
|
rosfran@52
|
1257 |
break;
|
rosfran@40
|
1258 |
case PROP_GMYTHTV_LIVE_CHAINID:
|
leo_sobral@2
|
1259 |
{
|
leo_sobral@2
|
1260 |
gchar *str = g_strdup( "" );
|
leo_sobral@2
|
1261 |
|
leo_sobral@2
|
1262 |
if ( mythtvsrc->live_chain_id == NULL ) {
|
leo_sobral@2
|
1263 |
g_free (mythtvsrc->live_chain_id);
|
leo_sobral@2
|
1264 |
mythtvsrc->live_chain_id = NULL;
|
leo_sobral@2
|
1265 |
} else {
|
leo_sobral@2
|
1266 |
str = g_strdup( mythtvsrc->live_chain_id );
|
leo_sobral@2
|
1267 |
}
|
leo_sobral@2
|
1268 |
g_value_set_string ( value, str );
|
leo_sobral@2
|
1269 |
break;
|
leo_sobral@2
|
1270 |
}
|
rosfran@70
|
1271 |
case PROP_GMYTHTV_CHANNEL_NUM:
|
rosfran@70
|
1272 |
{
|
rosfran@70
|
1273 |
g_value_set_int ( value, mythtvsrc->channel_num );
|
rosfran@70
|
1274 |
break;
|
rosfran@70
|
1275 |
}
|
leo_sobral@2
|
1276 |
default:
|
leo_sobral@2
|
1277 |
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
leo_sobral@2
|
1278 |
break;
|
leo_sobral@2
|
1279 |
}
|
leo_sobral@2
|
1280 |
GST_OBJECT_UNLOCK (mythtvsrc);
|
leo_sobral@2
|
1281 |
}
|
leo_sobral@2
|
1282 |
|
leo_sobral@2
|
1283 |
/* entry point to initialize the plug-in
|
leo_sobral@2
|
1284 |
* initialize the plug-in itself
|
leo_sobral@2
|
1285 |
* register the element factories and pad templates
|
leo_sobral@2
|
1286 |
* register the features
|
leo_sobral@2
|
1287 |
*/
|
rosfran@40
|
1288 |
static gboolean
|
leo_sobral@2
|
1289 |
plugin_init (GstPlugin * plugin)
|
leo_sobral@2
|
1290 |
{
|
leo_sobral@2
|
1291 |
return gst_element_register (plugin, "mythtvsrc", GST_RANK_NONE,
|
leo_sobral@2
|
1292 |
GST_TYPE_MYTHTV_SRC);
|
leo_sobral@2
|
1293 |
}
|
leo_sobral@2
|
1294 |
|
leo_sobral@2
|
1295 |
/* this is the structure that gst-register looks for
|
leo_sobral@2
|
1296 |
* so keep the name plugin_desc, or you cannot get your plug-in registered */
|
leo_sobral@2
|
1297 |
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
leo_sobral@2
|
1298 |
GST_VERSION_MINOR,
|
leo_sobral@2
|
1299 |
"mythtv",
|
leo_sobral@2
|
1300 |
"lib MythTV src",
|
leo_sobral@2
|
1301 |
plugin_init, VERSION, "LGPL", "GStreamer", "http://gstreamer.net/")
|
leo_sobral@2
|
1302 |
|
leo_sobral@2
|
1303 |
|
leo_sobral@2
|
1304 |
/*** GSTURIHANDLER INTERFACE *************************************************/
|
leo_sobral@2
|
1305 |
static guint
|
leo_sobral@2
|
1306 |
gst_mythtv_src_uri_get_type (void)
|
leo_sobral@2
|
1307 |
{
|
leo_sobral@2
|
1308 |
return GST_URI_SRC;
|
leo_sobral@2
|
1309 |
}
|
leo_sobral@2
|
1310 |
|
leo_sobral@2
|
1311 |
static gchar **
|
leo_sobral@2
|
1312 |
gst_mythtv_src_uri_get_protocols (void)
|
leo_sobral@2
|
1313 |
{
|
leo_sobral@2
|
1314 |
static gchar *protocols[] = { "myth", "myths", NULL };
|
leo_sobral@2
|
1315 |
|
leo_sobral@2
|
1316 |
return protocols;
|
leo_sobral@2
|
1317 |
}
|
leo_sobral@2
|
1318 |
|
leo_sobral@2
|
1319 |
static const gchar *
|
leo_sobral@2
|
1320 |
gst_mythtv_src_uri_get_uri (GstURIHandler * handler)
|
leo_sobral@2
|
1321 |
{
|
leo_sobral@2
|
1322 |
GstMythtvSrc *src = GST_MYTHTV_SRC (handler);
|
leo_sobral@2
|
1323 |
|
leo_sobral@2
|
1324 |
return src->uri_name;
|
leo_sobral@2
|
1325 |
}
|
leo_sobral@2
|
1326 |
|
leo_sobral@2
|
1327 |
static gboolean
|
leo_sobral@2
|
1328 |
gst_mythtv_src_uri_set_uri (GstURIHandler * handler, const gchar * uri)
|
leo_sobral@2
|
1329 |
{
|
leo_sobral@2
|
1330 |
GstMythtvSrc *src = GST_MYTHTV_SRC (handler);
|
leo_sobral@2
|
1331 |
|
leo_sobral@2
|
1332 |
gchar *protocol;
|
leo_sobral@2
|
1333 |
|
leo_sobral@2
|
1334 |
protocol = gst_uri_get_protocol (uri);
|
leo_sobral@2
|
1335 |
if ((strcmp (protocol, "myth") != 0) && (strcmp (protocol, "myths") != 0)) {
|
leo_sobral@2
|
1336 |
g_free (protocol);
|
leo_sobral@2
|
1337 |
return FALSE;
|
leo_sobral@2
|
1338 |
}
|
leo_sobral@2
|
1339 |
g_free (protocol);
|
leo_sobral@2
|
1340 |
g_object_set (src, "location", uri, NULL);
|
leo_sobral@2
|
1341 |
|
leo_sobral@2
|
1342 |
return TRUE;
|
leo_sobral@2
|
1343 |
}
|
leo_sobral@2
|
1344 |
|
rosfran@87
|
1345 |
static void
|
leo_sobral@2
|
1346 |
gst_mythtv_src_uri_handler_init (gpointer g_iface, gpointer iface_data)
|
leo_sobral@2
|
1347 |
{
|
leo_sobral@2
|
1348 |
GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface;
|
leo_sobral@2
|
1349 |
|
leo_sobral@2
|
1350 |
iface->get_type = gst_mythtv_src_uri_get_type;
|
leo_sobral@2
|
1351 |
iface->get_protocols = gst_mythtv_src_uri_get_protocols;
|
leo_sobral@2
|
1352 |
iface->get_uri = gst_mythtv_src_uri_get_uri;
|
leo_sobral@2
|
1353 |
iface->set_uri = gst_mythtv_src_uri_set_uri;
|
leo_sobral@2
|
1354 |
}
|
leo_sobral@2
|
1355 |
|
leo_sobral@2
|
1356 |
void
|
leo_sobral@2
|
1357 |
size_header_handler (void *userdata, const char *value)
|
leo_sobral@2
|
1358 |
{
|
leo_sobral@2
|
1359 |
GstMythtvSrc *src = GST_MYTHTV_SRC (userdata);
|
leo_sobral@2
|
1360 |
|
leo_sobral@2
|
1361 |
//src->content_size = g_ascii_strtoull (value, NULL, 10);
|
leo_sobral@2
|
1362 |
|
leo_sobral@2
|
1363 |
GST_DEBUG_OBJECT (src, "content size = %lld bytes", src->content_size);
|
leo_sobral@2
|
1364 |
}
|