[FFmpeg-cvslog] ismindex: Verify that all bitrate variants match

Martin Storsjö git at videolan.org
Wed Jul 4 21:09:46 CEST 2012


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Tue Jul  3 14:58:52 2012 +0300| [30327865f388260e49d40affd1b9c9fc2e20ebfe] | committer: Martin Storsjö

ismindex: Verify that all bitrate variants match

In Smooth Streaming, the fragments are addressed by time, and
the manifest only stores one list of time offests for all streams,
so all streams need to have identical fragment offsets. Warn if
this isn't the case, so that the user can fix the files instead of
getting failures at runtime when the fragments can't be found.

Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=30327865f388260e49d40affd1b9c9fc2e20ebfe
---

 tools/ismindex.c |   30 ++++++++++++++++++++++++++----
 1 file changed, 26 insertions(+), 4 deletions(-)

diff --git a/tools/ismindex.c b/tools/ismindex.c
index 1614cca..54c49dc 100644
--- a/tools/ismindex.c
+++ b/tools/ismindex.c
@@ -426,6 +426,7 @@ static void output_client_manifest(struct VideoFiles *files,
                  "Duration=\"%"PRId64 "\">\n", files->duration * 10);
     if (files->video_file >= 0) {
         struct VideoFile *vf = files->files[files->video_file];
+        struct VideoFile *first_vf = vf;
         int index = 0;
         fprintf(out,
                 "\t<StreamIndex Type=\"video\" QualityLevels=\"%d\" "
@@ -445,15 +446,26 @@ static void output_client_manifest(struct VideoFiles *files,
                 fprintf(out, "%02X", vf->codec_private[j]);
             fprintf(out, "\" />\n");
             index++;
+            if (vf->chunks != first_vf->chunks)
+                fprintf(stderr, "Mismatched number of video chunks in %s and %s\n",
+                        vf->name, first_vf->name);
         }
-        vf = files->files[files->video_file];
-        for (i = 0; i < vf->chunks; i++)
+        vf = first_vf;
+        for (i = 0; i < vf->chunks; i++) {
+            for (j = files->video_file + 1; j < files->nb_files; j++) {
+                if (files->files[j]->is_video &&
+                    vf->offsets[i].duration != files->files[j]->offsets[i].duration)
+                    fprintf(stderr, "Mismatched duration of video chunk %d in %s and %s\n",
+                            i, vf->name, files->files[j]->name);
+            }
             fprintf(out, "\t\t<c n=\"%d\" d=\"%d\" />\n", i,
                     vf->offsets[i].duration);
+        }
         fprintf(out, "\t</StreamIndex>\n");
     }
     if (files->audio_file >= 0) {
         struct VideoFile *vf = files->files[files->audio_file];
+        struct VideoFile *first_vf = vf;
         int index = 0;
         fprintf(out,
                 "\t<StreamIndex Type=\"audio\" QualityLevels=\"%d\" "
@@ -475,11 +487,21 @@ static void output_client_manifest(struct VideoFiles *files,
                 fprintf(out, "%02X", vf->codec_private[j]);
             fprintf(out, "\" />\n");
             index++;
+            if (vf->chunks != first_vf->chunks)
+                fprintf(stderr, "Mismatched number of audio chunks in %s and %s\n",
+                        vf->name, first_vf->name);
         }
-        vf = files->files[files->audio_file];
-        for (i = 0; i < vf->chunks; i++)
+        vf = first_vf;
+        for (i = 0; i < vf->chunks; i++) {
+            for (j = files->audio_file + 1; j < files->nb_files; j++) {
+                if (files->files[j]->is_audio &&
+                    vf->offsets[i].duration != files->files[j]->offsets[i].duration)
+                    fprintf(stderr, "Mismatched duration of audio chunk %d in %s and %s\n",
+                            i, vf->name, files->files[j]->name);
+            }
             fprintf(out, "\t\t<c n=\"%d\" d=\"%d\" />\n",
                     i, vf->offsets[i].duration);
+        }
         fprintf(out, "\t</StreamIndex>\n");
     }
     fprintf(out, "</SmoothStreamingMedia>\n");



More information about the ffmpeg-cvslog mailing list