rygel r733 - trunk/src/rygel
- From: zeeshanak svn gnome org
- To: svn-commits-list gnome org
- Subject: rygel r733 - trunk/src/rygel
- Date: Sat, 21 Mar 2009 13:58:00 +0000 (UTC)
Author: zeeshanak
Date: Sat Mar 21 13:58:00 2009
New Revision: 733
URL: http://svn.gnome.org/viewvc/rygel?rev=733&view=rev
Log:
More information hiding by Transcoder classes.
No need to expose mimetype and dlna_profile etc but provide a can_handle()
method that reports wether the mime_type in question could be handled by
this transcoder.
Modified:
trunk/src/rygel/rygel-l16-transcoder.vala
trunk/src/rygel/rygel-mp2ts-transcoder.vala
trunk/src/rygel/rygel-mp3-transcoder.vala
trunk/src/rygel/rygel-transcode-manager.vala
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 21 13:58:00 2009
@@ -26,14 +26,14 @@
using Gee;
internal class Rygel.L16Transcoder : Rygel.Transcoder {
- public const int channels = 2;
- public const int frequency = 44100;
- public const int width = 16;
- public const int depth = 16;
- public const int endianness = ByteOrder.BIG_ENDIAN; // Network byte order
+ private const int channels = 2;
+ private const int frequency = 44100;
+ private const int width = 16;
+ private const int depth = 16;
+ private const int endianness = ByteOrder.BIG_ENDIAN; // Network byte order
- public const string mime_type = "audio/L16;rate=44100;channels=2";
- public const string dlna_profile = "LPCM";
+ private const string mime_type = "audio/L16;rate=44100;channels=2";
+ private const string dlna_profile = "LPCM";
private const string DECODEBIN = "decodebin2";
private const string AUDIO_CONVERT = "audioconvert";
@@ -132,4 +132,8 @@
return bin;
}
+
+ internal static bool can_handle (string mime_type) {
+ return mime_type == L16Transcoder.mime_type;
+ }
}
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:58:00 2009
@@ -27,7 +27,7 @@
internal class Rygel.MP2TSTranscoder : Rygel.Transcoder {
public const string mime_type = "video/mpeg";
- public const string dlna_profile = "MP3";
+ private const string dlna_profile = "MP3";
private const string DECODEBIN = "decodebin2";
private const string VIDEO_ENCODER = "mpeg2enc";
@@ -131,4 +131,8 @@
return bin;
}
+
+ internal static bool can_handle (string mime_type) {
+ return mime_type == MP2TSTranscoder.mime_type;
+ }
}
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:58:00 2009
@@ -32,7 +32,7 @@
internal class Rygel.MP3Transcoder : Rygel.Transcoder {
public const string mime_type = "audio/mpeg";
- public const string dlna_profile = "MP3";
+ private const string dlna_profile = "MP3";
private const string DECODEBIN = "decodebin2";
private const string AUDIO_CONVERT = "audioconvert";
@@ -132,4 +132,8 @@
return bin;
}
+
+ internal static bool can_handle (string mime_type) {
+ return mime_type == MP3Transcoder.mime_type;
+ }
}
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:58:00 2009
@@ -49,11 +49,11 @@
internal Element get_transcoding_src (Element src,
string target)
throws Error {
- if (target == MP3Transcoder.mime_type) {
+ if (MP3Transcoder.can_handle (target)) {
return new MP3Transcoder (src, MP3Profile.LAYER3);
- } else if (target == L16Transcoder.mime_type) {
+ } else if (L16Transcoder.can_handle (target)) {
return new L16Transcoder (src);
- } else if (target == MP2TSTranscoder.mime_type) {
+ } else if (MP2TSTranscoder.can_handle (target)) {
return new MP2TSTranscoder (src);
} else {
throw new HTTPRequestError.NOT_FOUND (
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]