summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2017-01-11 14:25:07 -0700
committerJohn Stebbins <[email protected]>2017-01-11 14:26:48 -0700
commit5ed4dc7ff3dfd1a19b27863e30900505e292b529 (patch)
tree1bae5bd0378acc24c40ae52fa92113a113124e1c
parent06b07f9eeb31be0554b4a729554ec5dee92794c4 (diff)
json: revise range "End" for time and frame ranges
"End" was a duration. It is now the actual "End" position in 90khz ticks or frames.
-rw-r--r--gtk/src/callbacks.c12
-rw-r--r--libhb/hb_json.c41
-rw-r--r--test/test.c11
3 files changed, 45 insertions, 19 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c
index a83e5495e..62e8f2363 100644
--- a/gtk/src/callbacks.c
+++ b/gtk/src/callbacks.c
@@ -2478,7 +2478,7 @@ start_point_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
update_title_duration(ud);
ghb_dict_set_int(range, "Start", start * 90000);
- ghb_dict_set_int(range, "End", (end - start) * 90000);
+ ghb_dict_set_int(range, "End", end * 90000);
}
else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 2)
{
@@ -2492,8 +2492,8 @@ start_point_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
ghb_check_dependency(ud, widget, NULL);
update_title_duration(ud);
- ghb_dict_set_int(range, "Start", start - 1);
- ghb_dict_set_int(range, "End", end - start + 1);
+ ghb_dict_set_int(range, "Start", start);
+ ghb_dict_set_int(range, "End", end);
}
}
@@ -2542,7 +2542,7 @@ end_point_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
update_title_duration(ud);
ghb_dict_set_int(range, "Start", start * 90000);
- ghb_dict_set_int(range, "End", (end - start) * 90000);
+ ghb_dict_set_int(range, "End", end * 90000);
}
else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 2)
{
@@ -2556,8 +2556,8 @@ end_point_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
ghb_check_dependency(ud, widget, NULL);
update_title_duration(ud);
- ghb_dict_set_int(range, "Start", start - 1);
- ghb_dict_set_int(range, "End", end - start + 1);
+ ghb_dict_set_int(range, "Start", start);
+ ghb_dict_set_int(range, "End", end);
}
}
diff --git a/libhb/hb_json.c b/libhb/hb_json.c
index 296cd9d24..32975785d 100644
--- a/libhb/hb_json.c
+++ b/libhb/hb_json.c
@@ -468,19 +468,38 @@ hb_dict_t* hb_job_to_dict( const hb_job_t * job )
"End", hb_value_int(job->pts_to_stop),
"SeekPoints", hb_value_int(job->seek_points));
}
- else if (job->pts_to_start != 0)
+ else if (job->pts_to_start != 0 || job->pts_to_stop != 0)
{
range_dict = json_pack_ex(&error, 0, "{s:o, s:o, s:o}",
"Type", hb_value_string("time"),
"Start", hb_value_int(job->pts_to_start),
"End", hb_value_int(job->pts_to_stop));
+ range_dict = hb_dict_init();
+ hb_dict_set(source_dict, "Type", hb_value_string("time"));
+ if (job->pts_to_start > 0)
+ {
+ hb_dict_set(source_dict, "Start", hb_value_int(job->pts_to_start));
+ }
+ if (job->pts_to_stop > 0)
+ {
+ hb_dict_set(source_dict, "End",
+ hb_value_int(job->pts_to_start + job->pts_to_stop));
+ }
}
- else if (job->frame_to_start != 0)
+ else if (job->frame_to_start != 0 || job->frame_to_stop != 0)
{
- range_dict = json_pack_ex(&error, 0, "{s:o, s:o, s:o}",
- "Type", hb_value_string("frame"),
- "Start", hb_value_int(job->frame_to_start),
- "End", hb_value_int(job->frame_to_stop));
+ range_dict = hb_dict_init();
+ hb_dict_set(source_dict, "Type", hb_value_string("frame"));
+ if (job->frame_to_start > 0)
+ {
+ hb_dict_set(source_dict, "Start",
+ hb_value_int(job->frame_to_start + 1));
+ }
+ if (job->frame_to_stop > 0)
+ {
+ hb_dict_set(source_dict, "End",
+ hb_value_int(job->frame_to_start + job->frame_to_stop));
+ }
}
else
{
@@ -970,14 +989,14 @@ hb_job_t* hb_dict_to_job( hb_handle_t * h, hb_dict_t *dict )
if (range_start >= 0)
job->pts_to_start = range_start;
if (range_end >= 0)
- job->pts_to_stop = range_end;
+ job->pts_to_stop = range_end - job->pts_to_start;
}
else if (!strcasecmp(range_type, "frame"))
{
- if (range_start >= 0)
- job->frame_to_start = range_start;
- if (range_end >= 0)
- job->frame_to_stop = range_end;
+ if (range_start > 0)
+ job->frame_to_start = range_start - 1;
+ if (range_end > 0)
+ job->frame_to_stop = range_end - job->frame_to_start;
}
}
diff --git a/test/test.c b/test/test.c
index 2d21d153b..d48e88a8b 100644
--- a/test/test.c
+++ b/test/test.c
@@ -4026,13 +4026,20 @@ PrepareJob(hb_handle_t *h, hb_title_t *title, hb_dict_t *preset_dict)
{
range_type = "time";
range_start = start_at_pts;
- range_end = stop_at_pts;
+ if (stop_at_pts > 0)
+ range_end = start_at_pts + stop_at_pts;
}
else if (start_at_frame || stop_at_frame)
{
range_type = "frame";
range_start = start_at_frame;
- range_end = stop_at_frame;
+ if (stop_at_frame > 0)
+ {
+ if (start_at_frame > 0)
+ range_end = start_at_frame + stop_at_frame - 1;
+ else
+ range_end = stop_at_frame;
+ }
}
if (range_start || range_end)
{