[rygel] core,plugins: Port to vala 0.11.1
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] core,plugins: Port to vala 0.11.1
- Date: Mon, 1 Nov 2010 12:54:18 +0000 (UTC)
commit c398c260e798095496f735ebf32c6549baef928b
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Sun Oct 31 01:36:14 2010 +0300
core,plugins: Port to vala 0.11.1
.../rygel-media-export-harvesting-task.vala | 2 +-
.../rygel-media-export-metadata-extractor.vala | 2 +-
src/rygel/rygel-gst-utils.vala | 6 +---
src/rygel/rygel-http-post.vala | 2 +-
src/rygel/rygel-http-response.vala | 6 +---
src/rygel/rygel-media-item.vala | 6 +---
src/rygel/rygel-plugin-loader.vala | 2 +-
src/rygel/rygel-search-criteria-parser.vala | 2 +-
src/rygel/rygel-seekable-response.vala | 24 ++++++-------------
src/rygel/rygel-transcoder.vala | 6 ++--
10 files changed, 22 insertions(+), 36 deletions(-)
---
diff --git a/src/plugins/media-export/rygel-media-export-harvesting-task.vala b/src/plugins/media-export/rygel-media-export-harvesting-task.vala
index 93080e1..83048e8 100644
--- a/src/plugins/media-export/rygel-media-export-harvesting-task.vala
+++ b/src/plugins/media-export/rygel-media-export-harvesting-task.vala
@@ -332,7 +332,7 @@ public class Rygel.MediaExport.HarvestingTask : Rygel.StateMachine, GLib.Object
FileQueryInfoFlags.NONE,
this.cancellable);
string content_type = info.get_content_type ();
- string mime = g_content_type_get_mime_type (content_type);
+ string mime = ContentType.get_mime_type (content_type);
uint64 size = info.get_size ();
uint64 mtime = info.get_attribute_uint64 (
FILE_ATTRIBUTE_TIME_MODIFIED);
diff --git a/src/plugins/media-export/rygel-media-export-metadata-extractor.vala b/src/plugins/media-export/rygel-media-export-metadata-extractor.vala
index a5ea643..e1fe7b5 100644
--- a/src/plugins/media-export/rygel-media-export-metadata-extractor.vala
+++ b/src/plugins/media-export/rygel-media-export-metadata-extractor.vala
@@ -165,7 +165,7 @@ public class Rygel.MediaExport.MetadataExtractor: GLib.Object {
}
string content_type = file_info.get_content_type ();
- mime = g_content_type_get_mime_type (content_type);
+ mime = ContentType.get_mime_type (content_type);
size = file_info.get_size ();
mtime = file_info.get_attribute_uint64 (FILE_ATTRIBUTE_TIME_MODIFIED);
}
diff --git a/src/rygel/rygel-gst-utils.vala b/src/rygel/rygel-gst-utils.vala
index fa41500..31c8e62 100644
--- a/src/rygel/rygel-gst-utils.vala
+++ b/src/rygel/rygel-gst-utils.vala
@@ -120,10 +120,8 @@ internal abstract class Rygel.GstUtils {
return factory.get_klass ().contains ("Depayloader");
}
- private static int compare_factories (void *a, void *b) {
- ElementFactory factory_a = (ElementFactory) a;
- ElementFactory factory_b = (ElementFactory) b;
-
+ private static int compare_factories (ElementFactory factory_a,
+ ElementFactory factory_b) {
return (int) (factory_b.get_rank () - factory_a.get_rank ());
}
}
diff --git a/src/rygel/rygel-http-post.vala b/src/rygel/rygel-http-post.vala
index 9293a42..d326c63 100644
--- a/src/rygel/rygel-http-post.vala
+++ b/src/rygel/rygel-http-post.vala
@@ -84,7 +84,7 @@ internal class Rygel.HTTPPost : HTTPRequest {
private async void write_chunk (Buffer chunk) {
try {
- this.stream.write (chunk.data, chunk.length, this.cancellable);
+ this.stream.write (chunk.data.data, this.cancellable);
} catch (Error error) {
this.handle_error (error);
this.handle_continue ();
diff --git a/src/rygel/rygel-http-response.vala b/src/rygel/rygel-http-response.vala
index 6fbb6b9..543e6dc 100644
--- a/src/rygel/rygel-http-response.vala
+++ b/src/rygel/rygel-http-response.vala
@@ -58,10 +58,8 @@ internal abstract class Rygel.HTTPResponse : GLib.Object, Rygel.StateMachine {
this.end (true, Soup.KnownStatusCode.CANCELLED);
}
- public void push_data (void *data, size_t length) {
- this.msg.response_body.append (Soup.MemoryUse.COPY,
- data,
- length);
+ public void push_data (uint8[] data, size_t length) {
+ this.msg.response_body.append (Soup.MemoryUse.COPY, data);
this.server.unpause_message (this.msg);
}
diff --git a/src/rygel/rygel-media-item.vala b/src/rygel/rygel-media-item.vala
index 01ddb21..9075dc3 100644
--- a/src/rygel/rygel-media-item.vala
+++ b/src/rygel/rygel-media-item.vala
@@ -107,10 +107,8 @@ public abstract class Rygel.MediaItem : MediaObject {
this.uris.add (uri);
}
- internal int compare_transcoders (void *a, void *b) {
- var transcoder1 = (Transcoder) a;
- var transcoder2 = (Transcoder) b;
-
+ internal int compare_transcoders (Transcoder transcoder1,
+ Transcoder transcoder2) {
return (int) transcoder1.get_distance (this) -
(int) transcoder2.get_distance (this);
}
diff --git a/src/rygel/rygel-plugin-loader.vala b/src/rygel/rygel-plugin-loader.vala
index f1c1a4b..c5805ca 100644
--- a/src/rygel/rygel-plugin-loader.vala
+++ b/src/rygel/rygel-plugin-loader.vala
@@ -120,7 +120,7 @@ public class Rygel.PluginLoader : Object {
File file = File.new_for_path (file_path);
FileType file_type = info.get_file_type ();
string content_type = info.get_content_type ();
- string mime = g_content_type_get_mime_type (content_type);
+ string mime = ContentType.get_mime_type (content_type);
if (file_type == FileType.DIRECTORY) {
// Recurse into directories
diff --git a/src/rygel/rygel-search-criteria-parser.vala b/src/rygel/rygel-search-criteria-parser.vala
index b423f0c..99f5988 100644
--- a/src/rygel/rygel-search-criteria-parser.vala
+++ b/src/rygel/rygel-search-criteria-parser.vala
@@ -127,7 +127,7 @@ internal class Rygel.SearchCriteriaParser : Object, StateMachine {
return;
}
- this.scanner.input_text (this.str, (uint) this.str.size ());
+ this.scanner.input_text (this.str, (uint) this.str.length);
this.scanner.get_next_token ();
try {
this.expression = this.parse_or_expression ();
diff --git a/src/rygel/rygel-seekable-response.vala b/src/rygel/rygel-seekable-response.vala
index 4a68f16..8c2274f 100644
--- a/src/rygel/rygel-seekable-response.vala
+++ b/src/rygel/rygel-seekable-response.vala
@@ -31,7 +31,7 @@ internal class Rygel.SeekableResponse : Rygel.HTTPResponse {
private File file;
private FileInputStream input_stream;
- private char[] buffer;
+ private uint8[] buffer;
private size_t total_length;
int priority;
@@ -50,7 +50,7 @@ internal class Rygel.SeekableResponse : Rygel.HTTPResponse {
this.priority = this.get_requested_priority ();
this.total_length = (size_t) seek.length;
- this.buffer = new char[SeekableResponse.BUFFER_LENGTH];
+ this.buffer = new uint8[SeekableResponse.BUFFER_LENGTH];
this.file = File.new_for_uri (uri);
}
@@ -108,16 +108,10 @@ internal class Rygel.SeekableResponse : Rygel.HTTPResponse {
yield this.close_stream ();
}
- private size_t bytes_to_read () {
- return size_t.min (this.total_length, SeekableResponse.BUFFER_LENGTH);
- }
-
private async void read_contents () throws Error {
- var bytes_read = yield this.input_stream.read_async (
- this.buffer,
- this.bytes_to_read (),
- this.priority,
- this.cancellable);
+ var bytes_read = yield this.input_stream.read_async (this.buffer,
+ this.priority,
+ this.cancellable);
this.msg.wrote_chunk.connect ((msg) => {
if (this.run_continue != null) {
this.run_continue ();
@@ -138,11 +132,9 @@ internal class Rygel.SeekableResponse : Rygel.HTTPResponse {
break;
}
- bytes_read = yield this.input_stream.read_async (
- this.buffer,
- this.bytes_to_read (),
- this.priority,
- this.cancellable);
+ bytes_read = yield this.input_stream.read_async (this.buffer,
+ this.priority,
+ this.cancellable);
}
}
diff --git a/src/rygel/rygel-transcoder.vala b/src/rygel/rygel-transcoder.vala
index 94823e2..f48bf46 100644
--- a/src/rygel/rygel-transcoder.vala
+++ b/src/rygel/rygel-transcoder.vala
@@ -104,10 +104,10 @@ internal abstract class Rygel.Transcoder : GLib.Object {
public abstract uint get_distance (MediaItem item);
protected 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);
+ string content_type1 = ContentType.get_mime_type (mime_type1);
+ string content_type2 = ContentType.get_mime_type (mime_type2);
- return g_content_type_is_a (content_type1, content_type2);
+ return ContentType.is_a (content_type1, content_type2);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]