summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bin/gst/main.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/bin/gst/main.c b/src/bin/gst/main.c
index 3dffbb2..050b74f 100644
--- a/src/bin/gst/main.c
+++ b/src/bin/gst/main.c
@@ -119,6 +119,7 @@ _gst_init(const char *filename)
gst_element_query_duration (pipeline, format, &duration);
if (duration == -1)
{
+ fprintf(stderr, "duration fetch err\n");
D("could not retrieve the duration, set it to 1s\n");
duration = 1 * GST_SECOND;
}
@@ -219,13 +220,13 @@ main(int argc, char **argv)
numonly = 1;
for (p = argv[i]; *p; p++)
{
- if ((!*p < '0') || (*p > 9))
+ if ((*p < '0') || (*p > '9'))
{
numonly = 0;
break;
}
}
- if (numonly) pos = (double)(atoll(argv[i])) / 1000.0;
+ if (numonly) pos = atoll(argv[i]) * 1000000;
i++;
}
else if (!strcmp(argv[i], "-opt-scale-down-by"))
@@ -254,6 +255,8 @@ main(int argc, char **argv)
return -1;
D("_gst_init done\n");
+ if ((pos >= 0) && (pos > duration)) return -1;
+
if (!head_only)
{
_gst_load_image(size_w, size_h, pos);