summaryrefslogtreecommitdiff
path: root/tools/ismindex.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-07-04 20:39:50 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-07-04 21:03:28 +0200
commit039e9fe01ca27606a0ec1a944d51041541e10aab (patch)
tree9fc96837e878cdb2c13b6016d9f3d69785570488 /tools/ismindex.c
parent8b421fad24acbba69935caf2a2775bd04f8a707a (diff)
parent7c29377b702783680b223a12503df784b1808086 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: (29 commits) lavfi: reclassify showfiltfmts as a TESTPROG graph2dot: fix printf format specifier swscale: yuv2planeX 8bit >=sse2 functions need aligned stack on x86-32. vp8: loopfilter >=sse2 functions need aligned stack on x86-32. amr: remove shift out of the AMR_BIT() macro. dsputilenc: group yasm and inline asm function pointer assignment. mov: use forward declaration of a function instead of a table. Clarify Doxygen comment for FF_API_* #defines. configure: simplify get_version() Create version.h headers for libraries that lack them gitignore: Use full path instead of relative path to specify patterns mpegvideo: remove VLAs Add XTEA encryption support in libavutil Add Blowfish encryption support in libavutil eval: Add the isinf() function and tests for it flacdec: move lpc filter to flacdsp flacdec: split off channel decorrelation as flacdsp avplay: Add an option for not limiting the input buffer size FATE: add a test for WMA cover art. FATE: add a test for apetag cover art ... Conflicts: .gitignore configure ffplay.c libavcodec/Makefile libavcodec/error_resilience.c libavcodec/mpegvideo.c libavcodec/ratecontrol.c libavdevice/avdevice.h libavfilter/Makefile libavfilter/filtfmts.c libavfilter/version.h libavformat/mov.c libavformat/version.h libavutil/Makefile libavutil/avutil.h libavutil/version.h libswscale/swscale.h libswscale/x86/swscale_mmx.c tests/fate/libavutil.mak tests/lavfi-regression.sh tools/graph2dot.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'tools/ismindex.c')
-rw-r--r--tools/ismindex.c45
1 files changed, 37 insertions, 8 deletions
diff --git a/tools/ismindex.c b/tools/ismindex.c
index a30feb1fcb..1fc7c239da 100644
--- a/tools/ismindex.c
+++ b/tools/ismindex.c
@@ -209,10 +209,14 @@ static int read_mfra(struct VideoFiles *files, int start_index,
avio_seek(f, avio_size(f) - 4, SEEK_SET);
mfra_size = avio_rb32(f);
avio_seek(f, -mfra_size, SEEK_CUR);
- if (avio_rb32(f) != mfra_size)
+ if (avio_rb32(f) != mfra_size) {
+ err = AVERROR_INVALIDDATA;
goto fail;
- if (avio_rb32(f) != MKBETAG('m', 'f', 'r', 'a'))
+ }
+ if (avio_rb32(f) != MKBETAG('m', 'f', 'r', 'a')) {
+ err = AVERROR_INVALIDDATA;
goto fail;
+ }
while (!read_tfra(files, start_index, f)) {
/* Empty */
}
@@ -223,6 +227,8 @@ static int read_mfra(struct VideoFiles *files, int start_index,
fail:
if (f)
avio_close(f);
+ if (err)
+ fprintf(stderr, "Unable to read the MFRA atom in %s\n", file);
return err;
}
@@ -355,7 +361,7 @@ static int handle_file(struct VideoFiles *files, const char *file, int split)
avformat_close_input(&ctx);
- read_mfra(files, orig_files, file, split);
+ err = read_mfra(files, orig_files, file, split);
fail:
if (ctx)
@@ -420,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\" "
@@ -439,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\" "
@@ -469,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");
@@ -509,7 +537,8 @@ int main(int argc, char **argv)
} else if (argv[i][0] == '-') {
return usage(argv[0], 1);
} else {
- handle_file(&vf, argv[i], split);
+ if (handle_file(&vf, argv[i], split))
+ return 1;
}
}
if (!vf.nb_files || (!basename && !split))