2003-02-16 00:05:07 +00:00
|
|
|
/*
|
2003-03-03 13:47:50 +00:00
|
|
|
mkvmerge -- utility for splicing together matroska files
|
2003-02-16 00:05:07 +00:00
|
|
|
from component media subtypes
|
|
|
|
|
|
|
|
r_ogm.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
|
|
|
|
*/
|
|
|
|
|
2003-03-03 13:47:50 +00:00
|
|
|
/*!
|
|
|
|
\file
|
2003-03-03 23:20:44 +00:00
|
|
|
\version \$Id: r_ogm.h,v 1.6 2003/03/03 23:20:44 mosu Exp $
|
2003-03-03 13:47:50 +00:00
|
|
|
\brief class definitions for the OGG media stream reader
|
|
|
|
\author Moritz Bunkus <moritz @ bunkus.org>
|
|
|
|
*/
|
|
|
|
|
2003-02-26 19:20:26 +00:00
|
|
|
#ifndef __R_OGM_H
|
|
|
|
#define __R_OGM_H
|
2003-02-16 00:05:07 +00:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include <ogg/ogg.h>
|
|
|
|
|
2003-03-03 13:47:50 +00:00
|
|
|
#include "common.h"
|
|
|
|
#include "pr_generic.h"
|
2003-02-16 00:05:07 +00:00
|
|
|
|
|
|
|
#define OGM_STREAM_TYPE_UNKNOWN 0
|
|
|
|
#define OGM_STREAM_TYPE_VORBIS 1
|
|
|
|
#define OGM_STREAM_TYPE_VIDEO 2
|
|
|
|
#define OGM_STREAM_TYPE_PCM 3
|
|
|
|
#define OGM_STREAM_TYPE_MP3 4
|
|
|
|
#define OGM_STREAM_TYPE_AC3 5
|
|
|
|
#define OGM_STREAM_TYPE_TEXT 6
|
|
|
|
|
2003-03-03 13:47:50 +00:00
|
|
|
typedef struct {
|
2003-02-16 00:05:07 +00:00
|
|
|
ogg_stream_state os;
|
|
|
|
generic_packetizer_c *packetizer;
|
|
|
|
int sid;
|
|
|
|
int stype;
|
|
|
|
int eos;
|
|
|
|
int serial;
|
|
|
|
int units_processed;
|
2003-03-03 13:47:50 +00:00
|
|
|
int num_packets;
|
|
|
|
int packet_sizes[3];
|
|
|
|
void *packet_data[3];
|
2003-03-03 23:20:44 +00:00
|
|
|
int vorbis_rate;
|
2003-02-16 00:05:07 +00:00
|
|
|
} ogm_demuxer_t;
|
|
|
|
|
|
|
|
class ogm_reader_c: public generic_reader_c {
|
2003-02-27 09:52:37 +00:00
|
|
|
private:
|
2003-02-26 19:20:26 +00:00
|
|
|
ogg_sync_state oy;
|
|
|
|
unsigned char *astreams, *vstreams, *tstreams;
|
|
|
|
FILE *file;
|
|
|
|
char *filename;
|
|
|
|
int act_wchar;
|
2003-03-03 13:47:50 +00:00
|
|
|
ogm_demuxer_t **sdemuxers;
|
|
|
|
int num_sdemuxers;
|
2003-02-26 19:20:26 +00:00
|
|
|
int nastreams, nvstreams, ntstreams, numstreams;
|
|
|
|
audio_sync_t async;
|
|
|
|
range_t range;
|
|
|
|
char **comments;
|
|
|
|
char *fourcc;
|
2003-03-03 13:47:50 +00:00
|
|
|
int o_eos, bos_pages_read;
|
2003-02-16 00:05:07 +00:00
|
|
|
|
2003-02-27 09:52:37 +00:00
|
|
|
public:
|
2003-02-26 19:20:26 +00:00
|
|
|
ogm_reader_c(char *fname, unsigned char *astreams,
|
|
|
|
unsigned char *vstreams, unsigned char *tstreams,
|
2003-03-03 13:47:50 +00:00
|
|
|
audio_sync_t *nasync, range_t *nrange, char *nfourcc)
|
|
|
|
throw (error_c);
|
2003-02-26 19:20:26 +00:00
|
|
|
virtual ~ogm_reader_c();
|
2003-02-16 00:05:07 +00:00
|
|
|
|
2003-02-26 19:20:26 +00:00
|
|
|
virtual int read();
|
2003-03-03 13:47:50 +00:00
|
|
|
virtual packet_t *get_packet();
|
2003-02-16 00:05:07 +00:00
|
|
|
|
2003-02-26 19:20:26 +00:00
|
|
|
virtual int display_priority();
|
|
|
|
virtual void display_progress();
|
|
|
|
|
|
|
|
virtual void overwrite_eos(int no_eos);
|
|
|
|
virtual generic_packetizer_c *set_packetizer(generic_packetizer_c *np);
|
|
|
|
|
|
|
|
static int probe_file(FILE *file, u_int64_t size);
|
2003-02-16 00:05:07 +00:00
|
|
|
|
2003-02-27 09:52:37 +00:00
|
|
|
private:
|
2003-02-26 19:20:26 +00:00
|
|
|
virtual ogm_demuxer_t *find_demuxer(int serialno);
|
|
|
|
virtual int demuxing_requested(unsigned char *, int);
|
|
|
|
virtual int read_page(ogg_page *);
|
|
|
|
virtual void add_new_demuxer(ogm_demuxer_t *);
|
|
|
|
virtual void handle_new_stream(ogg_page *);
|
|
|
|
virtual void process_page(ogg_page *);
|
2003-03-03 13:47:50 +00:00
|
|
|
virtual int packet_available();
|
|
|
|
virtual int read_headers();
|
|
|
|
virtual void process_header_page(ogg_page *);
|
|
|
|
virtual void create_packetizers();
|
|
|
|
virtual void free_demuxer(int);
|
2003-02-16 00:05:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-02-26 19:20:26 +00:00
|
|
|
#endif // __R_OGM_H
|