rygel r699 - trunk/src/rygel
- From: zeeshanak svn gnome org
- To: svn-commits-list gnome org
- Subject: rygel r699 - trunk/src/rygel
- Date: Sat, 21 Mar 2009 13:55:10 +0000 (UTC)
Author: zeeshanak
Date: Sat Mar 21 13:55:10 2009
New Revision: 699
URL: http://svn.gnome.org/viewvc/rygel?rev=699&view=rev
Log:
Clever use of arrays to create appropriate encoder.
Modified:
trunk/src/rygel/rygel-mp3-transcoder.vala
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:55:10 2009
@@ -26,8 +26,7 @@
internal class Rygel.MP3Transcoder : Gst.Bin {
private const string DECODEBIN = "decodebin2";
private const string AUDIO_CONVERT = "audioconvert";
- private const string LAYER2_ENCODER = "twolame";
- private const string LAYER3_ENCODER = "lame";
+ private const string[] AUDIO_ENCODER = {null, "twolame", "mp3parse"};
private const string AUDIO_PARSER = "mp3parse";
private const string AUDIO_SRC_PAD = "audio-src-pad";
@@ -82,19 +81,13 @@
AUDIO_CONVERT);
}
- string encoder_name;
- if (this.layer == 2) {
- encoder_name = LAYER2_ENCODER;
- } else {
- encoder_name = LAYER3_ENCODER;
- }
-
- dynamic Element encoder = ElementFactory.make (encoder_name,
- encoder_name);
+ dynamic Element encoder = ElementFactory.make (
+ AUDIO_ENCODER[this.layer],
+ AUDIO_ENCODER[this.layer]);
if (encoder == null) {
throw new LiveResponseError.MISSING_PLUGIN (
"Required element '%s' missing",
- encoder_name);
+ AUDIO_ENCODER[this.layer]);
}
Element parser = ElementFactory.make (AUDIO_PARSER,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]