Re: [clutter] problem with threads and clutter-texture from file: Failed to create COGL texture

2009-12-08 Thread Aapo Rantalainen

 load-async is a GObject property, and can be defined using
 ClutterScript:

  {
    type : ClutterTexture,
    load-async : true,
    filename : /path/to/filename,
  }


Hi, I added  '  load-async : true, ' to my json entries. This works
only actors without behaviours, but I have behaviours defined in json,
e.g.:
{
 id  : behaviour-button-press,
 type: ClutterBehaviourRotate,
 center-x: 40,
 angle-start : 0.0,
 angle-end   : 360.0,
 axis: y-axis,
 alpha   : {
timeline : { duration : 1000, loop : false },
function : sine_wave
 }
}


{
  name : play,
  id : button-1,
  type : ClutterTexture,
  load-async : true,
  filename : buttons/play-button.png,
  x : 5,
  y : 275,
  behaviours : [ behaviour-button-idle,
   behaviour-button-motion,
   behaviour-button-press ],
  signals: [
{
name: show,
handler : stage_start_behaviour,
object  : behaviour-button-idle
},
{
name: motion-event,
handler : button_mouse_behaviour,
object  : behaviour-button-motion
},
{
name: button-press-event,
handler : button_mouse_behaviour,
object  : behaviour-button-press
}
  ]
},


It is possible to load behaviours async?

-Aapo Rantalainen
--
To unsubscribe send a mail to clutter+unsubscr...@o-hand.com



Re: [clutter] problem with threads and clutter-texture from file: Failed to create COGL texture

2009-12-02 Thread Aapo Rantalainen
2009/12/2 danny tornad...@163.com:
 Your demo program works normally for me.
Thank you very much for this information. I tested this on another
computer and it worked.

So I'm using clutter and threads in right way. (Maybe there should be
little bit more manual than test/interactive/test-threads.c?)


Perhaps it a problem related to others such as VGA driver...
But what next, how I know what is problem with my computer?

Are these information relevant:
Clutter: 1.0.6-0ubuntu1
Linux 2.6.31-14-generic #48-Ubuntu SMP Fri Oct 16 14:05:01 UTC 2009
x86_64 GNU/Linux

Computer: Lenovo T500
VGA compatible controller: Intel Corporation Mobile 4 Series Chipset
Integrated Graphics Controller (rev 07)
xserver-xorg-video-intel: 2:2.9.0-1ubuntu2


-Aapo Rantalainen
-- 
To unsubscribe send a mail to clutter+unsubscr...@o-hand.com



Re: [clutter] problem with threads and clutter-texture from file: Failed to create COGL texture

2009-12-02 Thread Aapo Rantalainen
;

default:
  break;
}

  return FALSE;
}

int main (int argc, char *argv[])
{
  ClutterActor *stage;
  ClutterActor *rect;
  ClutterColor stage_color = { 0xcc, 0xcc, 0xcc, 0xff };
  ClutterColor rect_color = { 0xee, 0x55, 0x55, 0x99 };
  ClutterColor progress_color = { 0x55, 0xee, 0x55, 0xbb };
  ClutterBehaviour *r_behaviour, *p_behaviour;
  ClutterAlpha *alpha;
  const ClutterKnot knots[] = {
{  75, 150 },
{ 400, 150 }
  };

  g_thread_init (NULL);
  clutter_threads_init ();
  clutter_init (argc, argv);

  stage = clutter_stage_get_default ();
  clutter_stage_set_color (CLUTTER_STAGE (stage), stage_color);
  clutter_actor_set_size (stage, 600, 300);

  count_label = clutter_text_new_with_text (Mono 12, Counter);
  clutter_actor_set_position (count_label, 350, 50);

  help_label = clutter_text_new_with_text (Mono 12, Press 's' to start);
  clutter_actor_set_position (help_label, 50, 50);

  rect = clutter_rectangle_new_with_color (rect_color);
  clutter_actor_set_position (rect, 75, 150);
  clutter_actor_set_size (rect, 50, 50);
  clutter_actor_set_anchor_point (rect, 25, 25);

  progress_rect = clutter_rectangle_new_with_color (progress_color);
  clutter_actor_set_position (progress_rect, 50, 225);
  clutter_actor_set_size (progress_rect, 350, 50);

  clutter_container_add (CLUTTER_CONTAINER (stage),
 count_label, help_label,
 rect, progress_rect,
 NULL);

  timeline = clutter_timeline_new (3000);
  clutter_timeline_set_loop (timeline, TRUE);

  alpha = clutter_alpha_new_full (timeline, CLUTTER_LINEAR);
  r_behaviour = clutter_behaviour_rotate_new (alpha,
  CLUTTER_Z_AXIS,
  CLUTTER_ROTATE_CW,
  0.0, 360.0);
  clutter_behaviour_apply (r_behaviour, rect);

  alpha = clutter_alpha_new_full (timeline, CLUTTER_LINEAR);
  p_behaviour = clutter_behaviour_path_new_with_knots (alpha,
   knots,
   G_N_ELEMENTS (knots));
  clutter_behaviour_apply (p_behaviour, rect);

  g_signal_connect (stage,
button-press-event, G_CALLBACK (clutter_main_quit),
NULL);
  g_signal_connect (stage,
key-press-event, G_CALLBACK (on_key_press_event),
NULL);

  clutter_actor_show (stage);

  clutter_threads_enter ();
  clutter_main ();
  clutter_threads_leave ();

  g_object_unref (p_behaviour);
  g_object_unref (r_behaviour);
  g_object_unref (timeline);

  return EXIT_SUCCESS;
}

Usage:
copy any image.png to working directory
gcc `pkg-config --libs --cflags clutter-1.0` test-threads.c
./a.out
press s
look out console: Failed to create COGL texture


-Aapo Rantalainen
-- 
To unsubscribe send a mail to clutter+unsubscr...@o-hand.com



Re: [clutter] problem with threads and clutter-texture from file: Failed to create COGL texture

2009-12-02 Thread Aapo Rantalainen
Hi, thanks, I got it working.

In test-threads.c there was this row:
clutter_threads_add_idle_full (G_PRIORITY_DEFAULT + 30,
 update_label_idle,
 update, NULL);

So I though it is safe to put my clutter_* code same place. (So is
this clutter_threads_add_idle_full also in clutter API or not?)
Now I put my code under update_label_idle, which have clutter_actor_*
calls, so this might be safe place?


I have lots of code using ClutterScript and json files. I realized
that my target platform is too slow to load actors when needed, but it
has lots of memory.  I would like to use existing code, not to rewrite
them using 'load-async'.

-Aapo Rantalainen
-- 
To unsubscribe send a mail to clutter+unsubscr...@o-hand.com



[clutter] problem with threads and clutter-texture from file: Failed to create COGL texture

2009-12-01 Thread Aapo Rantalainen
Hi, I'm working with actor preloader i.e. main-loop is running and
another thread loads actors. I'm not even plan to add these on stage,
just load them.

In this example application I add them to stage, because now it forms
complete application.
If in thread I make clutterRectangle, it works.
If in thread I try to make clutterTexture from image file, I got
Failed to create COGL texture.

Is this bug, or how I should make this working?

#include clutter/clutter.h

ClutterActor *stage;

void *start_preloader(int parameter) {
g_usleep( 1 * G_USEC_PER_SEC );
ClutterActor *actor;

if (parameter==2)
{
GError* error = NULL;
if (!(actor = clutter_texture_new_from_file(image.png, error))) {
fprintf(stderr, %s\n,  error-message);
g_error_free(error);
}
}

else
{
actor =clutter_rectangle_new();
clutter_actor_set_size (actor, 400, 80);
clutter_actor_set_position (actor, 10, 10);
clutter_rectangle_set_border_width(CLUTTER_RECTANGLE(actor),10);
}

clutter_container_add_actor(CLUTTER_CONTAINER(stage), actor);
pthread_exit(NULL);
}


int main (int argc, char *argv[]) {
ClutterActor  *actor;
clutter_init (argc, argv);

stage = clutter_stage_get_default ();

actor =clutter_rectangle_new();
clutter_actor_set_size (actor, 400, 400);
clutter_actor_set_position (actor, 40, 40);
clutter_rectangle_set_border_width(CLUTTER_RECTANGLE(actor),16);

clutter_container_add_actor(CLUTTER_CONTAINER(stage), actor);
clutter_actor_show_all(stage);

pthread_t preloader_thread;
pthread_create(preloader_thread, NULL, start_preloader, argc);

clutter_main();
return 0;
}


Usage:
copy any png image to working directory and rename it to image.png
compile: gcc `pkg-config --libs --cflags clutter-1.0` main.c
./a.out
   Main loop starts, then preloader waits one second. Move mouse over
stage, so it is refreshed and then second rectangle will be visible.

./a.out BUG
   Main loop starts, one second later preloader tries to open png file
and gives error: Failed to create COGL texture and actor is NULL.


This error message is coming from clutter-texture:1976
(clutter_texture_set_from_file), but I do not understand why.

-Aapo Rantalainen
-- 
To unsubscribe send a mail to clutter+unsubscr...@o-hand.com



Re: [clutter] Clutter 1.0 in maemo fremantle

2009-11-21 Thread Aapo Rantalainen
Hi,
clutter-1.0 is in extras-devel

There are dev lib for crosscompiling and library for n900. I have used
it one month on N900, it works. There are one issue: some png files
are rendered incorrectly even they works with clutter 1.0 under PC.

Project page: https://garage.maemo.org/projects/clutter

-Aapo Rantalainen


2009/11/21 Wang Baisheng baisheng.wang...@gmail.com:

 Hi Alberto,

 Clutter 1.0 for maemo fremantle is available ?

 Thanks,
 Baisheng

-- 
To unsubscribe send a mail to clutter+unsubscr...@o-hand.com



Re: [clutter] clutter_behaviour breaks gnonlinear gstreamer plugin, can anybody confirm this?

2009-11-17 Thread Aapo Rantalainen
Hi, I tested my testing applications with clutter-0.8 and it worked.
So I think there are bug in clutter-1.0 and I filed bug:
http://bugzilla.o-hand.com/show_bug.cgi?id=1886

Because of this bug clutter and gnonlin can't be really used in same
application.

-Aapo Rantalainen
-- 
To unsubscribe send a mail to clutter+unsubscr...@o-hand.com



[clutter] how to compile clutter from git under ubuntu 9.10?

2009-11-17 Thread Aapo Rantalainen
Hi, I tried compiled clutter from git, but there might be some
autotool version mismatch.

This is what I have done:
git clone git://git.clutter-project.org/clutter
cd clutter
./autogen.sh

And this is result:
Symlinking file mkinstalldirs
Symlinking file po/Makefile.in.in

Please add the files
  codeset.m4 gettext.m4 glibc21.m4 iconv.m4 isc-posix.m4 lcmessage.m4
  progtest.m4
from the /aclocal directory to your autoconf macro directory
or directly to your aclocal.m4 file.
You will also need config.guess and config.sub, which you can get from
ftp://ftp.gnu.org/pub/gnu/config/.

autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal  -I build/autotools
autoreconf: configure.ac: tracing
autoreconf: running: libtoolize --install --copy
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `build/autotools'.
libtoolize: copying file `build/autotools/libtool.m4'
libtoolize: copying file `build/autotools/ltoptions.m4'
libtoolize: copying file `build/autotools/ltsugar.m4'
libtoolize: copying file `build/autotools/ltversion.m4'
libtoolize: copying file `build/autotools/lt~obsolete.m4'
autoreconf: running: /usr/bin/autoconf
autoreconf: running: /usr/bin/autoheader
autoreconf: running: automake --add-missing --copy --no-force
configure.ac:91: required file `../ltmain.sh' not found
clutter/Makefile.am:308: `%'-style pattern rules are a GNU make extension
clutter/cogl/cogl/driver/gles/Makefile.am:56: `%'-style pattern rules
are a GNU make extension
clutter/cogl/cogl/driver/gles/Makefile.am:58: `%'-style pattern rules
are a GNU make extension
Makefile.am: installing `./INSTALL'
autoreconf: automake failed with exit status: 1


I think ubuntu 9.10 has very recent versions of autotools, so are they
too new? Is there any solution how I can get clutter compiled?

-Aapo Rantalainen
-- 
To unsubscribe send a mail to clutter+unsubscr...@o-hand.com



[clutter] clutter_behaviour breaks gnonlinear gstreamer plugin, can anybody confirm this?

2009-11-13 Thread Aapo Rantalainen
Hi, I have problem with clutter1.0.6 behaviours and
gstreamer-gnonlinear-plugin. I think I'm using gnonlinear proper way,
because it works. If I add clutter and clutter_actor it still works.
When I add clutter_behavour, application doesn't work anymore.

Application:
I'm playing two different length wav-clip starting on same time.

Expected:
Shorter ends and another continues playing.

What happens:
When shorter ends, there are silence moment (cap). Sometimes it is
short, sometimes long, and sometimes there are many caps.


If I'm using alsasink, there are no message, with pulsesink I got this:
pulse pulsesink.c:523:gst_pulsering_stream_underflow_cb:sink-actual-sink-pulse
Got underflow
(This message comes even when it works.)

And as I said application works if I disable all clutter_behaviours.
This is the reason I'm posting this to clutter list, not gstreamer
list. Any advice is welcome. (Do this happens to you? Is this
gstreamer's fault? Is this gnonlinear's fault?)

I made simples version which triggers this bug and it is easy to
reproduce, you can download it from here (1.5M):
http://cc.oulu.fi/~rantalai/clutter_gnonlin_bug.tar.gz

You need gstreamer0.10-gnonlin to run it.

make
./works.sh
/trigger_bug.sh


-Aapo Rantalainen


And the application:

#include gst/gst.h
#include glib.h
#include stdbool.h
#include clutter/clutter.h


// Variables
GstElement *conv1, *conv2;
GstPad *audiopad;
GstBus *bus;
GMainLoop *loop;
GstFormat fmt;
gint64 pos, len;
GstElement *pipeline;

static gboolean my_bus_callback (GstBus *bus, GstMessage *msg, gpointerdata)
{
  switch (GST_MESSAGE_TYPE (msg)) {

case GST_MESSAGE_EOS:
  g_print (\nEnd of stream\n);
  break;

case GST_MESSAGE_ERROR: {
  gchar  *debug;
  GError *error;

  gst_message_parse_error (msg, error, debug);
  g_free (debug);

  g_printerr (Error: %s\n, error-message);
  g_error_free (error);
  break;
}
default:
  break;
  }

  return TRUE;
}




static void gnl_OnNewPad(GstElement *elem, GstPad *pad, gpointer data)
{
  GstPad *convsink;

  convsink = gst_element_get_compatible_pad(conv1, pad, gst_pad_get_caps(pad));
  if(convsink)
printf(Compatible pad found...\n);
  else
printf(Compatible pad not found!\n);
  gst_pad_link(pad, convsink);
  if(GST_PAD_LINK_SUCCESSFUL(GST_PAD_LINK_OK))
printf(Linking successfully completed\n);

  printf(Element name: %s\n, gst_element_get_name(elem));

  gst_object_unref(convsink);
}

static void gnl_OnNewPad2(GstElement *elem, GstPad *pad, gpointer data)
{
  GstPad *convsink;

  convsink = gst_element_get_compatible_pad(conv2, pad, gst_pad_get_caps(pad));
  if(convsink)
printf(Compatible pad found...\n);
  else
printf(Compatible pad not found!\n);
  gst_pad_link(pad, convsink);
  if(GST_PAD_LINK_SUCCESSFUL(GST_PAD_LINK_OK))
printf(Linking successfully completed\n);

  printf(Element name: %s\n, gst_element_get_name(elem));

  gst_object_unref(convsink);
}



gint player_init (gchar *location1, gchar *location2)
{
  GstElement *dec,  *track1, *track2, *adder, *audio1, *audio1_2,
*audio2, *sink;

  gst_init (NULL, NULL);

  /* setup */
  pipeline = gst_pipeline_new (pipeline);

  bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
  gst_bus_add_watch (bus, my_bus_callback, NULL);
  gst_object_unref (bus);

  /* track 1 */
  track1 = gst_element_factory_make(gnlcomposition, track1);
  gst_bin_add(GST_BIN (pipeline), track1);
  g_signal_connect (track1, pad-added, G_CALLBACK (gnl_OnNewPad), NULL);

  /* add audio file to composition / track 1 */
  audio1_2 = gst_element_factory_make(gnlfilesource, audio1_2);
  gst_bin_add(GST_BIN (track1), audio1_2);
  g_object_set(G_OBJECT (audio1_2), location, location1, NULL);
  g_object_set(G_OBJECT (audio1_2), start, 2 * GST_SECOND, NULL);
  g_object_set(G_OBJECT (audio1_2), duration, 5 * GST_SECOND, NULL);
  g_object_set(G_OBJECT (audio1_2), media-start, 0 * GST_SECOND, NULL);
  g_object_set(G_OBJECT (audio1_2), media-duration, 30 * GST_SECOND, NULL);
  g_object_set(G_OBJECT (audio1_2), priority, 0, NULL);


  /* track 2 */
  track2 = gst_element_factory_make(gnlcomposition, track2);
  gst_bin_add(GST_BIN (pipeline), track2);
  g_signal_connect (track2, pad-added, G_CALLBACK (gnl_OnNewPad2), NULL);

  /* add audio file to composition / track 2 */
  audio2 = gst_element_factory_make(gnlfilesource, audio2);
  gst_bin_add(GST_BIN (track2), audio2);
  g_object_set(G_OBJECT (audio2), location, location2, NULL);
  g_object_set(G_OBJECT (audio2), start, 2 * GST_SECOND, NULL);
  g_object_set(G_OBJECT (audio2), duration, 6 * GST_SECOND, NULL);
  g_object_set(G_OBJECT (audio2), media-start, 0 * GST_SECOND, NULL);
  g_object_set(G_OBJECT (audio2), media-duration, 50 * GST_SECOND, NULL);
  g_object_set(G_OBJECT (audio2), priority, 0, NULL);


  conv1 = gst_element_factory_make(audioconvert, conv1);
  conv2 = gst_element_factory_make(audioconvert, conv2);

  adder = gst_element_factory_make(adder, adder);
  if(!adder

Re: [clutter] clutter_behaviour breaks gnonlinear gstreamer plugin, can anybody confirm this?

2009-11-13 Thread Aapo Rantalainen
Hi, thanks for you quick reply, but it didn't fix the problem. I also
added g_thread_init(). (There was gst_init before).

So now it starts:
  g_thread_init(NULL);
  clutter_init (argc, argv);
  clutter_threads_init();

  GMainLoop *loop= g_main_loop_new (NULL, FALSE);
  ClutterActor *stage;
...

I changed the longer testing wav, so it doesn't have any silence part.

Updated  package in: http://cc.oulu.fi/~rantalai/clutter_gnonlin_bug.tar.gz

-Aapo Rantalainen

2009/11/13 Bastian Winkler b...@netbuz.org:
 Hi,

 calling clutter_threads_init() right before clutter_init() should fix
 it.

 :wq buz

 On Fri, Nov 13, 2009 at 10:05:20AM +0200, Aapo Rantalainen wrote:
 Hi, I have problem with clutter1.0.6 behaviours and
 gstreamer-gnonlinear-plugin. I think I'm using gnonlinear proper way,
 because it works. If I add clutter and clutter_actor it still works.
 When I add clutter_behavour, application doesn't work anymore.

 Application:
 I'm playing two different length wav-clip starting on same time.

 Expected:
 Shorter ends and another continues playing.

 What happens:
 When shorter ends, there are silence moment (cap). Sometimes it is
 short, sometimes long, and sometimes there are many caps.

 I made simples version which triggers this bug and it is easy to
 reproduce, you can download it from here (1.5M):
 http://cc.oulu.fi/~rantalai/clutter_gnonlin_bug.tar.gz

 You need gstreamer0.10-gnonlin to run it.

 make
 ./works.sh
 /trigger_bug.sh

-- 
To unsubscribe send a mail to clutter+unsubscr...@o-hand.com