Added support for reading OGM files. DOES NOT WORK at the moment! Vorbis not supported.

This commit is contained in:
Moritz Bunkus 2003-03-03 13:47:50 +00:00
parent c2811893b3
commit 3d7376d255
5 changed files with 478 additions and 412 deletions

View File

@ -74,9 +74,11 @@ int main ()
if test "x$no_ogg" = "x" ; then
AC_MSG_RESULT(yes)
echo '#define HAVE_OGG 1' > config.h
ifelse([$1], , :, [$1])
else
AC_MSG_RESULT(no)
echo '/*#define HAVE_OGG 1*/' > config.h
if test -f conf.oggtest ; then
:
else
@ -171,9 +173,17 @@ int main ()
if test "x$no_vorbis" = "x" ; then
AC_MSG_RESULT(yes)
echo '#define HAVE_VORBIS 1' >> config.h
if test "x$no_vorbis" = "x" ; then
echo '#define HAVE_OGGVORBIS 1' >> config.h
else
echo '/*#define HAVE_OGGVORBIS 1*/' >> config.h
fi
ifelse([$1], , :, [$1])
else
AC_MSG_RESULT(no)
echo '/*#define HAVE_VORBIS 1*/' >> config.h
echo '/*#define HAVE_OGGVORBIS 1*/' >> config.h
if test -f conf.vorbistest ; then
:
else
@ -232,9 +242,11 @@ AC_ARG_ENABLE([debug],
[ --enable-debug compile with debug information])
if test x"$enable_debug" = x"yes"; then
dnl debug information
DEBUG_CFLAGS="-g -DDEBUG"
DEBUG_CFLAGS="-g"
echo '#define DEBUG' >> config.h
else
DEBUG_CFLAGS=""
echo '/*#define DEBUG*/' >> config.h
fi
AC_SUBST(DEBUG_CFLAGS)
])

View File

@ -13,7 +13,7 @@
/*!
\file
\version \$Id: common.h,v 1.4 2003/02/16 17:04:38 mosu Exp $
\version \$Id: common.h,v 1.5 2003/03/03 13:47:50 mosu Exp $
\brief definitions used in all programs, helper functions
\author Moritz Bunkus <moritz @ bunkus.org>
*/
@ -21,7 +21,8 @@
#ifndef __COMMON_H
#define __COMMON_H
#define VERSION "0.0.1"
#include "config.h"
#define VERSIONINFO "mkvmerge v" VERSION
#define DISPLAYPRIORITY_HIGH 10

View File

@ -13,7 +13,7 @@
/*!
\file
\version \$Id: mkvmerge.cpp,v 1.18 2003/02/27 19:51:53 mosu Exp $
\version \$Id: mkvmerge.cpp,v 1.19 2003/03/03 13:47:50 mosu Exp $
\brief command line parameter parsing, looping, output handling
\author Moritz Bunkus <moritz @ bunkus.org>
*/
@ -54,6 +54,9 @@
#include "r_avi.h"
#include "r_mp3.h"
#include "r_wav.h"
#ifdef HAVE_OGGVORBIS
#include "r_ogm.h"
#endif
#ifdef DMALLOC
#include <dmalloc.h>
@ -100,7 +103,9 @@ StdIOCallback *out;
file_type_t file_types[] =
{{"---", TYPEUNKNOWN, "<unknown>"},
{"demultiplexers:", -1, ""},
// {"ogg", TYPEOGM, "general OGG media stream, Vorbis audio embedded in OGG"},
#ifdef HAVE_OGGVORBIS
{"ogg", TYPEOGM, "general OGG media stream, audio/video embedded in OGG"},
#endif // HAVE_OGGVORBIS
{"avi", TYPEAVI, "AVI (Audio/Video Interleaved)"},
{"wav", TYPEWAV, "WAVE (uncompressed PCM)"},
// {"srt", TYPESRT, "SRT text subtitles"},
@ -109,7 +114,9 @@ file_type_t file_types[] =
{"mp3", TYPEMP3, "MPEG1 layer III audio (CBR and VBR/ABR)"},
{"ac3", TYPEAC3, "A/52 (aka AC3)"},
{"output modules:", -1, ""},
// {" ", -1, "Vorbis audio"},
#ifdef HAVE_OGGVORBIS
{" ", -1, "Vorbis audio"},
#endif // HAVE_OGGVORBIS
{" ", -1, "Video (not MPEG1/2)"},
// {" ", -1, "uncompressed PCM audio"},
// {" ", -1, "text subtitles"},
@ -186,8 +193,10 @@ static int get_type(char *filename) {
return TYPEAVI;
else if (wav_reader_c::probe_file(f, size))
return TYPEWAV;
// else if (ogm_reader_c::probe_file(f, size))
// return TYPEOGM;
#ifdef HAVE_OGGVORBIS
else if (ogm_reader_c::probe_file(f, size))
return TYPEOGM;
#endif // HAVE_OGGVORBIS
// else if (srt_reader_c::probe_file(f, size))
// return TYPESRT;
else if (mp3_reader_c::probe_file(f, size))
@ -610,11 +619,12 @@ static void parse_args(int argc, char **argv) {
file->fp = NULL;
try {
switch (file->type) {
/* case TYPEOGM:
#ifdef HAVE_OGGVORBIS
case TYPEOGM:
file->reader = new ogm_reader_c(file->name, astreams, vstreams,
tstreams, &async, &range,
comments, fourcc);
break;*/
tstreams, &async, &range, fourcc);
break;
#endif // HAVE_OGGVORBIS
case TYPEAVI:
if (tstreams != NULL)
fprintf(stderr, "Warning: -t/-T are ignored for AVI files.\n");

799
r_ogm.cpp

File diff suppressed because it is too large Load Diff

44
r_ogm.h
View File

@ -1,19 +1,23 @@
/*
ogmmerge -- utility for splicing together ogg bitstreams
mkvmerge -- utility for splicing together matroska files
from component media subtypes
r_ogm.h
class definitions for the OGG demultiplexer module
Written by Moritz Bunkus <moritz@bunkus.org>
Based on Xiph.org's 'oggmerge' found in their CVS repository
See http://www.xiph.org
Distributed under the GPL
see the file COPYING for details
or visit http://www.gnu.org/copyleft/gpl.html
*/
/*!
\file
\version \$Id: r_ogm.h,v 1.5 2003/03/03 13:47:50 mosu Exp $
\brief class definitions for the OGG media stream reader
\author Moritz Bunkus <moritz @ bunkus.org>
*/
#ifndef __R_OGM_H
#define __R_OGM_H
@ -21,8 +25,8 @@
#include <ogg/ogg.h>
#include "ogmmerge.h"
#include "queue.h"
#include "common.h"
#include "pr_generic.h"
#define OGM_STREAM_TYPE_UNKNOWN 0
#define OGM_STREAM_TYPE_VORBIS 1
@ -32,7 +36,7 @@
#define OGM_STREAM_TYPE_AC3 5
#define OGM_STREAM_TYPE_TEXT 6
typedef struct ogm_demuxer_t {
typedef struct {
ogg_stream_state os;
generic_packetizer_c *packetizer;
int sid;
@ -40,7 +44,9 @@ typedef struct ogm_demuxer_t {
int eos;
int serial;
int units_processed;
ogm_demuxer_t *next;
int num_packets;
int packet_sizes[3];
void *packet_data[3];
} ogm_demuxer_t;
class ogm_reader_c: public generic_reader_c {
@ -50,28 +56,25 @@ private:
FILE *file;
char *filename;
int act_wchar;
ogm_demuxer_t *sdemuxers;
ogm_demuxer_t **sdemuxers;
int num_sdemuxers;
int nastreams, nvstreams, ntstreams, numstreams;
audio_sync_t async;
range_t range;
char **comments;
char *fourcc;
int o_eos;
int o_eos, bos_pages_read;
public:
ogm_reader_c(char *fname, unsigned char *astreams,
unsigned char *vstreams, unsigned char *tstreams,
audio_sync_t *nasync, range_t *nrange, char **ncomments,
char *nfourcc) throw (error_c);
audio_sync_t *nasync, range_t *nrange, char *nfourcc)
throw (error_c);
virtual ~ogm_reader_c();
virtual int read();
virtual int serial_in_use(int);
virtual ogmmerge_page_t *get_page();
virtual ogmmerge_page_t *get_header_page(int header_type =
PACKET_TYPE_HEADER);
virtual packet_t *get_packet();
virtual void reset();
virtual int display_priority();
virtual void display_progress();
@ -83,12 +86,15 @@ public:
private:
virtual ogm_demuxer_t *find_demuxer(int serialno);
virtual int demuxing_requested(unsigned char *, int);
virtual void flush_packetizers();
virtual int read_page(ogg_page *);
virtual void add_new_demuxer(ogm_demuxer_t *);
virtual int pages_available();
virtual void handle_new_stream(ogg_page *);
virtual void process_page(ogg_page *);
virtual int packet_available();
virtual int read_headers();
virtual void process_header_page(ogg_page *);
virtual void create_packetizers();
virtual void free_demuxer(int);
};