rygel r698 - trunk/src/rygel
- From: zeeshanak svn gnome org
- To: svn-commits-list gnome org
- Subject: rygel r698 - trunk/src/rygel
- Date: Sat, 21 Mar 2009 13:55:06 +0000 (UTC)
Author: zeeshanak
Date: Sat Mar 21 13:55:05 2009
New Revision: 698
URL: http://svn.gnome.org/viewvc/rygel?rev=698&view=rev
Log:
Convert MP2Transcoder into a more generic mpeg audio transcoder.
Convert MP2Transcoder into mpeg audio (layer 2 and 3) transcoder.
Added:
trunk/src/rygel/rygel-mp3-transcoder.vala
- copied, changed from r697, /trunk/src/rygel/rygel-mp2-transcoder.vala
Removed:
trunk/src/rygel/rygel-mp2-transcoder.vala
Modified:
trunk/src/rygel/Makefile.am
trunk/src/rygel/rygel-transcode-manager.vala
Modified: trunk/src/rygel/Makefile.am
==============================================================================
--- trunk/src/rygel/Makefile.am (original)
+++ trunk/src/rygel/Makefile.am Sat Mar 21 13:55:05 2009
@@ -126,8 +126,8 @@
rygel-media-item.h \
rygel-mp2ts-transcoder.h \
rygel-mp2ts-transcoder.c \
- rygel-mp2-transcoder.h \
- rygel-mp2-transcoder.c
+ rygel-mp3-transcoder.h \
+ rygel-mp3-transcoder.c
rygel.stamp: $(filter %.vala,$(rygel_SOURCES))
$(VALAC) -C --vapidir=$(srcdir) \
@@ -166,7 +166,7 @@
rygel-browse.vala \
rygel-didl-lite-writer.vala \
rygel-mp2ts-transcoder.vala \
- rygel-mp2-transcoder.vala
+ rygel-mp3-transcoder.vala
rygel-1.0.vapi: $(VAPI_SOURCE_FILES)
$(VALAC) -C --library=rygel-1.0 \
Copied: trunk/src/rygel/rygel-mp3-transcoder.vala (from r697, /trunk/src/rygel/rygel-mp2-transcoder.vala)
==============================================================================
--- /trunk/src/rygel/rygel-mp2-transcoder.vala (original)
+++ trunk/src/rygel/rygel-mp3-transcoder.vala Sat Mar 21 13:55:05 2009
@@ -23,17 +23,21 @@
using Rygel;
using Gst;
-internal class Rygel.MP2Transcoder : Gst.Bin {
+internal class Rygel.MP3Transcoder : Gst.Bin {
private const string DECODEBIN = "decodebin2";
private const string AUDIO_CONVERT = "audioconvert";
- private const string AUDIO_ENCODER = "twolame";
+ private const string LAYER2_ENCODER = "twolame";
+ private const string LAYER3_ENCODER = "lame";
private const string AUDIO_PARSER = "mp3parse";
private const string AUDIO_SRC_PAD = "audio-src-pad";
private dynamic Element audio_enc;
+ private uint layer;
+
+ public MP3Transcoder (Element src, uint layer) throws Error {
+ this.layer = layer;
- public MP2Transcoder (Element src) throws Error {
Element decodebin = ElementFactory.make (DECODEBIN, DECODEBIN);
if (decodebin == null) {
throw new LiveResponseError.MISSING_PLUGIN (
@@ -78,11 +82,19 @@
AUDIO_CONVERT);
}
- var encoder = ElementFactory.make (AUDIO_ENCODER, AUDIO_ENCODER);
+ 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);
if (encoder == null) {
throw new LiveResponseError.MISSING_PLUGIN (
"Required element '%s' missing",
- AUDIO_ENCODER);
+ encoder_name);
}
Element parser = ElementFactory.make (AUDIO_PARSER,
@@ -93,6 +105,13 @@
AUDIO_PARSER);
}
+ if (this.layer == 3) {
+ // Best quality
+ encoder.quality = 0;
+ }
+
+ encoder.bitrate = 256;
+
var bin = new Bin ("audio-encoder-bin");
bin.add_many (convert, encoder, parser);
Modified: trunk/src/rygel/rygel-transcode-manager.vala
==============================================================================
--- trunk/src/rygel/rygel-transcode-manager.vala (original)
+++ trunk/src/rygel/rygel-transcode-manager.vala Sat Mar 21 13:55:05 2009
@@ -67,7 +67,7 @@
string target)
throws Error {
if (target == "audio/mpeg") {
- return new MP2Transcoder (src);
+ return new MP3Transcoder (src, 3);
} else if (target == "video/mpeg") {
return new MP2TSTranscoder (src);
} else {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]