From 6bc4934b75dde9354ee16a6e700ebe6775abf69e Mon Sep 17 00:00:00 2001 From: Martin Storsjö Date: Wed, 2 Jul 2014 22:44:32 +0300 Subject: ismindex: Allow adding a path prefix to the generated .ism file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows storing the .ismv/.isma/.ismc files separately from the .ism file on a server, without having to manually edit the .ism file after generating it with the ismindex tool. Signed-off-by: Martin Storsjö --- tools/ismindex.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'tools') diff --git a/tools/ismindex.c b/tools/ismindex.c index a51c5b748f..dea8aef6ab 100644 --- a/tools/ismindex.c +++ b/tools/ismindex.c @@ -25,6 +25,10 @@ * This step creates foo.ism and foo.ismc that is required by IIS for * serving it. * + * By adding -path-prefix path/, the produced foo.ism will refer to the + * files foo.ismv as "path/foo.ismv" - the prefix for the generated ismc + * file can be set with the -ismc-prefix option similarly. + * * To pre-split files for serving as static files by a web server without * any extra server support, create the ismv file as above, and split it: * ismindex -split foo.ismv @@ -42,7 +46,8 @@ static int usage(const char *argv0, int ret) { - fprintf(stderr, "%s [-split] [-n basename] file1 [file2] ...\n", argv0); + fprintf(stderr, "%s [-split] [-n basename] [-path-prefix prefix] " + "[-ismc-prefix prefix] file1 [file2] ...\n", argv0); return ret; } @@ -378,7 +383,8 @@ fail: } static void output_server_manifest(struct Tracks *tracks, - const char *basename) + const char *basename, const char *path_prefix, + const char *ismc_prefix) { char filename[1000]; FILE *out; @@ -394,15 +400,15 @@ static void output_server_manifest(struct Tracks *tracks, fprintf(out, "\n"); fprintf(out, "\t\n"); fprintf(out, "\t\t\n", basename); + "content=\"%s%s.ismc\" />\n", ismc_prefix, basename); fprintf(out, "\t\n"); fprintf(out, "\t\n"); fprintf(out, "\t\t\n"); for (i = 0; i < tracks->nb_tracks; i++) { struct Track *track = tracks->tracks[i]; const char *type = track->is_video ? "video" : "audio"; - fprintf(out, "\t\t\t<%s src=\"%s\" systemBitrate=\"%d\">\n", - type, track->name, track->bitrate); + fprintf(out, "\t\t\t<%s src=\"%s%s\" systemBitrate=\"%d\">\n", + type, path_prefix, track->name, track->bitrate); fprintf(out, "\t\t\t\t\n", track->track_id); fprintf(out, "\t\t\t\n", type); @@ -528,6 +534,7 @@ static void clean_tracks(struct Tracks *tracks) int main(int argc, char **argv) { const char *basename = NULL; + const char *path_prefix = "", *ismc_prefix = ""; int split = 0, i; struct Tracks tracks = { 0, .video_track = -1, .audio_track = -1 }; @@ -537,6 +544,12 @@ int main(int argc, char **argv) if (!strcmp(argv[i], "-n")) { basename = argv[i + 1]; i++; + } else if (!strcmp(argv[i], "-path-prefix")) { + path_prefix = argv[i + 1]; + i++; + } else if (!strcmp(argv[i], "-ismc-prefix")) { + ismc_prefix = argv[i + 1]; + i++; } else if (!strcmp(argv[i], "-split")) { split = 1; } else if (argv[i][0] == '-') { @@ -550,7 +563,7 @@ int main(int argc, char **argv) return usage(argv[0], 1); if (!split) - output_server_manifest(&tracks, basename); + output_server_manifest(&tracks, basename, path_prefix, ismc_prefix); output_client_manifest(&tracks, basename, split); clean_tracks(&tracks); -- cgit v1.2.3