rygel r761 - trunk/src/rygel
- From: zeeshanak svn gnome org
- To: svn-commits-list gnome org
- Subject: rygel r761 - trunk/src/rygel
- Date: Sat, 28 Mar 2009 00:45:48 +0000 (UTC)
Author: zeeshanak
Date: Sat Mar 28 00:45:48 2009
New Revision: 761
URL: http://svn.gnome.org/viewvc/rygel?rev=761&view=rev
Log:
Turn TranscoderBin into GstUtils.
TranscoderBin was only having two static utility functions that could
be used by non-transcoder-bin classes as well and we can move other
gst-related functions here in future.
Added:
trunk/src/rygel/rygel-gst-utils.vala
Modified:
trunk/src/rygel/Makefile.am
trunk/src/rygel/rygel-l16-transcoder-bin.vala
trunk/src/rygel/rygel-l16-transcoder.vala
trunk/src/rygel/rygel-mp2ts-transcoder-bin.vala
trunk/src/rygel/rygel-mp2ts-transcoder.vala
trunk/src/rygel/rygel-mp3-transcoder-bin.vala
trunk/src/rygel/rygel-mp3-transcoder.vala
trunk/src/rygel/rygel-transcoder.vala
Modified: trunk/src/rygel/Makefile.am
==============================================================================
--- trunk/src/rygel/Makefile.am (original)
+++ trunk/src/rygel/Makefile.am Sat Mar 28 00:45:48 2009
@@ -138,7 +138,9 @@
rygel-mp3-transcoder-bin.h \
rygel-mp3-transcoder-bin.c \
rygel-l16-transcoder-bin.h \
- rygel-l16-transcoder-bin.c
+ rygel-l16-transcoder-bin.c \
+ rygel-gst-utils.h \
+ rygel-gst-utils.c
rygel.stamp: $(filter %.vala,$(rygel_SOURCES))
$(VALAC) -C --vapidir=$(srcdir) \
@@ -183,7 +185,8 @@
rygel-l16-transcoder.vala \
rygel-mp2ts-transcoder-bin.vala \
rygel-mp3-transcoder-bin.vala \
- rygel-l16-transcoder-bin.vala
+ rygel-l16-transcoder-bin.vala \
+ rygel-gst-utils.vala
rygel-1.0.vapi: $(VAPI_SOURCE_FILES)
$(VALAC) -C --library=rygel-1.0 \
Added: trunk/src/rygel/rygel-gst-utils.vala
==============================================================================
--- (empty file)
+++ trunk/src/rygel/rygel-gst-utils.vala Sat Mar 28 00:45:48 2009
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2009 Nokia Corporation, all rights reserved.
+ *
+ * Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
+ * <zeeshan ali nokia 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.
+ */
+using Rygel;
+using Gst;
+
+internal abstract class Rygel.GstUtils {
+ public static Element create_element (string factoryname,
+ string? name)
+ throws Error {
+ Element element = ElementFactory.make (factoryname, name);
+ if (element == null) {
+ throw new LiveResponseError.MISSING_PLUGIN (
+ "Required element factory '%s' missing",
+ factoryname);
+ }
+
+ return element;
+ }
+
+ public static void post_error (Element dest, Error error) {
+ Message msg = new Message.error (dest, error, error.message);
+ dest.post_message (msg);
+ }
+}
Modified: trunk/src/rygel/rygel-l16-transcoder-bin.vala
==============================================================================
--- trunk/src/rygel/rygel-l16-transcoder-bin.vala (original)
+++ trunk/src/rygel/rygel-l16-transcoder-bin.vala Sat Mar 28 00:45:48 2009
@@ -23,7 +23,7 @@
using Rygel;
using Gst;
-internal class Rygel.L16TranscoderBin : Rygel.TranscoderBin {
+internal class Rygel.L16TranscoderBin : Gst.Bin {
private const string DECODEBIN = "decodebin2";
private const string AUDIO_SRC_PAD = "audio-src-pad";
@@ -33,7 +33,7 @@
public L16TranscoderBin (Element src,
L16Transcoder transcoder) throws Error {
- Element decodebin = TranscoderBin.create_element (DECODEBIN, DECODEBIN);
+ Element decodebin = GstUtils.create_element (DECODEBIN, DECODEBIN);
this.audio_enc = transcoder.create_encoder (AUDIO_SRC_PAD,
AUDIO_SINK_PAD);
@@ -55,8 +55,8 @@
}
if (new_pad.link (enc_pad) != PadLinkReturn.OK) {
- TranscoderBin.post_error (this,
- new LiveResponseError.LINK (
+ GstUtils.post_error (this,
+ new LiveResponseError.LINK (
"Failed to link pad %s to %s",
new_pad.name,
enc_pad.name));
Modified: trunk/src/rygel/rygel-l16-transcoder.vala
==============================================================================
--- trunk/src/rygel/rygel-l16-transcoder.vala (original)
+++ trunk/src/rygel/rygel-l16-transcoder.vala Sat Mar 28 00:45:48 2009
@@ -64,15 +64,14 @@
public Element create_encoder (string? src_pad_name,
string? sink_pad_name)
throws Error {
- dynamic Element convert1 = TranscoderBin.create_element (AUDIO_CONVERT,
- null);
- dynamic Element resample = TranscoderBin.create_element (
- AUDIO_RESAMPLE,
- AUDIO_RESAMPLE);
- dynamic Element convert2 = TranscoderBin.create_element (AUDIO_CONVERT,
- null);
- dynamic Element capsfilter = TranscoderBin.create_element (CAPS_FILTER,
- CAPS_FILTER);
+ dynamic Element convert1 = GstUtils.create_element (AUDIO_CONVERT,
+ null);
+ dynamic Element resample = GstUtils.create_element (AUDIO_RESAMPLE,
+ AUDIO_RESAMPLE);
+ dynamic Element convert2 = GstUtils.create_element (AUDIO_CONVERT,
+ null);
+ dynamic Element capsfilter = GstUtils.create_element (CAPS_FILTER,
+ CAPS_FILTER);
var bin = new Bin ("audio-encoder-bin");
bin.add_many (convert1, resample, convert2, capsfilter);
Modified: trunk/src/rygel/rygel-mp2ts-transcoder-bin.vala
==============================================================================
--- trunk/src/rygel/rygel-mp2ts-transcoder-bin.vala (original)
+++ trunk/src/rygel/rygel-mp2ts-transcoder-bin.vala Sat Mar 28 00:45:48 2009
@@ -23,7 +23,7 @@
using Rygel;
using Gst;
-internal class Rygel.MP2TSTranscoderBin : Rygel.TranscoderBin {
+internal class Rygel.MP2TSTranscoderBin : Gst.Bin {
private const string DECODEBIN = "decodebin2";
private const string MUXER = "mpegtsmux";
@@ -37,12 +37,12 @@
public MP2TSTranscoderBin (Element src,
MP2TSTranscoder transcoder)
throws Error {
- Element decodebin = TranscoderBin.create_element (DECODEBIN, DECODEBIN);
+ Element decodebin = GstUtils.create_element (DECODEBIN, DECODEBIN);
var mp3_transcoder = new MP3Transcoder (MP3Layer.TWO);
this.audio_enc = mp3_transcoder.create_encoder (null,
AUDIO_ENC_SINK);
this.video_enc = transcoder.create_encoder (null, VIDEO_ENC_SINK);
- this.muxer = TranscoderBin.create_element (MUXER, MUXER);
+ this.muxer = GstUtils.create_element (MUXER, MUXER);
this.add_many (src,
decodebin,
@@ -79,8 +79,8 @@
encoder.link (this.muxer);
if (new_pad.link (enc_pad) != PadLinkReturn.OK) {
- TranscoderBin.post_error (this,
- new LiveResponseError.LINK (
+ GstUtils.post_error (this,
+ new LiveResponseError.LINK (
"Failed to link pad %s to %s",
new_pad.name,
enc_pad.name));
Modified: trunk/src/rygel/rygel-mp2ts-transcoder.vala
==============================================================================
--- trunk/src/rygel/rygel-mp2ts-transcoder.vala (original)
+++ trunk/src/rygel/rygel-mp2ts-transcoder.vala Sat Mar 28 00:45:48 2009
@@ -66,13 +66,11 @@
public Element create_encoder (string? src_pad_name,
string? sink_pad_name)
throws Error {
- var videorate = TranscoderBin.create_element (VIDEO_RATE, VIDEO_RATE);
- var videoscale = TranscoderBin.create_element (VIDEO_SCALE,
- VIDEO_SCALE);
- var convert = TranscoderBin.create_element (COLORSPACE_CONVERT,
- COLORSPACE_CONVERT);
- var encoder = TranscoderBin.create_element (VIDEO_ENCODER,
- VIDEO_ENCODER);
+ var videorate = GstUtils.create_element (VIDEO_RATE, VIDEO_RATE);
+ var videoscale = GstUtils.create_element (VIDEO_SCALE, VIDEO_SCALE);
+ var convert = GstUtils.create_element (COLORSPACE_CONVERT,
+ COLORSPACE_CONVERT);
+ var encoder = GstUtils.create_element (VIDEO_ENCODER, VIDEO_ENCODER);
var bin = new Bin ("video-encoder-bin");
bin.add_many (videorate, videoscale, convert, encoder);
Modified: trunk/src/rygel/rygel-mp3-transcoder-bin.vala
==============================================================================
--- trunk/src/rygel/rygel-mp3-transcoder-bin.vala (original)
+++ trunk/src/rygel/rygel-mp3-transcoder-bin.vala Sat Mar 28 00:45:48 2009
@@ -28,7 +28,7 @@
THREE = 2
}
-internal class Rygel.MP3TranscoderBin : Rygel.TranscoderBin {
+internal class Rygel.MP3TranscoderBin : Gst.Bin {
private const string DECODEBIN = "decodebin2";
private const string AUDIO_SRC_PAD = "audio-src-pad";
@@ -38,7 +38,7 @@
public MP3TranscoderBin (Element src,
MP3Transcoder transcoder) throws Error {
- Element decodebin = TranscoderBin.create_element (DECODEBIN, DECODEBIN);
+ Element decodebin = GstUtils.create_element (DECODEBIN, DECODEBIN);
this.audio_enc = transcoder.create_encoder (AUDIO_SRC_PAD,
AUDIO_SINK_PAD);
@@ -60,8 +60,8 @@
}
if (new_pad.link (enc_pad) != PadLinkReturn.OK) {
- TranscoderBin.post_error (this,
- new LiveResponseError.LINK (
+ GstUtils.post_error (this,
+ new LiveResponseError.LINK (
"Failed to link pad %s to %s",
new_pad.name,
enc_pad.name));
Modified: trunk/src/rygel/rygel-mp3-transcoder.vala
==============================================================================
--- trunk/src/rygel/rygel-mp3-transcoder.vala (original)
+++ trunk/src/rygel/rygel-mp3-transcoder.vala Sat Mar 28 00:45:48 2009
@@ -44,16 +44,15 @@
public Element create_encoder (string? src_pad_name,
string? sink_pad_name)
throws Error {
- dynamic Element convert = TranscoderBin.create_element (AUDIO_CONVERT,
- AUDIO_CONVERT);
- dynamic Element resample = TranscoderBin.create_element (
- AUDIO_RESAMPLE,
- AUDIO_RESAMPLE);
- dynamic Element encoder = TranscoderBin.create_element (
+ dynamic Element convert = GstUtils.create_element (AUDIO_CONVERT,
+ AUDIO_CONVERT);
+ dynamic Element resample = GstUtils.create_element (AUDIO_RESAMPLE,
+ AUDIO_RESAMPLE);
+ dynamic Element encoder = GstUtils.create_element (
AUDIO_ENCODER[this.layer],
AUDIO_ENCODER[this.layer]);
- dynamic Element parser = TranscoderBin.create_element (AUDIO_PARSER,
- AUDIO_PARSER);
+ dynamic Element parser = GstUtils.create_element (AUDIO_PARSER,
+ AUDIO_PARSER);
if (this.layer == MP3Layer.THREE) {
// Best quality
Modified: trunk/src/rygel/rygel-transcoder.vala
==============================================================================
--- trunk/src/rygel/rygel-transcoder.vala (original)
+++ trunk/src/rygel/rygel-transcoder.vala Sat Mar 28 00:45:48 2009
@@ -79,22 +79,3 @@
}
}
-internal abstract class Rygel.TranscoderBin : Gst.Bin {
- protected static Element create_element (string factoryname,
- string? name)
- throws Error {
- Element element = ElementFactory.make (factoryname, name);
- if (element == null) {
- throw new LiveResponseError.MISSING_PLUGIN (
- "Required element factory '%s' missing",
- factoryname);
- }
-
- return element;
- }
-
- protected static void post_error (Element dest, Error error) {
- Message msg = new Message.error (dest, error, error.message);
- dest.post_message (msg);
- }
-}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]