summaryrefslogtreecommitdiffstats
path: root/libhb/preset.c
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2015-06-24 15:07:11 +0000
committerjstebbins <[email protected]>2015-06-24 15:07:11 +0000
commit2ce8aaafba431ed4314c9857d3d10c23183e712a (patch)
tree455ad3f503aab87bb3ae8e79040f3865010a3616 /libhb/preset.c
parent293083e5a6c9cff671bcd2060468832d566f55b3 (diff)
presets: add hb_presets_read_file_json()
First tries to intrepret file as json. If that fails, tries plist. Returns a json string. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7314 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/preset.c')
-rw-r--r--libhb/preset.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/libhb/preset.c b/libhb/preset.c
index 228c23fa8..3db53a2b1 100644
--- a/libhb/preset.c
+++ b/libhb/preset.c
@@ -2598,6 +2598,19 @@ hb_value_t* hb_presets_read_file(const char *filename)
return preset;
}
+char * hb_presets_read_file_json(const char *filename)
+{
+ char *result;
+ hb_value_t *preset = hb_value_read_json(filename);
+ if (preset == NULL)
+ preset = hb_plist_parse_file(filename);
+ if (preset == NULL)
+ return NULL;
+
+ result = hb_value_get_json(preset);
+ return result;
+}
+
int hb_presets_add_file(const char *filename)
{
hb_value_t *preset = hb_value_read_json(filename);