Re: [Vala] A few newbie's questions
- From: Sandino Flores Moreno <tigrux gmail com>
- To: Giulio Paci <giuliopaci gmail com>
- Cc: vala-list gnome org
- Subject: Re: [Vala] A few newbie's questions
- Date: Thu, 3 Feb 2011 16:23:39 -0600
Regarding question 1:
==================
Check the next source code:
https://github.com/tigrux/gst-plugin-omap4videodecbin/blob/master/gst/gstomap4videodecbin.vala
There you can see a line like these:
public const Gst.PluginDesc gst_plugin_desc = {
...
}
That's what you are missing in your gstreamer plugin.
Regarding question 2:
==================
Use the method FileStream.gets which corresponds to fgets.
public unowned string FileStream.gets (char[] s);
From the man page of fgets:
gets() reads a line from stdin into the buffer pointed to by s until
either a terminating newline or EOF, which it replaces with '\0'. No
check for buffer overrun is performed (see BUGS below).
- Sandino
On Thu, Feb 3, 2011 at 3:27 PM, Giulio Paci <giuliopaci gmail com> wrote:
Hi to all!
A few days ago I discovered vala and decided to give it a try, as it
seems to have almost all the features that I wanted (C code generation,
non-object oriented code allowed, easy utf-8 string manipulation, regexp
support, glib integration, easy access to database, fine tuning support).
I already tested all these features and they are working quite fine.
Yesterday I also created a binding to libstemmer and it was very easy.
Anyway I faced a couple of issues that I was not able to solve:
1) I tried to create a gstreamer plugin following the Gstreamer Plugin
Writer's Guide
(http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/index.html).
I was able to create the plugin, but I was not able to create it using
vala alone, because I was not able to insert in the generated C output
this code:
#include <glib.h>
#include <gst/gst.h>
GST_PLUGIN_DEFINE (
GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"my_filter",
"My filter plugin",
plugin_init,
VERSION,
"LGPL",
"GStreamer",
"http://gstreamer.net/"
)
At last I decided it was not a big issue to put this code in a C file,
but is there any way to directly inject C code in vala?
2) I tried to read a file, one line at time, using the FileStream
object, but I was not able to get the desired result with the current
API, because I needed the whole line (EOL inclusive), while read_line()
removes it. The work around of adding a new line to each line does not
allow to know if the last character of the file was a new line or not.
Is there any way to (easily) read a file including the EOL character?
Thank you very much for your help and work.
Bests,
Giulio.
_______________________________________________
vala-list mailing list
vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]