diff options
author | jstebbins <[email protected]> | 2015-06-24 15:07:11 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2015-06-24 15:07:11 +0000 |
commit | 2ce8aaafba431ed4314c9857d3d10c23183e712a (patch) | |
tree | 455ad3f503aab87bb3ae8e79040f3865010a3616 | |
parent | 293083e5a6c9cff671bcd2060468832d566f55b3 (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
-rw-r--r-- | libhb/preset.c | 13 |
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); |