diff options
author | Martin Storsjö <martin@martin.st> | 2013-03-13 12:29:43 +0200 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2013-03-13 20:41:19 +0200 |
commit | 7c147900b86c0f1cf030b7b844c670649c80c191 (patch) | |
tree | 87060db5081a77b9415c34800286604882f9ec6f /tools | |
parent | f05e9beb4ab5fb8b9d5ba81405e9fca901832591 (diff) | |
download | ffmpeg-7c147900b86c0f1cf030b7b844c670649c80c191.tar.gz |
ismindex: Factorize code for printing chunk duration lists
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/ismindex.c | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/tools/ismindex.c b/tools/ismindex.c index 0a01c901d2..89b33e51ba 100644 --- a/tools/ismindex.c +++ b/tools/ismindex.c @@ -405,6 +405,23 @@ static void output_server_manifest(struct Tracks *tracks, fclose(out); } +static void print_track_chunks(FILE *out, struct Tracks *tracks, int main, + const char *type) +{ + int i, j; + struct Track *track = tracks->tracks[main]; + for (i = 0; i < track->chunks; i++) { + for (j = main + 1; j < tracks->nb_tracks; j++) { + if (tracks->tracks[j]->is_audio == track->is_audio && + track->offsets[i].duration != tracks->tracks[j]->offsets[i].duration) + fprintf(stderr, "Mismatched duration of %s chunk %d in %s and %s\n", + type, i, track->name, tracks->tracks[j]->name); + } + fprintf(out, "\t\t<c n=\"%d\" d=\"%d\" />\n", + i, track->offsets[i].duration); + } +} + static void output_client_manifest(struct Tracks *tracks, const char *basename, int split) { @@ -450,17 +467,7 @@ static void output_client_manifest(struct Tracks *tracks, fprintf(stderr, "Mismatched number of video chunks in %s and %s\n", track->name, first_track->name); } - track = first_track; - for (i = 0; i < track->chunks; i++) { - for (j = tracks->video_track + 1; j < tracks->nb_tracks; j++) { - if (tracks->tracks[j]->is_video && - track->offsets[i].duration != tracks->tracks[j]->offsets[i].duration) - fprintf(stderr, "Mismatched duration of video chunk %d in %s and %s\n", - i, track->name, tracks->tracks[j]->name); - } - fprintf(out, "\t\t<c n=\"%d\" d=\"%d\" />\n", i, - track->offsets[i].duration); - } + print_track_chunks(out, tracks, tracks->video_track, "video"); fprintf(out, "\t</StreamIndex>\n"); } if (tracks->audio_track >= 0) { @@ -491,17 +498,7 @@ static void output_client_manifest(struct Tracks *tracks, fprintf(stderr, "Mismatched number of audio chunks in %s and %s\n", track->name, first_track->name); } - track = first_track; - for (i = 0; i < track->chunks; i++) { - for (j = tracks->audio_track + 1; j < tracks->nb_tracks; j++) { - if (tracks->tracks[j]->is_audio && - track->offsets[i].duration != tracks->tracks[j]->offsets[i].duration) - fprintf(stderr, "Mismatched duration of audio chunk %d in %s and %s\n", - i, track->name, tracks->tracks[j]->name); - } - fprintf(out, "\t\t<c n=\"%d\" d=\"%d\" />\n", - i, track->offsets[i].duration); - } + print_track_chunks(out, tracks, tracks->audio_track, "audio"); fprintf(out, "\t</StreamIndex>\n"); } fprintf(out, "</SmoothStreamingMedia>\n"); |