rygel r722 - trunk/src/rygel
- From: zeeshanak svn gnome org
- To: svn-commits-list gnome org
- Subject: rygel r722 - trunk/src/rygel
- Date: Sat, 21 Mar 2009 13:57:04 +0000 (UTC)
Author: zeeshanak
Date: Sat Mar 21 13:57:04 2009
New Revision: 722
URL: http://svn.gnome.org/viewvc/rygel?rev=722&view=rev
Log:
Refactor TranscodeManager.add_resources().
Modified:
trunk/src/rygel/rygel-transcode-manager.vala
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:04 2009
@@ -35,20 +35,41 @@
internal virtual void add_resources (ArrayList<DIDLLiteResource?> resources,
MediaItem item)
throws Error {
- string mime_type;
- string dlna_profile;
-
if (item.upnp_class.has_prefix (MediaItem.IMAGE_CLASS)) {
// No transcoding for images yet :(
return;
} else if (item.upnp_class.has_prefix (MediaItem.MUSIC_CLASS)) {
- mime_type = MP3Transcoder.mime_type;
- dlna_profile = MP3Transcoder.dlna_profile;
+ this.add_resource (resources,
+ item,
+ MP3Transcoder.mime_type,
+ MP3Transcoder.dlna_profile);
} else {
- mime_type = MP2TSTranscoder.mime_type;
- dlna_profile = MP2TSTranscoder.dlna_profile;
+ this.add_resource (resources,
+ item,
+ MP2TSTranscoder.mime_type,
+ MP2TSTranscoder.dlna_profile);
+ }
+ }
+
+ internal Element get_transcoding_src (Element src,
+ string target)
+ throws Error {
+ if (target == MP3Transcoder.mime_type) {
+ return new MP3Transcoder (src, MP3Profile.LAYER3);
+ } else if (target == MP2TSTranscoder.mime_type) {
+ return new MP2TSTranscoder (src);
+ } else {
+ throw new HTTPRequestError.NOT_FOUND (
+ "No transcoder available for target format '%s'",
+ target);
}
+ }
+ private void add_resource (ArrayList<DIDLLiteResource?> resources,
+ MediaItem item,
+ string mime_type,
+ string dlna_profile)
+ throws Error {
if (TranscodeManager.mime_type_is_a (item.mime_type, mime_type)) {
return;
}
@@ -67,20 +88,6 @@
resources.add (res);
}
- internal Element get_transcoding_src (Element src,
- string target)
- throws Error {
- if (target == MP3Transcoder.mime_type) {
- return new MP3Transcoder (src, MP3Profile.LAYER3);
- } else if (target == MP2TSTranscoder.mime_type) {
- return new MP2TSTranscoder (src);
- } else {
- throw new HTTPRequestError.NOT_FOUND (
- "No transcoder available for target format '%s'",
- target);
- }
- }
-
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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]