var stop_type = Gst.SeekType.NONE;
Format format;
var flags = SeekFlags.FLUSH;
+ int64 start, stop;
if (this.seek is HTTPTimeSeek) {
format = Format.TIME;
flags |= SeekFlags.KEY_UNIT;
+ start = (this.seek.start) * Gst.USECOND;
+ stop = (this.seek.stop) * Gst.USECOND;
} else {
format = Format.BYTES;
flags |= SeekFlags.ACCURATE;
+ start = this.seek.start;
+ stop = this.seek.stop;
}
if (this.seek.stop > 0) {
format,
flags,
Gst.SeekType.SET,
- this.seek.start,
+ start,
stop_type,
- this.seek.stop + 1)) {
+ stop + 1)) {
warning (_("Failed to seek to offsets %lld:%lld"),
this.seek.start,
this.seek.stop);
/*
* Copyright (C) 2009 Nokia Corporation.
+ * Copyright (C) 2012 Intel Corporation.
*
* Author: Zeeshan Ali (Khattak) <zeeshanak@gnome.org>
* <zeeshan.ali@nokia.com>
+ * Jens Georg <jensg@openismus.com>
*
* This file is part of Rygel.
*
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-using Gst;
-
internal class Rygel.HTTPTimeSeek : Rygel.HTTPSeek {
public HTTPTimeSeek (HTTPGet request) throws HTTPSeekError {
string range;
string[] range_tokens;
int64 start = 0;
- int64 duration = (request.item as AudioItem).duration * SECOND;
- int64 stop = duration - MSECOND;
+ int64 duration = (request.item as AudioItem).duration * TimeSpan.SECOND;
+ int64 stop = duration - TimeSpan.MILLISECOND;
int64 parsed_value = 0;
bool parsing_start = true;
}
}
- base (request.msg, start, stop, MSECOND, duration);
+ base (request.msg, start, stop, TimeSpan.MILLISECOND, duration);
}
public static bool needed (HTTPGet request) {
public override void add_response_headers () {
// TimeSeekRange.dlna.org: npt=START_TIME-END_TIME/DURATION
- double start = (double) this.start / SECOND;
- double stop = (double) this.stop / SECOND;
- double total = (double) this.total_length / SECOND;
+ double start = (double) this.start / TimeSpan.SECOND;
+ double stop = (double) this.stop / TimeSpan.SECOND;
+ double total = (double) this.total_length / TimeSpan.SECOND;
var start_str = new char[double.DTOSTR_BUF_SIZE];
var stop_str = new char[double.DTOSTR_BUF_SIZE];
private static bool parse_seconds (string range_token,
ref int64 value) {
if (range_token[0].isdigit ()) {
- value = (int64) (double.parse (range_token) * SECOND);
+ value = (int64) (double.parse (range_token) * TimeSpan.SECOND);
} else {
return false;
}
foreach (string time in time_tokens) {
if (time[0].isdigit ()) {
seconds_sum += (int64) ((double.parse (time) *
- SECOND) * time_factor);
+ TimeSpan.SECOND) * time_factor);
} else {
return false;
}
rygel-item-creator-test \
rygel-playbin-renderer-test \
rygel-user-config-test \
- rygel-regression
+ rygel-regression \
+ rygel-environment-test
TESTS = $(check_PROGRAMS)
$(top_builddir)/src/librygel-server/librygel-server-1.0.la \
$(top_builddir)/src/librygel-core/librygel-core-1.0.la
+rygel_environment_test_SOURCES = rygel-environment-test.vala
+rygel_environment_test_CFLAGS = $(AM_CFLAGS)
+rygel_environment_test_LDADD = $(LDADD)
+rygel_environment_test_VALAFLAGS = $(AM_VALAFLAGS) --pkg gstreamer-0.10
+
if ALWAYS_TEST
all-local: check
endif
--- /dev/null
+/*
+ * Copyright (C) 2012 Intel Corporation.
+ *
+ * Author: Jens Georg <jensg@openismus.com>
+ *
+ * This file is part of Rygel.
+ *
+ * Rygel is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Rygel is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+public class EnvironmentTest {
+ public static int main (string[] args) {
+ // Check that the base of TimeSpan is a micro-second
+ // Otherwise rygel-gst-data-source.vala needs adaption
+ assert (TimeSpan.SECOND * Gst.USECOND == Gst.SECOND);
+
+ return 0;
+ }
+}
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-using Gst;
-
private errordomain Rygel.TestError {
SKIP
}
Subtitle? subtitle) throws HTTPSeekError {
var request = new HTTPGet (thumbnail, subtitle);
var audio_item = request.item as AudioItem;
- this.test_seek (request, 0, audio_item.duration * SECOND - MSECOND);
+ this.test_seek (request,
+ 0,
+ audio_item.duration * TimeSpan.SECOND - TimeSpan.MILLISECOND);
}
private void test_start_only_seek (Thumbnail? thumbnail,
var audio_item = request.item as AudioItem;
this.test_seek (request,
- 128 * SECOND,
- audio_item.duration * SECOND - MSECOND);
+ 128 * TimeSpan.SECOND,
+ audio_item.duration * TimeSpan.SECOND - TimeSpan.MILLISECOND);
}
private void test_stop_only_seek (Thumbnail? thumbnail,
break;
}
- this.test_seek (request, 0, 128 * SECOND);
+ this.test_seek (request, 0, 128 * TimeSpan.SECOND);
}
private void test_start_stop_seek (Thumbnail? thumbnail,
}
- this.test_seek (request, 128 * SECOND, 256 * SECOND);
+ this.test_seek (request, 128 * TimeSpan.SECOND, 256 * TimeSpan.SECOND);
}
private void test_seek (HTTPGet request,
assert (seek != null);
assert (seek.start == start);
assert (seek.stop == stop);
- assert (seek.length == seek.stop + MSECOND - seek.start);
+ assert (seek.length == seek.stop + TimeSpan.MILLISECOND - seek.start);
var audio_item = request.item as AudioItem;
- assert (seek.total_length == audio_item.duration * SECOND);
+ assert (seek.total_length == audio_item.duration * TimeSpan.SECOND);
var header = request.msg.response_headers.get_one
("TimeSeekRange.dlna.org");