Added checks for MP4/Quicktime. mkvmerge will abort if it encounters one of those in order to prohibit mkvmerge from falsely recogzining them as AAC files.

This commit is contained in:
Moritz Bunkus 2003-05-22 15:37:53 +00:00
parent e182f0191d
commit 2c7dfa512e
5 changed files with 84 additions and 1 deletions

View File

@ -1,5 +1,7 @@
2003-05-22 Moritz Bunkus <moritz@bunkus.org>
* Added checks for MP4/Quicktime files which will abort mkvmerge.
* Support for reading AAC tracks from Matroska files.
* Released v0.4.0.

View File

@ -29,6 +29,7 @@ mkvmerge_SOURCES = mkvmerge.cpp mkvmerge.h \
r_dts.cpp r_dts.h \
r_matroska.cpp r_matroska.h \
r_mp3.cpp r_mp3.h \
r_mp4.cpp r_mp4.h \
r_srt.cpp r_srt.h \
r_ogm.cpp r_ogm.h \
r_wav.cpp r_wav.h \

View File

@ -13,7 +13,7 @@
/*!
\file
\version \$Id: mkvmerge.cpp,v 1.74 2003/05/22 11:10:40 mosu Exp $
\version \$Id: mkvmerge.cpp,v 1.75 2003/05/22 15:37:53 mosu Exp $
\brief command line parameter parsing, looping, output handling
\author Moritz Bunkus <moritz@bunkus.org>
*/
@ -75,6 +75,7 @@
#endif
#include "r_srt.h"
#include "r_matroska.h"
#include "r_mp4.h"
using namespace LIBMATROSKA_NAMESPACE;
using namespace std;
@ -331,6 +332,11 @@ static int get_type(char *filename) {
type = TYPEMATROSKA;
else if (wav_reader_c::probe_file(f, size))
type = TYPEWAV;
else if (mp4_reader_c::probe_file(f, size)) {
fprintf(stderr, "Error: MP4/Quicktime files are not supported (%s).\n",
filename);
exit(1);
}
#ifdef HAVE_OGGVORBIS
else if (ogm_reader_c::probe_file(f, size))
type = TYPEOGM;

43
r_mp4.cpp Normal file
View File

@ -0,0 +1,43 @@
/*
mkvmerge -- utility for splicing together matroska files
from component media subtypes
r_mp4.cpp
Written by Moritz Bunkus <moritz@bunkus.org>
Distributed under the GPL
see the file COPYING for details
or visit http://www.gnu.org/copyleft/gpl.html
*/
/*!
\file
\version \$Id: r_mp4.cpp,v 1.1 2003/05/22 15:37:53 mosu Exp $
\brief MP4 identification class
\author Moritz Bunkus <moritz@bunkus.org>
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "r_mp4.h"
int mp4_reader_c::probe_file(FILE *file, int64_t size) {
unsigned char data[20];
if (size < 20)
return 0;
if (fseek(file, 0, SEEK_SET) != 0)
return 0;
if (fread(data, 1, 20, file) != 20) {
fseek(file, 0, SEEK_SET);
return 0;
}
fseek(file, 0, SEEK_SET);
if ((data[4] != 'f') || (data[5] != 't') ||
(data[6] != 'y') || (data[7] != 'p'))
return 0;
return 1;
}

31
r_mp4.h Normal file
View File

@ -0,0 +1,31 @@
/*
mkvmerge -- utility for splicing together matroska files
from component media subtypes
r_mp4.h
Written by Moritz Bunkus <moritz@bunkus.org>
Distributed under the GPL
see the file COPYING for details
or visit http://www.gnu.org/copyleft/gpl.html
*/
/*!
\file
\version \$Id: r_mp4.h,v 1.1 2003/05/22 15:37:53 mosu Exp $
\brief class definitions for the dummy MP4 reader
\author Moritz Bunkus <moritz@bunkus.org>
*/
#ifndef __R_MP4_H
#define __R_MP4_H
#include <stdio.h>
class mp4_reader_c {
public:
static int probe_file(FILE *file, int64_t size);
};
#endif // __R_MP4_H