rygel r714 - trunk/src/rygel



Author: zeeshanak
Date: Sat Mar 21 13:56:23 2009
New Revision: 714
URL: http://svn.gnome.org/viewvc/rygel?rev=714&view=rev

Log:
A base class for Transcoder elements.

Added:
   trunk/src/rygel/rygel-transcoder.vala
Modified:
   trunk/src/rygel/Makefile.am
   trunk/src/rygel/rygel-mp2ts-transcoder.vala
   trunk/src/rygel/rygel-mp3-transcoder.vala

Modified: trunk/src/rygel/Makefile.am
==============================================================================
--- trunk/src/rygel/Makefile.am	(original)
+++ trunk/src/rygel/Makefile.am	Sat Mar 21 13:56:23 2009
@@ -124,6 +124,8 @@
 		rygel-simple-async-result.h \
 		rygel-media-item.c \
 		rygel-media-item.h \
+		rygel-transcoder.h \
+		rygel-transcoder.c \
 		rygel-mp2ts-transcoder.h \
 		rygel-mp2ts-transcoder.c \
 		rygel-mp3-transcoder.h \
@@ -165,6 +167,7 @@
 		    rygel-media-item.vala \
 		    rygel-browse.vala \
 		    rygel-didl-lite-writer.vala \
+		    rygel-transcoder.vala \
 		    rygel-mp2ts-transcoder.vala \
 		    rygel-mp3-transcoder.vala
 

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 21 13:56:23 2009
@@ -23,7 +23,7 @@
 using Rygel;
 using Gst;
 
-internal class Rygel.MP2TSTranscoder : Gst.Bin {
+internal class Rygel.MP2TSTranscoder : Rygel.Transcoder {
    private const string DECODEBIN = "decodebin2";
    private const string VIDEO_ENCODER = "mpeg2enc";
    private const string COLORSPACE_CONVERT = "ffmpegcolorspace";
@@ -143,15 +143,4 @@
 
        return bin;
    }
-
-   private bool pads_compatible (Pad pad1, Pad pad2) {
-        Caps intersection = pad1.get_caps ().intersect (pad2.get_caps ());
-
-        return !intersection.is_empty ();
-   }
-
-   private void post_error (Error error) {
-       Message msg = new Message.error (this, error, error.message);
-       this.post_message (msg);
-   }
 }

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 21 13:56:23 2009
@@ -28,7 +28,7 @@
     LAYER3 = 2
 }
 
-internal class Rygel.MP3Transcoder : Gst.Bin {
+internal class Rygel.MP3Transcoder : Rygel.Transcoder {
    private const string DECODEBIN = "decodebin2";
    private const string AUDIO_CONVERT = "audioconvert";
    private const string[] AUDIO_ENCODER = {null, "twolame", "lame"};
@@ -132,15 +132,4 @@
 
        return bin;
    }
-
-   private bool pads_compatible (Pad pad1, Pad pad2) {
-        Caps intersection = pad1.get_caps ().intersect (pad2.get_caps ());
-
-        return !intersection.is_empty ();
-   }
-
-   private void post_error (Error error) {
-       Message msg = new Message.error (this, error, error.message);
-       this.post_message (msg);
-   }
 }

Added: trunk/src/rygel/rygel-transcoder.vala
==============================================================================
--- (empty file)
+++ trunk/src/rygel/rygel-transcoder.vala	Sat Mar 21 13:56:23 2009
@@ -0,0 +1,39 @@
+/*
+ * 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.Transcoder : Gst.Bin {
+    // FIXME: This method must be replaced by Gst.Pad.is_compatible once
+    //        it's there (i-e bug#575682 and 575685 are fixed).
+    protected bool pads_compatible (Pad pad1, Pad pad2) {
+        Caps intersection = pad1.get_caps ().intersect (pad2.get_caps ());
+
+        return !intersection.is_empty ();
+    }
+
+    protected void post_error (Error error) {
+        Message msg = new Message.error (this, error, error.message);
+        this.post_message (msg);
+    }
+}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]