encoding-target: Change target suffix to .gep
Along with a bunch of other internal cleanups
This commit is contained in:
parent
520eb442ce
commit
3b32566dd4
@ -68,6 +68,8 @@
|
|||||||
|
|
||||||
|
|
||||||
#define GST_ENCODING_TARGET_HEADER "_gstencodingtarget_"
|
#define GST_ENCODING_TARGET_HEADER "_gstencodingtarget_"
|
||||||
|
#define GST_ENCODING_TARGET_DIRECTORY "encoding-profiles"
|
||||||
|
#define GST_ENCODING_TARGET_SUFFIX ".gep"
|
||||||
|
|
||||||
struct _GstEncodingTarget
|
struct _GstEncodingTarget
|
||||||
{
|
{
|
||||||
@ -818,12 +820,12 @@ gst_encoding_target_load (const gchar * name, const gchar * category,
|
|||||||
if (category && !validate_name (category))
|
if (category && !validate_name (category))
|
||||||
goto invalid_category;
|
goto invalid_category;
|
||||||
|
|
||||||
lfilename = g_strdup_printf ("%s.gstprofile", name);
|
lfilename = g_strdup_printf ("%s" GST_ENCODING_TARGET_SUFFIX, name);
|
||||||
|
|
||||||
/* Try from local profiles */
|
/* Try from local profiles */
|
||||||
tldir =
|
tldir =
|
||||||
g_build_filename (g_get_home_dir (), ".gstreamer-0.10",
|
g_build_filename (g_get_home_dir (), ".gstreamer-" GST_MAJORMINOR,
|
||||||
"encoding-profile", NULL);
|
GST_ENCODING_TARGET_DIRECTORY, NULL);
|
||||||
target = gst_encoding_target_subload (tldir, category, lfilename, error);
|
target = gst_encoding_target_subload (tldir, category, lfilename, error);
|
||||||
g_free (tldir);
|
g_free (tldir);
|
||||||
|
|
||||||
@ -831,7 +833,7 @@ gst_encoding_target_load (const gchar * name, const gchar * category,
|
|||||||
/* Try from system-wide profiles */
|
/* Try from system-wide profiles */
|
||||||
tldir =
|
tldir =
|
||||||
g_build_filename (GST_DATADIR, "gstreamer-" GST_MAJORMINOR,
|
g_build_filename (GST_DATADIR, "gstreamer-" GST_MAJORMINOR,
|
||||||
"encoding-profile", NULL);
|
GST_ENCODING_TARGET_DIRECTORY, NULL);
|
||||||
target = gst_encoding_target_subload (tldir, category, lfilename, error);
|
target = gst_encoding_target_subload (tldir, category, lfilename, error);
|
||||||
g_free (tldir);
|
g_free (tldir);
|
||||||
}
|
}
|
||||||
@ -946,10 +948,10 @@ gst_encoding_target_save (GstEncodingTarget * target, GError ** error)
|
|||||||
g_return_val_if_fail (GST_IS_ENCODING_TARGET (target), FALSE);
|
g_return_val_if_fail (GST_IS_ENCODING_TARGET (target), FALSE);
|
||||||
g_return_val_if_fail (target->category != NULL, FALSE);
|
g_return_val_if_fail (target->category != NULL, FALSE);
|
||||||
|
|
||||||
lfilename = g_strdup_printf ("%s.gstprofile", target->name);
|
lfilename = g_strdup_printf ("%s" GST_ENCODING_TARGET_SUFFIX, target->name);
|
||||||
filename =
|
filename =
|
||||||
g_build_filename (g_get_home_dir (), ".gstreamer-0.10",
|
g_build_filename (g_get_home_dir (), ".gstreamer-" GST_MAJORMINOR,
|
||||||
"encoding-profile", target->category, lfilename, NULL);
|
GST_ENCODING_TARGET_DIRECTORY, target->category, lfilename, NULL);
|
||||||
g_free (lfilename);
|
g_free (lfilename);
|
||||||
|
|
||||||
res = gst_encoding_target_save_to (target, filename, error);
|
res = gst_encoding_target_save_to (target, filename, error);
|
||||||
@ -999,14 +1001,14 @@ gst_encoding_list_available_categories (void)
|
|||||||
gchar *topdir;
|
gchar *topdir;
|
||||||
|
|
||||||
/* First try user-local categories */
|
/* First try user-local categories */
|
||||||
topdir = g_build_filename (g_get_home_dir (), ".gstreamer-0.10",
|
topdir = g_build_filename (g_get_home_dir (), ".gstreamer-" GST_MAJORMINOR,
|
||||||
"encoding-profile", NULL);
|
GST_ENCODING_TARGET_DIRECTORY, NULL);
|
||||||
res = get_categories (topdir);
|
res = get_categories (topdir);
|
||||||
g_free (topdir);
|
g_free (topdir);
|
||||||
|
|
||||||
/* Extend with system-wide categories */
|
/* Extend with system-wide categories */
|
||||||
topdir = g_build_filename (GST_DATADIR, "gstreamer-" GST_MAJORMINOR,
|
topdir = g_build_filename (GST_DATADIR, "gstreamer-" GST_MAJORMINOR,
|
||||||
"encoding-profile", NULL);
|
GST_ENCODING_TARGET_DIRECTORY, NULL);
|
||||||
tmp1 = get_categories (topdir);
|
tmp1 = get_categories (topdir);
|
||||||
g_free (topdir);
|
g_free (topdir);
|
||||||
|
|
||||||
@ -1038,7 +1040,7 @@ sub_get_all_targets (gchar * subdir)
|
|||||||
gchar *fullname;
|
gchar *fullname;
|
||||||
|
|
||||||
/* Only try files ending with .gstprofile */
|
/* Only try files ending with .gstprofile */
|
||||||
if (!g_str_has_suffix (filename, ".gstprofile"))
|
if (!g_str_has_suffix (filename, GST_ENCODING_TARGET_SUFFIX))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
fullname = g_build_filename (subdir, filename, NULL);
|
fullname = g_build_filename (subdir, filename, NULL);
|
||||||
@ -1113,14 +1115,14 @@ gst_encoding_list_all_targets (const gchar * categoryname)
|
|||||||
gchar *topdir;
|
gchar *topdir;
|
||||||
|
|
||||||
/* Get user-locals */
|
/* Get user-locals */
|
||||||
topdir = g_build_filename (g_get_home_dir (), ".gstreamer-0.10",
|
topdir = g_build_filename (g_get_home_dir (), ".gstreamer-" GST_MAJORMINOR,
|
||||||
"encoding-profile", NULL);
|
GST_ENCODING_TARGET_DIRECTORY, NULL);
|
||||||
res = get_all_targets (topdir, categoryname);
|
res = get_all_targets (topdir, categoryname);
|
||||||
g_free (topdir);
|
g_free (topdir);
|
||||||
|
|
||||||
/* Get system-wide */
|
/* Get system-wide */
|
||||||
topdir = g_build_filename (GST_DATADIR, "gstreamer-" GST_MAJORMINOR,
|
topdir = g_build_filename (GST_DATADIR, "gstreamer-" GST_MAJORMINOR,
|
||||||
"encoding-profile", NULL);
|
GST_ENCODING_TARGET_DIRECTORY, NULL);
|
||||||
tmp1 = get_all_targets (topdir, categoryname);
|
tmp1 = get_all_targets (topdir, categoryname);
|
||||||
g_free (topdir);
|
g_free (topdir);
|
||||||
|
|
||||||
|
@ -290,7 +290,7 @@ GST_START_TEST (test_saving_profile)
|
|||||||
|
|
||||||
/* Check we can load it */
|
/* Check we can load it */
|
||||||
profile_file_name = g_build_filename (g_get_home_dir (), ".gstreamer-0.10",
|
profile_file_name = g_build_filename (g_get_home_dir (), ".gstreamer-0.10",
|
||||||
"encoding-profile", "herding", "myponytarget2.gstprofile", NULL);
|
"encoding-profiles", "herding", "myponytarget2.gep", NULL);
|
||||||
GST_DEBUG ("Loading target from '%s'", profile_file_name);
|
GST_DEBUG ("Loading target from '%s'", profile_file_name);
|
||||||
loaded = gst_encoding_target_load_from (profile_file_name, NULL);
|
loaded = gst_encoding_target_load_from (profile_file_name, NULL);
|
||||||
fail_unless (loaded != NULL);
|
fail_unless (loaded != NULL);
|
||||||
@ -412,7 +412,7 @@ GST_START_TEST (test_loading_profile)
|
|||||||
|
|
||||||
/* Test loading using fully specified path */
|
/* Test loading using fully specified path */
|
||||||
profile_file_name = g_build_filename (g_get_home_dir (), ".gstreamer-0.10",
|
profile_file_name = g_build_filename (g_get_home_dir (), ".gstreamer-0.10",
|
||||||
"encoding-profile", "herding", "myponytarget.gstprofile", NULL);
|
"encoding-profiles", "herding", "myponytarget.gep", NULL);
|
||||||
|
|
||||||
GST_DEBUG ("Loading target from '%s'", profile_file_name);
|
GST_DEBUG ("Loading target from '%s'", profile_file_name);
|
||||||
target = gst_encoding_target_load_from (profile_file_name, NULL);
|
target = gst_encoding_target_load_from (profile_file_name, NULL);
|
||||||
@ -545,11 +545,11 @@ remove_profile_file (void)
|
|||||||
gchar *profile_file_name;
|
gchar *profile_file_name;
|
||||||
|
|
||||||
profile_file_name = g_build_filename (g_get_home_dir (), ".gstreamer-0.10",
|
profile_file_name = g_build_filename (g_get_home_dir (), ".gstreamer-0.10",
|
||||||
"encoding-profile", "herding", "myponytarget.gstprofile", NULL);
|
"encoding-profiles", "herding", "myponytarget.gep", NULL);
|
||||||
g_unlink (profile_file_name);
|
g_unlink (profile_file_name);
|
||||||
g_free (profile_file_name);
|
g_free (profile_file_name);
|
||||||
profile_file_name = g_build_filename (g_get_home_dir (), ".gstreamer-0.10",
|
profile_file_name = g_build_filename (g_get_home_dir (), ".gstreamer-0.10",
|
||||||
"encoding-profile", "herding", "myponytarget2.gstprofile", NULL);
|
"encoding-profiles", "herding", "myponytarget2.gep", NULL);
|
||||||
g_unlink (profile_file_name);
|
g_unlink (profile_file_name);
|
||||||
g_free (profile_file_name);
|
g_free (profile_file_name);
|
||||||
}
|
}
|
||||||
@ -563,10 +563,10 @@ create_profile_file (void)
|
|||||||
|
|
||||||
profile_dir =
|
profile_dir =
|
||||||
g_build_filename (g_get_home_dir (), ".gstreamer-0.10",
|
g_build_filename (g_get_home_dir (), ".gstreamer-0.10",
|
||||||
"encoding-profile", "herding", NULL);
|
"encoding-profiles", "herding", NULL);
|
||||||
profile_file_name =
|
profile_file_name =
|
||||||
g_build_filename (g_get_home_dir (), ".gstreamer-0.10",
|
g_build_filename (g_get_home_dir (), ".gstreamer-0.10",
|
||||||
"encoding-profile", "herding", "myponytarget.gstprofile", NULL);
|
"encoding-profiles", "herding", "myponytarget.gep", NULL);
|
||||||
g_mkdir_with_parents (profile_dir, S_IRUSR | S_IWUSR | S_IXUSR);
|
g_mkdir_with_parents (profile_dir, S_IRUSR | S_IWUSR | S_IXUSR);
|
||||||
if (!g_file_set_contents (profile_file_name, profile_string,
|
if (!g_file_set_contents (profile_file_name, profile_string,
|
||||||
strlen (profile_string), &error))
|
strlen (profile_string), &error))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user