gstreamer GST_COLOR_BALANCE(pipeline) error

hi every one, I use Tk1 run a gstreamer sample from
http://docs.gstreamer.com/display/GstSDK/Playback+tutorial+5%3A+Color+Balance

the main loop:

int main(int argc, char *argv[]) {
  CustomData data;
  GstStateChangeReturn ret;
  GIOChannel *io_stdin;
[...]

  /* Start playing */
  ret = gst_element_set_state (data.pipeline, GST_STATE_PLAYING);
  if (ret == GST_STATE_CHANGE_FAILURE) {
    g_printerr ("Unable to set the pipeline to the playing state.\n");
    gst_object_unref (data.pipeline);
    return -1;}

  print_current_values (data.pipeline);
    
  /* Create a GLib Main Loop and set it to run */
  data.loop = g_main_loop_new (NULL, FALSE);
  g_main_loop_run (data.loop);
[...]

program into print_current_values(data.pipline);

static void print_current_values (GstElement *pipeline) {
  const GList *channels, *l;
   
  /* Output Color Balance values */
  channels = gst_color_balance_list_channels (GST_COLOR_BALANCE (pipeline));
  for (l = channels; l != NULL; l = l->next) {
    GstColorBalanceChannel *channel = (GstColorBalanceChannel *)l->data;
    gint value = gst_color_balance_get_value (GST_COLOR_BALANCE (pipeline), channel);
    g_print ("%s: %3d%% ", channel->label,
        100 * (value - channel->min_value) / (channel->max_value - channel->min_value));
  }
  g_print ("\n");
}

when program run to here:

channels = gst_color_balance_list_channels (GST_COLOR_BALANCE (pipeline));

the error message like this :
GStreamer-CRITICAL **: gst_implements_interface_cast: assertion `gst_element_implements_interface (GST_ELEMENT (from), iface_type)’ failed

The video can display normal but can’t adjust Brightness, Contrast, Hue and Saturation follow sample.

does anyone know this issue?

I tested above source code on gstreamer-0.10 and 1.0.
I get the GstColorBalance by gst_bin_get_by_interface function, like

GstElement *color = gst_bin_get_by_interface (GST_BIN (src), GST_TYPE_COLOR_BALANCE);
return GST_COLOR_BALANCE (color);

it will fix above issue, and I can adjust contrast, brightness, hue and saturation for v4l2src.

But if I use “playbin uri=http://docs.gstreamer.com/media/sintel_trailer-480p.webm”,
for gstreamer-0.10: there is video output, but gst_bin_get_by_interface will return NULL;
for gstreamer-1.0: I can adjust contrast, brightness, hue and saturation, but there isn’t video output, so I can’t check the color balance performance.
Only playbin parameter will occur.

Does anyone know what different of playbin between gstreamer-0.10 and 1.0?
Thanks.

Hi yumeng,
Likely the color balance only being supported by playbin2 with gstreamer 1.0…

gst-inspect-1.0 playbin
Factory Details:
Rank none (0)
Long-name Player Bin 2


flags : Flags to control behaviour
flags: readable, writable
Flags “GstPlayFlags” Default: 0x00000617, “soft-colorbalance+deinterlace+soft-volume+text+audio+video”
(0x00000001): video - Render the video stream
(0x00000002): audio - Render the audio stream
(0x00000004): text - Render subtitles
(0x00000008): vis - Render visualisation when no video is present
(0x00000010): soft-volume - Use software volume
(0x00000020): native-audio - Only use native audio formats
(0x00000040): native-video - Only use native video formats
(0x00000080): download - Attempt progressive download buffering
(0x00000100): buffering - Buffer demuxed/parsed data
(0x00000200): deinterlace - Deinterlace video if necessary
(0x00000400): soft-colorbalance - Use software color balance

Hi steve
My mistake, I didn’t notice this information.
Thanks for your highlights.