examples: reuse variables in encoding example

This commit is contained in:
Luis de Bethencourt 2015-04-09 11:23:25 +01:00
parent a21795260f
commit 0915cb0e78

View file

@ -1,4 +1,7 @@
/* Example application for using GstProfile and encodebin /* GStreamer
*
* encoding.c: example application for using GstProfile and encodebin
*
* Copyright (C) 2009 Edward Hervey <edward.hervey@collabora.co.uk> * Copyright (C) 2009 Edward Hervey <edward.hervey@collabora.co.uk>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
@ -34,9 +37,10 @@ static gboolean silent = FALSE;
static void static void
list_codecs (void) list_codecs (void)
{ {
GstCaps *l; GstCaps *l, *caps;
GstCaps *caps; GstStructure *st;
guint i, len; guint i, len;
gchar *tmpstr, *desc;
caps = gst_caps_new_empty (); caps = gst_caps_new_empty ();
@ -44,9 +48,7 @@ list_codecs (void)
l = gst_caps_list_container_formats (GST_RANK_NONE); l = gst_caps_list_container_formats (GST_RANK_NONE);
len = gst_caps_get_size (l); len = gst_caps_get_size (l);
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
GstStructure *st = gst_caps_steal_structure (l, 0); st = gst_caps_steal_structure (l, 0);
gchar *tmpstr, *desc;
gst_caps_append_structure (caps, st); gst_caps_append_structure (caps, st);
tmpstr = gst_caps_to_string (caps); tmpstr = gst_caps_to_string (caps);
@ -64,9 +66,7 @@ list_codecs (void)
l = gst_caps_list_video_encoding_formats (GST_RANK_NONE); l = gst_caps_list_video_encoding_formats (GST_RANK_NONE);
len = gst_caps_get_size (l); len = gst_caps_get_size (l);
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
GstStructure *st = gst_caps_steal_structure (l, 0); st = gst_caps_steal_structure (l, 0);
gchar *tmpstr, *desc;
gst_caps_append_structure (caps, st); gst_caps_append_structure (caps, st);
tmpstr = gst_caps_to_string (caps); tmpstr = gst_caps_to_string (caps);
@ -84,9 +84,7 @@ list_codecs (void)
l = gst_caps_list_audio_encoding_formats (GST_RANK_NONE); l = gst_caps_list_audio_encoding_formats (GST_RANK_NONE);
len = gst_caps_get_size (l); len = gst_caps_get_size (l);
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
GstStructure *st = gst_caps_steal_structure (l, 0); st = gst_caps_steal_structure (l, 0);
gchar *tmpstr, *desc;
gst_caps_append_structure (caps, st); gst_caps_append_structure (caps, st);
tmpstr = gst_caps_to_string (caps); tmpstr = gst_caps_to_string (caps);