Fix FSF address
[platform/upstream/gstreamer.git] / tests / check / libs / profile.c
index 0fe2832..a4fca08 100644 (file)
@@ -14,8 +14,8 @@
  *
  * You should have received a copy of the GNU Library General Public
  * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
  */
 
 #ifdef HAVE_CONFIG_H
 #include <gst/pbutils/encoding-profile.h>
 #include <gst/pbutils/encoding-target.h>
 
+static inline gboolean
+gst_caps_is_equal_unref (GstCaps * caps1, GstCaps * caps2)
+{
+  gboolean ret;
+
+  ret = gst_caps_is_equal (caps1, caps2);
+  gst_caps_unref (caps1);
+
+  return ret;
+}
+
 #define CHECK_PROFILE(profile, name, description, format, preset, presence, restriction) \
   {                                                                    \
   fail_if(profile == NULL);                                            \
   fail_unless_equals_string (gst_encoding_profile_get_name (profile), name); \
   fail_unless_equals_string (gst_encoding_profile_get_description (profile), description); \
-  fail_unless (gst_caps_is_equal (gst_encoding_profile_get_format (profile), format)); \
+  fail_unless (gst_caps_is_equal_unref (gst_encoding_profile_get_format (profile), format)); \
   fail_unless_equals_string (gst_encoding_profile_get_preset (profile), preset); \
   fail_unless_equals_int (gst_encoding_profile_get_presence (profile), presence); \
-  fail_unless (gst_caps_is_equal (gst_encoding_profile_get_restriction (profile), restriction)); \
+  if (restriction) \
+    fail_unless (gst_caps_is_equal_unref (gst_encoding_profile_get_restriction (profile), restriction)); \
   }
 
 GST_START_TEST (test_profile_creation)
@@ -50,9 +62,9 @@ GST_START_TEST (test_profile_creation)
   GstCaps *ogg, *vorbis, *theora;
   GstCaps *test1, *test2;
 
-  ogg = gst_caps_new_simple ("application/ogg", NULL);
-  vorbis = gst_caps_new_simple ("audio/x-vorbis", NULL);
-  theora = gst_caps_new_simple ("video/x-theora", NULL);
+  ogg = gst_caps_new_empty_simple ("application/ogg");
+  vorbis = gst_caps_new_empty_simple ("audio/x-vorbis");
+  theora = gst_caps_new_empty_simple ("video/x-theora");
 
   encprof = (GstEncodingProfile *) gst_encoding_container_profile_new ((gchar *)
       "ogg-theora-vorbis", "dumb-profile", ogg, (gchar *) "dumb-preset");
@@ -96,7 +108,7 @@ GST_START_TEST (test_profile_input_caps)
   GstCaps *vorbis;
   GstCaps *out, *restriction, *test1;
 
-  vorbis = gst_caps_new_simple ("audio/x-vorbis", NULL);
+  vorbis = gst_caps_new_empty_simple ("audio/x-vorbis");
 
   /* Simple case, no restriction */
   sprof = (GstEncodingProfile *)
@@ -110,7 +122,7 @@ GST_START_TEST (test_profile_input_caps)
   gst_encoding_profile_unref (sprof);
 
   /* One simple restriction */
-  restriction = gst_caps_from_string ("audio/x-raw-int,channels=2,rate=44100");
+  restriction = gst_caps_from_string ("audio/x-raw,channels=2,rate=44100");
   test1 = gst_caps_from_string ("audio/x-vorbis,channels=2,rate=44100");
   fail_if (restriction == NULL);
 
@@ -137,6 +149,8 @@ GST_START_TEST (test_target_naming)
 {
   GstEncodingTarget *target;
 
+  gst_debug_set_threshold_for_name ("default", GST_LEVEL_NONE);
+
   /* NULL values */
   ASSERT_CRITICAL (target = gst_encoding_target_new (NULL, NULL, NULL, NULL));
   fail_if (target != NULL);
@@ -228,7 +242,7 @@ create_saveload_target (const gchar * targetname)
   gst_encoding_target_add_profile (target, profile);
 
   caps = gst_caps_from_string ("audio/x-pony-song,pretty=True");
-  caps2 = gst_caps_from_string ("audio/x-raw-int,channels=1,rate=44100");
+  caps2 = gst_caps_from_string ("audio/x-raw,channels=1,rate=44100");
   sprof =
       (GstEncodingProfile *) gst_encoding_audio_profile_new (caps, NULL, caps2,
       1);
@@ -239,8 +253,7 @@ create_saveload_target (const gchar * targetname)
 
   caps = gst_caps_from_string ("video/x-glitter,sparkling=True");
   caps2 =
-      gst_caps_from_string
-      ("video/x-raw-yuv,width=640,height=480,framerate=15/1");
+      gst_caps_from_string ("video/x-raw,width=640,height=480,framerate=15/1");
   sprof = (GstEncodingProfile *)
       gst_encoding_video_profile_new (caps, "seriously glittery", caps2, 0);
   gst_encoding_video_profile_set_variableframerate ((GstEncodingVideoProfile *)
@@ -290,7 +303,7 @@ GST_START_TEST (test_saving_profile)
 
   /* Check we can load it */
   profile_file_name =
-      g_build_filename (g_get_user_data_dir (), "gstreamer-0.11",
+      g_build_filename (g_get_user_data_dir (), "gstreamer-1.0",
       "encoding-profiles", "herding", "myponytarget2.gep", NULL);
   GST_DEBUG ("Loading target from '%s'", profile_file_name);
   loaded = gst_encoding_target_load_from_file (profile_file_name, NULL);
@@ -363,7 +376,7 @@ test_individual_target (GstEncodingTarget * target)
 
   GST_DEBUG ("Checking the container profile has the audio/x-pony-song stream");
   tmpcaps = gst_caps_from_string ("audio/x-pony-song,pretty=True");
-  tmpcaps2 = gst_caps_from_string ("audio/x-raw-int,channels=1,rate=44100");
+  tmpcaps2 = gst_caps_from_string ("audio/x-raw,channels=1,rate=44100");
   sprof1 =
       (GstEncodingProfile *) gst_encoding_audio_profile_new (tmpcaps, NULL,
       tmpcaps2, 1);
@@ -376,8 +389,7 @@ test_individual_target (GstEncodingTarget * target)
   GST_DEBUG ("Checking the container profile has the video//x-glitter stream");
   tmpcaps = gst_caps_from_string ("video/x-glitter,sparkling=True");
   tmpcaps2 =
-      gst_caps_from_string
-      ("video/x-raw-yuv,width=640,height=480,framerate=15/1");
+      gst_caps_from_string ("video/x-raw,width=640,height=480,framerate=15/1");
   sprof2 = (GstEncodingProfile *)
       gst_encoding_video_profile_new (tmpcaps, "seriously glittery", tmpcaps2,
       0);
@@ -399,6 +411,8 @@ GST_START_TEST (test_loading_profile)
   GValue strvalue = { 0, };
   GValue objectvalue = { 0, };
 
+  gst_debug_set_threshold_for_name ("default", GST_LEVEL_NONE);
+
   /* Test loading using short method and all arguments */
   target = gst_encoding_target_load ("myponytarget", "herding", NULL);
   fail_unless (target != NULL);
@@ -413,7 +427,7 @@ GST_START_TEST (test_loading_profile)
 
   /* Test loading using fully specified path */
   profile_file_name =
-      g_build_filename (g_get_user_data_dir (), "gstreamer-0.11",
+      g_build_filename (g_get_user_data_dir (), "gstreamer-1.0",
       "encoding-profiles", "herding", "myponytarget.gep", NULL);
 
   GST_DEBUG ("Loading target from '%s'", profile_file_name);
@@ -528,7 +542,7 @@ format=animal/x-pony\n\
 parent=pony\n\
 type=audio\n\
 format=audio/x-pony-song,pretty=True\n\
-restriction=audio/x-raw-int,channels=1,rate=44100\n\
+restriction=audio/x-raw,channels=1,rate=44100\n\
 presence=1\n\
 \n\
 [streamprofile-pony12]\n\
@@ -536,7 +550,7 @@ parent=pony\n\
 type=video\n\
 preset=seriously glittery\n\
 format=video/x-glitter,sparkling=True\n\
-restriction=video/x-raw-yuv,width=640,height=480,framerate=15/1\n\
+restriction=video/x-raw,width=640,height=480,framerate=15/1\n\
 presence=0\n\
 variableframerate=true\n\
 ";
@@ -547,12 +561,12 @@ remove_profile_file (void)
   gchar *profile_file_name;
 
   profile_file_name =
-      g_build_filename (g_get_user_data_dir (), "gstreamer-0.11",
+      g_build_filename (g_get_user_data_dir (), "gstreamer-1.0",
       "encoding-profiles", "herding", "myponytarget.gep", NULL);
   g_unlink (profile_file_name);
   g_free (profile_file_name);
   profile_file_name =
-      g_build_filename (g_get_user_data_dir (), "gstreamer-0.11",
+      g_build_filename (g_get_user_data_dir (), "gstreamer-1.0",
       "encoding-profiles", "herding", "myponytarget2.gep", NULL);
   g_unlink (profile_file_name);
   g_free (profile_file_name);
@@ -566,10 +580,10 @@ create_profile_file (void)
   GError *error = NULL;
 
   profile_dir =
-      g_build_filename (g_get_user_data_dir (), "gstreamer-0.11",
+      g_build_filename (g_get_user_data_dir (), "gstreamer-1.0",
       "encoding-profiles", "herding", NULL);
   profile_file_name =
-      g_build_filename (g_get_user_data_dir (), "gstreamer-0.11",
+      g_build_filename (g_get_user_data_dir (), "gstreamer-1.0",
       "encoding-profiles", "herding", "myponytarget.gep", NULL);
   g_mkdir_with_parents (profile_dir, S_IRUSR | S_IWUSR | S_IXUSR);
   if (!g_file_set_contents (profile_file_name, profile_string,
@@ -601,7 +615,7 @@ profile_suite (void)
   gchar *gst_dir;
 
   /* cehck if we can create profiles */
-  gst_dir = g_build_filename (g_get_user_data_dir (), "gstreamer-0.11", NULL);
+  gst_dir = g_build_filename (g_get_user_data_dir (), "gstreamer-1.0", NULL);
   can_write = (g_access (gst_dir, R_OK | W_OK | X_OK) == 0);
   g_free (gst_dir);