mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
Remove deinterlacing stuff. This is a Color Balance tutorial from now on.
This commit is contained in:
parent
87b9d58e95
commit
989e16d366
1 changed files with 5 additions and 42 deletions
|
@ -7,11 +7,6 @@ typedef struct _CustomData {
|
|||
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;
|
||||
|
@ -38,42 +33,17 @@ static void update_color_channel (const gchar *channel_name, gboolean increase,
|
|||
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 */
|
||||
|
@ -84,10 +54,7 @@ static void print_current_values (GstElement *pipeline) {
|
|||
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 */
|
||||
|
@ -111,9 +78,6 @@ static gboolean handle_keyboard (GIOChannel *source, GIOCondition cond, CustomDa
|
|||
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;
|
||||
|
@ -146,11 +110,10 @@ int main(int argc, char *argv[]) {
|
|||
" '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
|
||||
|
|
Loading…
Reference in a new issue