Added detection of Macromedia Flash Video (FLV) files. A message that these files are not supported is shown.

This commit is contained in:
Moritz Bunkus 2008-08-18 20:41:40 +00:00
parent 75c5d1b25d
commit 6812799cfe
4 changed files with 82 additions and 0 deletions

46
src/input/r_flv.cpp Normal file
View File

@ -0,0 +1,46 @@
/*
mkvmerge -- utility for splicing together matroska files
from component media subtypes
Distributed under the GPL
see the file COPYING for details
or visit http://www.gnu.org/copyleft/gpl.html
$Id$
Macromedia Flash Video (FLV) demultiplexer module
Written by Moritz Bunkus <moritz@bunkus.org>.
*/
#include "os.h"
#include "common.h"
#include "r_flv.h"
int
flv_reader_c::probe_file(mm_io_c *io,
int64_t size) {
try {
if (3 > size)
return 0;
unsigned char buf[3];
io->setFilePointer(0, seek_beginning);
if (io->read(buf, 3) != 3)
return 0;
io->setFilePointer(0, seek_beginning);
if (!memcmp(buf, "FLV", 3)) {
mxerror(mxsprintf("The file '%s' is a Macromedia Flash Video (FLV) container which is not supported by mkvmerge.\n", io->get_file_name().c_str()).c_str());
// Never reached:
return 1;
}
return 0;
} catch (...) {
return 0;
}
}

32
src/input/r_flv.h Normal file
View File

@ -0,0 +1,32 @@
/*
mkvmerge -- utility for splicing together matroska files
from component media subtypes
Distributed under the GPL
see the file COPYING for details
or visit http://www.gnu.org/copyleft/gpl.html
$Id$
class definitions for the Macromedia Flash Video (FLV) demultiplexer module
Written by Moritz Bunkus <moritz@bunkus.org>.
*/
#ifndef __R_FLV_H
#define __R_FLV_H
#include "os.h"
#include "mm_io.h"
#include "pr_generic.h"
class flv_reader_c: public generic_reader_c {
public:
static int probe_file(mm_io_c *io, int64_t size);
public:
flv_reader_c(track_info_c &n_ti): generic_reader_c(n_ti) { };
};
#endif // __R_FLV_H

View File

@ -37,6 +37,7 @@ enum file_type_e {
FILE_TYPE_COREPICTURE,
FILE_TYPE_DTS,
FILE_TYPE_FLAC,
FILE_TYPE_FLV,
FILE_TYPE_MATROSKA,
FILE_TYPE_MICRODVD,
FILE_TYPE_MP3,

View File

@ -78,6 +78,7 @@
#include "r_avi.h"
#include "r_dts.h"
#include "r_flac.h"
#include "r_flv.h"
#include "r_matroska.h"
#include "r_mp3.h"
#include "r_mpeg.h"
@ -303,6 +304,8 @@ get_file_type(filelist_t &file) {
type = FILE_TYPE_IS_UNKNOWN;
if (asf_reader_c::probe_file(io, size))
type = FILE_TYPE_ASF;
else if (flv_reader_c::probe_file(io, size))
type = FILE_TYPE_FLV;
else if (avi_reader_c::probe_file(io, size))
type = FILE_TYPE_AVI;
else if (kax_reader_c::probe_file(io, size))