Skip to content

Commit 928f5c9

Browse files
authored
Allows to sign files given as a full path (#28)
Co-authored-by: bjornvolcker <[email protected]>
1 parent 4655db3 commit 928f5c9

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

.github/workflows/meson-build-apps.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,10 @@ jobs:
5656
$GITHUB_WORKSPACE/local_installs/bin/validator -c h265 svf_apps/test-files/signed_test_h265.mp4
5757
$GITHUB_WORKSPACE/local_installs/bin/validator -c h264 svf_apps/test-files/signed_vendor_axis.h264
5858
cat validation_results.txt
59-
- name: Copy test files for signing
60-
run: cp svf_apps/test-files/test_h26*.mp4 .
6159
- name: Run signer on test-files
6260
run: |
6361
export GST_PLUGIN_PATH=$GITHUB_WORKSPACE/local_installs
64-
$GITHUB_WORKSPACE/local_installs/bin/signer -c h264 test_h264.mp4
65-
$GITHUB_WORKSPACE/local_installs/bin/validator -c h264 signed_test_h264.mp4
66-
$GITHUB_WORKSPACE/local_installs/bin/signer -c h265 test_h265.mp4
67-
$GITHUB_WORKSPACE/local_installs/bin/validator -c h265 signed_test_h265.mp4
62+
$GITHUB_WORKSPACE/local_installs/bin/signer -c h264 svf_apps/test-files/test_h264.mp4
63+
$GITHUB_WORKSPACE/local_installs/bin/validator -c h264 svf_apps/test-files/signed_test_h264.mp4
64+
$GITHUB_WORKSPACE/local_installs/bin/signer -c h265 svf_apps/test-files/test_h265.mp4
65+
$GITHUB_WORKSPACE/local_installs/bin/validator -c h265 svf_apps/test-files/signed_test_h265.mp4

apps/signer/main.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,23 @@ main(gint argc, gchar *argv[])
152152
// Parse filename.
153153
if (arg < argc) {
154154
filename = argv[arg];
155-
outfilename = g_strdup_printf("signed_%s", filename);
155+
// Extract filename from path. Try both Windows and Linux style.
156+
gchar *pathname = g_strdup(filename);
157+
gchar *end_path_name_linux = strrchr(pathname, '/');
158+
gchar *end_path_name_win = strrchr(pathname, '\\');
159+
if (end_path_name_linux && end_path_name_win) {
160+
g_error("Filename %s has invalid characters", filename);
161+
}
162+
if (end_path_name_linux) {
163+
*end_path_name_linux = '\0';
164+
outfilename = g_strdup_printf("%s/signed_%s", pathname, end_path_name_linux + 1);
165+
} else if (end_path_name_win) {
166+
*end_path_name_win = '\0';
167+
outfilename = g_strdup_printf("%s\\signed_%s", pathname, end_path_name_win + 1);
168+
} else {
169+
outfilename = g_strdup_printf("signed_%s", filename);
170+
}
171+
g_free(pathname);
156172
g_message(
157173
"\nThe result of signing '%s' will be written to '%s'.\n"
158174
"Private and public key stored at '%s'",

test-files/signed_test_h264.mp4

-101 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)