summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBradley Sepos <[email protected]>2016-06-27 18:15:57 -0400
committerGitHub <[email protected]>2016-06-27 18:15:57 -0400
commit9905eb75a2372039bff7483521923c1f5d603323 (patch)
tree1921976ef65583782b462037c9a390db2b53a93b
parentb4c23bf71aa401b67dd0afbbe18eeb247a285c80 (diff)
preset: Add CLI Default preset. (#214)
-rw-r--r--libhb/preset.c30
-rw-r--r--libhb/preset.h3
-rw-r--r--libhb/preset_builtin.h105
-rw-r--r--preset/preset_builtin.list1
-rw-r--r--preset/preset_cli_default.json109
-rw-r--r--test/test.c1
6 files changed, 244 insertions, 5 deletions
diff --git a/libhb/preset.c b/libhb/preset.c
index 1164485ee..d4e8e3214 100644
--- a/libhb/preset.c
+++ b/libhb/preset.c
@@ -30,6 +30,7 @@ int hb_preset_version_micro;
static hb_value_t *hb_preset_template = NULL;
static hb_value_t *hb_presets = NULL;
static hb_value_t *hb_presets_builtin = NULL;
+static hb_value_t *hb_presets_cli_default = NULL;
static void preset_clean(hb_value_t *preset, hb_value_t *template);
static int preset_import(hb_value_t *preset, int major, int minor,
@@ -2906,6 +2907,17 @@ void hb_presets_builtin_init(void)
hb_value_free(&dict);
}
+int hb_presets_cli_default_init(void)
+{
+ hb_value_t * dict = hb_value_json(hb_builtin_presets_json);
+ hb_presets_cli_default = hb_value_dup(hb_dict_get(dict, "PresetCLIDefault"));
+ hb_presets_clean(hb_presets_cli_default);
+
+ int result = hb_presets_add_internal(hb_presets_cli_default);
+ hb_value_free(&dict);
+ return result;
+}
+
void hb_presets_current_version(int *major, int* minor, int *micro)
{
*major = hb_preset_version_major;
@@ -3097,7 +3109,7 @@ void hb_presets_builtin_update(void)
hb_value_free(&builtin);
}
-int hb_presets_add(hb_value_t *preset)
+int hb_presets_add_internal(hb_value_t *preset)
{
hb_preset_index_t *path;
int added = 0;
@@ -3105,10 +3117,6 @@ int hb_presets_add(hb_value_t *preset)
if (preset == NULL)
return -1;
- preset = presets_unpackage(preset);
- if (preset == NULL)
- return -1;
-
path = lookup_default_index(preset);
if (path != NULL && path->depth != 0)
{
@@ -3147,6 +3155,18 @@ int hb_presets_add(hb_value_t *preset)
return index;
}
+int hb_presets_add(hb_value_t *preset)
+{
+ if (preset == NULL)
+ return -1;
+
+ preset = presets_unpackage(preset);
+ if (preset == NULL)
+ return -1;
+
+ return hb_presets_add_internal(preset);
+}
+
int hb_presets_add_json(const char *json)
{
hb_value_t *preset = hb_value_json(json);
diff --git a/libhb/preset.h b/libhb/preset.h
index 3f6301abe..25653ff62 100644
--- a/libhb/preset.h
+++ b/libhb/preset.h
@@ -40,6 +40,9 @@ void hb_presets_free(void);
#endif // __LIBHB__
+// Add the default CLI preset(s) to the currently loaded presets
+int hb_presets_cli_default_init(void);
+
// Get the currently supported preset format version
void hb_presets_current_version(int *major, int* minor, int *micro);
diff --git a/libhb/preset_builtin.h b/libhb/preset_builtin.h
index 85e05a776..3a097a227 100644
--- a/libhb/preset_builtin.h
+++ b/libhb/preset_builtin.h
@@ -6620,6 +6620,111 @@ const char hb_builtin_presets_json[] =
" \"Type\": 0\n"
" }\n"
" ], \n"
+" \"PresetCLIDefault\": [\n"
+" {\n"
+" \"ChildrenArray\": [\n"
+" {\n"
+" \"AudioCopyMask\": [\n"
+" \"copy:aac\"\n"
+" ], \n"
+" \"AudioEncoderFallback\": \"aac\", \n"
+" \"AudioLanguageList\": [], \n"
+" \"AudioList\": [\n"
+" {\n"
+" \"AudioBitrate\": 128, \n"
+" \"AudioCompressionLevel\": -1.0, \n"
+" \"AudioDitherMethod\": \"auto\", \n"
+" \"AudioEncoder\": \"aac\", \n"
+" \"AudioMixdown\": \"dpl2\", \n"
+" \"AudioNormalizeMixLevel\": false, \n"
+" \"AudioSamplerate\": \"auto\", \n"
+" \"AudioTrackDRCSlider\": 0.0, \n"
+" \"AudioTrackGainSlider\": 0.0, \n"
+" \"AudioTrackQuality\": -1.0, \n"
+" \"AudioTrackQualityEnable\": false\n"
+" }\n"
+" ], \n"
+" \"AudioSecondaryEncoderMode\": true, \n"
+" \"AudioTrackSelectionBehavior\": \"first\", \n"
+" \"ChapterMarkers\": true, \n"
+" \"ChildrenArray\": [], \n"
+" \"Default\": true, \n"
+" \"FileFormat\": \"mp4\", \n"
+" \"Folder\": false, \n"
+" \"FolderOpen\": false, \n"
+" \"Mp4HttpOptimize\": false, \n"
+" \"Mp4iPodCompatible\": false, \n"
+" \"PictureAutoCrop\": true, \n"
+" \"PictureBottomCrop\": 0, \n"
+" \"PictureCombDetectCustom\": \"\", \n"
+" \"PictureCombDetectPreset\": \"off\", \n"
+" \"PictureDARWidth\": 0, \n"
+" \"PictureDeblock\": 0, \n"
+" \"PictureDeblockCustom\": \"qp=0:mode=2\", \n"
+" \"PictureDeinterlaceCustom\": \"\", \n"
+" \"PictureDeinterlaceFilter\": \"off\", \n"
+" \"PictureDeinterlacePreset\": \"default\", \n"
+" \"PictureDenoiseCustom\": \"\", \n"
+" \"PictureDenoiseFilter\": \"off\", \n"
+" \"PictureDenoisePreset\": \"medium\", \n"
+" \"PictureDenoiseTune\": \"none\", \n"
+" \"PictureDetelecine\": \"off\", \n"
+" \"PictureDetelecineCustom\": \"\", \n"
+" \"PictureForceHeight\": 0, \n"
+" \"PictureForceWidth\": 0, \n"
+" \"PictureHeight\": 0, \n"
+" \"PictureItuPAR\": false, \n"
+" \"PictureKeepRatio\": true, \n"
+" \"PictureLeftCrop\": 0, \n"
+" \"PictureLooseCrop\": false, \n"
+" \"PictureModulus\": 2, \n"
+" \"PicturePAR\": \"strict\", \n"
+" \"PicturePARHeight\": 720, \n"
+" \"PicturePARWidth\": 853, \n"
+" \"PictureRightCrop\": 0, \n"
+" \"PictureRotate\": \"angle=0:hflip=0\", \n"
+" \"PictureTopCrop\": 0, \n"
+" \"PictureWidth\": 0, \n"
+" \"PresetDescription\": \"\", \n"
+" \"PresetName\": \"CLI Default\", \n"
+" \"SubtitleAddCC\": false, \n"
+" \"SubtitleAddForeignAudioSearch\": false, \n"
+" \"SubtitleAddForeignAudioSubtitle\": false, \n"
+" \"SubtitleBurnBDSub\": false, \n"
+" \"SubtitleBurnBehavior\": \"none\", \n"
+" \"SubtitleBurnDVDSub\": false, \n"
+" \"SubtitleLanguageList\": [], \n"
+" \"SubtitleTrackSelectionBehavior\": \"none\", \n"
+" \"Type\": 0, \n"
+" \"UsesPictureFilters\": true, \n"
+" \"UsesPictureSettings\": 2, \n"
+" \"VideoAvgBitrate\": 6000, \n"
+" \"VideoColorMatrixCode\": 0, \n"
+" \"VideoEncoder\": \"x264\", \n"
+" \"VideoFramerate\": \"\", \n"
+" \"VideoFramerateMode\": \"vfr\", \n"
+" \"VideoGrayScale\": false, \n"
+" \"VideoLevel\": \"auto\", \n"
+" \"VideoOptionExtra\": \"\", \n"
+" \"VideoPreset\": \"medium\", \n"
+" \"VideoProfile\": \"auto\", \n"
+" \"VideoQSVAsyncDepth\": 4, \n"
+" \"VideoQSVDecode\": false, \n"
+" \"VideoQualitySlider\": 22.0, \n"
+" \"VideoQualityType\": 2, \n"
+" \"VideoScaler\": \"swscale\", \n"
+" \"VideoTune\": \"\", \n"
+" \"VideoTurboTwoPass\": false, \n"
+" \"VideoTwoPass\": false, \n"
+" \"x264Option\": \"\", \n"
+" \"x264UseAdvancedOptions\": false\n"
+" }\n"
+" ], \n"
+" \"Folder\": true, \n"
+" \"PresetName\": \"CLI Defaults\", \n"
+" \"Type\": 0\n"
+" }\n"
+" ], \n"
" \"PresetTemplate\": {\n"
" \"Preset\": {\n"
" \"AudioCopyMask\": [\n"
diff --git a/preset/preset_builtin.list b/preset/preset_builtin.list
index 9bccfc536..b26b7aef5 100644
--- a/preset/preset_builtin.list
+++ b/preset/preset_builtin.list
@@ -6,4 +6,5 @@
<json name="Preset" file="preset_template.json" />
</section>
<json name="PresetBuiltin" file="preset_builtin.json" />
+ <json name="PresetCLIDefault" file="preset_cli_default.json" />
</resources>
diff --git a/preset/preset_cli_default.json b/preset/preset_cli_default.json
new file mode 100644
index 000000000..1cf7375b2
--- /dev/null
+++ b/preset/preset_cli_default.json
@@ -0,0 +1,109 @@
+ [
+ {
+ "ChildrenArray": [
+ {
+ "AudioCopyMask": [
+ "copy:aac"
+ ],
+ "AudioEncoderFallback": "aac",
+ "AudioLanguageList": [
+ ],
+ "AudioList": [
+ {
+ "AudioBitrate": 128,
+ "AudioCompressionLevel": -1.0,
+ "AudioDitherMethod": "auto",
+ "AudioEncoder": "aac",
+ "AudioMixdown": "dpl2",
+ "AudioNormalizeMixLevel": false,
+ "AudioSamplerate": "auto",
+ "AudioTrackQualityEnable": false,
+ "AudioTrackQuality": -1.0,
+ "AudioTrackGainSlider": 0.0,
+ "AudioTrackDRCSlider": 0.0
+ }
+ ],
+ "AudioSecondaryEncoderMode": true,
+ "AudioTrackSelectionBehavior": "first",
+ "ChapterMarkers": true,
+ "ChildrenArray": [
+ ],
+ "Default": true,
+ "FileFormat": "mp4",
+ "Folder": false,
+ "FolderOpen": false,
+ "Mp4HttpOptimize": false,
+ "Mp4iPodCompatible": false,
+ "PictureAutoCrop": true,
+ "PictureBottomCrop": 0,
+ "PictureLeftCrop": 0,
+ "PictureRightCrop": 0,
+ "PictureTopCrop": 0,
+ "PictureDARWidth": 0,
+ "PictureDeblock": 0,
+ "PictureDeblockCustom": "qp=0:mode=2",
+ "PictureCombDetectCustom": "",
+ "PictureCombDetectPreset": "off",
+ "PictureDeinterlaceCustom": "",
+ "PictureDeinterlaceFilter": "off",
+ "PictureDeinterlacePreset": "default",
+ "PictureDenoiseCustom": "",
+ "PictureDenoiseFilter": "off",
+ "PictureDenoisePreset": "medium",
+ "PictureDenoiseTune": "none",
+ "PictureDetelecine": "off",
+ "PictureDetelecineCustom": "",
+ "PictureItuPAR": false,
+ "PictureKeepRatio": true,
+ "PictureLooseCrop": false,
+ "PictureModulus": 2,
+ "PicturePAR": "strict",
+ "PicturePARWidth": 853,
+ "PicturePARHeight": 720,
+ "PictureRotate": "angle=0:hflip=0",
+ "PictureWidth": 0,
+ "PictureHeight": 0,
+ "PictureForceHeight": 0,
+ "PictureForceWidth": 0,
+ "PresetDescription": "",
+ "PresetName": "CLI Default",
+ "Type": 0,
+ "UsesPictureFilters": true,
+ "UsesPictureSettings": 2,
+ "SubtitleAddCC": false,
+ "SubtitleAddForeignAudioSearch": false,
+ "SubtitleAddForeignAudioSubtitle": false,
+ "SubtitleBurnBehavior": "none",
+ "SubtitleBurnBDSub": false,
+ "SubtitleBurnDVDSub": false,
+ "SubtitleLanguageList": [
+ ],
+ "SubtitleTrackSelectionBehavior": "none",
+ "VideoAvgBitrate": 6000,
+ "VideoColorMatrixCode": 0,
+ "VideoEncoder": "x264",
+ "VideoFramerate": "",
+ "VideoFramerateMode": "vfr",
+ "VideoGrayScale": false,
+ "VideoScaler": "swscale",
+ "VideoPreset": "medium",
+ "VideoTune": "",
+ "VideoProfile": "auto",
+ "VideoLevel": "auto",
+ "VideoOptionExtra": "",
+ "VideoQualityType": 2,
+ "VideoQualitySlider": 22.0,
+ "VideoQSVDecode": false,
+ "VideoQSVAsyncDepth": 4,
+ "VideoTwoPass": false,
+ "VideoTurboTwoPass": false,
+ "x264Option": "",
+ "x264UseAdvancedOptions": false
+ }
+ ],
+ "Folder": true,
+ "PresetName": "CLI Defaults",
+ "Type": 0
+ }
+ ]
+
diff --git a/test/test.c b/test/test.c
index 8972896e7..d8f528433 100644
--- a/test/test.c
+++ b/test/test.c
@@ -423,6 +423,7 @@ int main( int argc, char ** argv )
hb_global_init();
hb_presets_builtin_update();
+ hb_presets_cli_default_init();
/* Init libhb */
h = hb_init(4); // Show all logging until debug level is parsed