From 8aa29ada7f36594dcd43c179f151f480f7e96897 Mon Sep 17 00:00:00 2001 From: Ayush Mittal Date: Sat, 20 Jun 2020 00:37:09 +0530 Subject: [PATCH] Added the path property in encoding-target Part-of: --- gst-libs/gst/pbutils/encoding-target.c | 21 ++++++++++++++++++++- gst-libs/gst/pbutils/encoding-target.h | 3 +++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/pbutils/encoding-target.c b/gst-libs/gst/pbutils/encoding-target.c index 3d6ea21b2b..824464f89f 100644 --- a/gst-libs/gst/pbutils/encoding-target.c +++ b/gst-libs/gst/pbutils/encoding-target.c @@ -99,6 +99,7 @@ struct _GstEncodingTarget gchar *name; gchar *category; gchar *description; + gchar *path; GList *profiles; /*< private > */ @@ -123,6 +124,7 @@ gst_encoding_target_finalize (GObject * object) g_free (target->name); g_free (target->category); g_free (target->description); + g_free (target->path); g_list_foreach (target->profiles, (GFunc) g_object_unref, NULL); g_list_free (target->profiles); @@ -171,6 +173,21 @@ gst_encoding_target_get_description (GstEncodingTarget * target) return target->description; } +/** + * gst_encoding_target_get_path: + * @target: a #GstEncodingTarget + * + * Returns: (transfer none): The path to the @target file. + * + * Since: 1.18 + */ +const gchar * +gst_encoding_target_get_path (GstEncodingTarget * target) +{ + g_return_val_if_fail (GST_IS_ENCODING_TARGET (target), NULL); + return target->path; +} + /** * gst_encoding_target_get_profiles: * @target: a #GstEncodingTarget @@ -1010,6 +1027,8 @@ gst_encoding_target_save_to_file (GstEncodingTarget * target, if (!g_file_set_contents (filepath, data, data_size, error)) goto write_failed; + target->path = g_strdup (filepath); + g_key_file_free (out); g_free (data); @@ -1167,10 +1186,10 @@ sub_get_all_targets (gchar * subdir) fullname = g_build_filename (subdir, filename, NULL); target = gst_encoding_target_load_from_file (fullname, NULL); if (target) { + target->path = fullname; res = g_list_append (res, target); } else GST_WARNING ("Failed to get a target from %s", fullname); - g_free (fullname); } g_dir_close (dir); diff --git a/gst-libs/gst/pbutils/encoding-target.h b/gst-libs/gst/pbutils/encoding-target.h index 099492e634..9a51dac55f 100644 --- a/gst-libs/gst/pbutils/encoding-target.h +++ b/gst-libs/gst/pbutils/encoding-target.h @@ -136,6 +136,9 @@ const gchar * gst_encoding_target_get_category (GstEncodingTarg GST_PBUTILS_API const gchar * gst_encoding_target_get_description (GstEncodingTarget *target); +GST_PBUTILS_API +const gchar * gst_encoding_target_get_path (GstEncodingTarget *target); + GST_PBUTILS_API const GList * gst_encoding_target_get_profiles (GstEncodingTarget *target); -- 2.34.1