GMainLoop *loop;
} CustomData;
-/* playbin2 flags */
-typedef enum {
- GST_PLAY_FLAG_DEINTERLACE = (1 << 9)
-} GstPlayFlags;
-
/* Process a color balance command */
static void update_color_channel (const gchar *channel_name, gboolean increase, GstColorBalance *cb) {
gdouble step;
if (increase) {
value = (gint)(value + step);
if (value > channel->max_value)
- value = channel->max_value;
+ value = channel->max_value;
} else {
value = (gint)(value - step);
if (value < channel->min_value)
- value = channel->min_value;
+ value = channel->min_value;
}
gst_color_balance_set_value (cb, channel, value);
}
-/* Toggle the deinterlacing flag */
-static void toggle_deinterlace (GstElement *pipeline) {
- gint flags;
- gint64 current_position = GST_CLOCK_TIME_NONE;
- GstFormat format = GST_FORMAT_TIME;
-
- /* Find current position, since it will be lost when we stop */
- gst_element_query_position (pipeline, &format, ¤t_position);
- /* Stop */
- gst_element_set_state (pipeline, GST_STATE_READY);
- /* Toggle deinterlacing flag (it will be ignored while PLAYING) */
- g_object_get (pipeline, "flags", &flags, NULL);
- flags ^= GST_PLAY_FLAG_DEINTERLACE;
- g_object_set (pipeline, "flags", flags, NULL);
- /* Resume */
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
- /* Wait until the state change takes effect */
- gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE);
- /* Set current position, if we were able to recover it previously */
- if (GST_CLOCK_TIME_IS_VALID (current_position)) {
- gst_element_seek_simple (pipeline, format, GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE, current_position);
- }
-}
-
-/* Output the current values of all Color Balance channels and the Deinterlace flag */
+/* Output the current values of all Color Balance channels */
static void print_current_values (GstElement *pipeline) {
- gint flags;
const GList *channels, *l;
/* Output Color Balance values */
g_print ("%s: %3d%% ", channel->label,
100 * (value - channel->min_value) / (channel->max_value - channel->min_value));
}
-
- /* Output Deinterlace flag value */
- g_object_get (pipeline, "flags", &flags, NULL);
- g_print ("Deinterlacing: %s\n", flags & GST_PLAY_FLAG_DEINTERLACE ? "ON" : "OFF");
+ g_print ("\n");
}
/* Process keyboard input */
case 's':
update_color_channel ("SATURATION", g_ascii_isupper (str[0]), GST_COLOR_BALANCE (data->pipeline));
break;
- case 'd':
- toggle_deinterlace (data->pipeline);
- break;
case 'q':
g_main_loop_quit (data->loop);
break;
" 'B' to increase brightness, 'b' to decrease brightness\n"
" 'H' to increase hue, 'h' to decrease hue\n"
" 'S' to increase saturation, 's' to decrease saturation\n"
- " 'D' to toggle deinterlacing ON and OFF\n"
" 'Q' to quit\n");
/* Build the pipeline */
- data.pipeline = gst_parse_launch ("playbin2 uri=http://docs.gstreamer.com/media/sintel_trailer-480i.avi", NULL);
+ data.pipeline = gst_parse_launch ("playbin2 uri=http://docs.gstreamer.com/media/sintel_trailer-480p.webm", NULL);
/* Add a keyboard watch so we get notified of keystrokes */
#ifdef _WIN32