rygel r731 - trunk/src/rygel
- From: zeeshanak svn gnome org
- To: svn-commits-list gnome org
- Subject: rygel r731 - trunk/src/rygel
- Date: Sat, 21 Mar 2009 13:57:50 +0000 (UTC)
Author: zeeshanak
Date: Sat Mar 21 13:57:50 2009
New Revision: 731
URL: http://svn.gnome.org/viewvc/rygel?rev=731&view=rev
Log:
Transcoder classes themselves add their resource.
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
trunk/src/rygel/rygel-transcoder.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:57:50 2009
@@ -22,6 +22,8 @@
*/
using Rygel;
using Gst;
+using GUPnP;
+using Gee;
internal class Rygel.L16Transcoder : Rygel.Transcoder {
public const int channels = 2;
@@ -59,6 +61,26 @@
decodebin.pad_added += this.decodebin_pad_added;
}
+ public static void add_resource (ArrayList<DIDLLiteResource?> resources,
+ MediaItem item,
+ TranscodeManager manager)
+ throws Error {
+ if (Transcoder.mime_type_is_a (item.mime_type,
+ L16Transcoder.mime_type)) {
+ return;
+ }
+
+ var res = manager.create_resource (item,
+ L16Transcoder.mime_type,
+ L16Transcoder.dlna_profile);
+
+ res.sample_freq = L16Transcoder.frequency;
+ res.n_audio_channels = L16Transcoder.channels;
+ res.bits_per_sample = L16Transcoder.width;
+
+ resources.add (res);
+ }
+
private void decodebin_pad_added (Element decodebin, Pad new_pad) {
Pad enc_pad = this.audio_enc.get_pad (AUDIO_SINK_PAD);
if (!new_pad.can_link (enc_pad)) {
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:57:50 2009
@@ -22,6 +22,8 @@
*/
using Rygel;
using Gst;
+using GUPnP;
+using Gee;
internal class Rygel.MP2TSTranscoder : Rygel.Transcoder {
public const string mime_type = "video/mpeg";
@@ -63,6 +65,20 @@
decodebin.pad_added += this.decodebin_pad_added;
}
+ public static void add_resource (ArrayList<DIDLLiteResource?> resources,
+ MediaItem item,
+ TranscodeManager manager)
+ throws Error {
+ if (Transcoder.mime_type_is_a (item.mime_type,
+ MP2TSTranscoder.mime_type)) {
+ return;
+ }
+
+ resources.add (manager.create_resource (item,
+ MP2TSTranscoder.mime_type,
+ MP2TSTranscoder.dlna_profile));
+ }
+
private void decodebin_pad_added (Element decodebin, Pad new_pad) {
Element encoder;
Pad enc_pad;
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:57:50 2009
@@ -22,6 +22,8 @@
*/
using Rygel;
using Gst;
+using GUPnP;
+using Gee;
internal enum Rygel.MP3Profile {
LAYER2 = 1,
@@ -63,6 +65,20 @@
decodebin.pad_added += this.decodebin_pad_added;
}
+ public static void add_resource (ArrayList<DIDLLiteResource?> resources,
+ MediaItem item,
+ TranscodeManager manager)
+ throws Error {
+ if (Transcoder.mime_type_is_a (item.mime_type,
+ MP3Transcoder.mime_type)) {
+ return;
+ }
+
+ resources.add (manager.create_resource (item,
+ MP3Transcoder.mime_type,
+ MP3Transcoder.dlna_profile));
+ }
+
private void decodebin_pad_added (Element decodebin, Pad new_pad) {
Pad enc_pad = this.audio_enc.get_pad (AUDIO_SINK_PAD);
if (!new_pad.can_link (enc_pad)) {
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:57:50 2009
@@ -39,10 +39,10 @@
// No transcoding for images yet :(
return;
} else if (item.upnp_class.has_prefix (MediaItem.MUSIC_CLASS)) {
- add_l16_resource (resources, item);
- add_mp3_resource (resources, item);
+ L16Transcoder.add_resource (resources, item, this);
+ MP3Transcoder.add_resource (resources, item, this);
} else {
- add_mp2ts_resource (resources, item);
+ MP2TSTranscoder.add_resource (resources, item, this);
}
}
@@ -62,55 +62,10 @@
}
}
- private void add_mp3_resource (ArrayList<DIDLLiteResource?> resources,
- MediaItem item)
- throws Error {
- if (TranscodeManager.mime_type_is_a (item.mime_type,
- MP3Transcoder.mime_type)) {
- return;
- }
-
- resources.add (this.create_resource (item,
- MP3Transcoder.mime_type,
- MP3Transcoder.dlna_profile));
- }
-
- private void add_l16_resource (ArrayList<DIDLLiteResource?> resources,
- MediaItem item)
- throws Error {
- if (TranscodeManager.mime_type_is_a (item.mime_type,
- L16Transcoder.mime_type)) {
- return;
- }
-
- var res = this.create_resource (item,
- L16Transcoder.mime_type,
- L16Transcoder.dlna_profile);
-
- res.sample_freq = L16Transcoder.frequency;
- res.n_audio_channels = L16Transcoder.channels;
- res.bits_per_sample = L16Transcoder.width;
-
- resources.add (res);
- }
-
- private void add_mp2ts_resource (ArrayList<DIDLLiteResource?> resources,
- MediaItem item)
- throws Error {
- if (TranscodeManager.mime_type_is_a (item.mime_type,
- MP2TSTranscoder.mime_type)) {
- return;
- }
-
- resources.add (this.create_resource (item,
- MP2TSTranscoder.mime_type,
- MP2TSTranscoder.dlna_profile));
- }
-
- private DIDLLiteResource create_resource (MediaItem item,
- string mime_type,
- string dlna_profile)
- throws Error {
+ internal DIDLLiteResource create_resource (MediaItem item,
+ string mime_type,
+ string dlna_profile)
+ throws Error {
string protocol;
var uri = this.create_uri_for_item (item, mime_type, out protocol);
DIDLLiteResource res = item.create_res (uri);
@@ -124,12 +79,5 @@
return res;
}
-
- private static bool mime_type_is_a (string mime_type1, string mime_type2) {
- string content_type1 = g_content_type_from_mime_type (mime_type1);
- string content_type2 = g_content_type_from_mime_type (mime_type2);
-
- return g_content_type_is_a (content_type1, content_type2);
- }
}
Modified: trunk/src/rygel/rygel-transcoder.vala
==============================================================================
--- trunk/src/rygel/rygel-transcoder.vala (original)
+++ trunk/src/rygel/rygel-transcoder.vala Sat Mar 21 13:57:50 2009
@@ -22,8 +22,17 @@
*/
using Rygel;
using Gst;
+using GUPnP;
internal abstract class Rygel.Transcoder : Gst.Bin {
+ protected static bool mime_type_is_a (string mime_type1,
+ string mime_type2) {
+ string content_type1 = g_content_type_from_mime_type (mime_type1);
+ string content_type2 = g_content_type_from_mime_type (mime_type2);
+
+ return g_content_type_is_a (content_type1, content_type2);
+ }
+
protected static Element create_element (string factoryname,
string? name)
throws Error {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]