mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-24 11:54:01 +00:00
Reversed the relationship between q_c and generic_packetizer_c: q_c is now the father of generic_packetizer_c.
This commit is contained in:
parent
12c4954fc7
commit
08efd315f9
@ -13,7 +13,7 @@
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: cluster_helper.cpp,v 1.1 2003/04/18 10:08:24 mosu Exp $
|
||||
\version \$Id: cluster_helper.cpp,v 1.2 2003/04/18 10:28:14 mosu Exp $
|
||||
\brief cluster helper
|
||||
\author Moritz Bunkus <moritz @ bunkus.org>
|
||||
*/
|
||||
@ -180,7 +180,8 @@ int cluster_helper_c::render(IOCallback *out) {
|
||||
|
||||
pack->data_buffer = new DataBuffer((binary *)pack->data, pack->length);
|
||||
KaxTrackEntry &track_entry =
|
||||
static_cast<KaxTrackEntry &>(*pack->source->track_entry);
|
||||
static_cast<KaxTrackEntry &>
|
||||
(*((generic_packetizer_c *)pack->source)->track_entry);
|
||||
|
||||
if (pack->bref != 0) { // P and B frames: add backward reference.
|
||||
bref_packet = find_packet(pack->bref);
|
||||
@ -294,7 +295,7 @@ int cluster_helper_c::free_clusters() {
|
||||
for (i = 0; i < num_clusters; i++) {
|
||||
for (k = 0; k < clusters[i]->num_packets; k++) {
|
||||
p = clusters[i]->packets[k];
|
||||
if (p->source->get_free_refs() >= p->id)
|
||||
if (((generic_packetizer_c *)p->source)->get_free_refs() >= p->id)
|
||||
p->superseeded = 1;
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: p_ac3.cpp,v 1.10 2003/04/18 10:08:24 mosu Exp $
|
||||
\version \$Id: p_ac3.cpp,v 1.11 2003/04/18 10:28:14 mosu Exp $
|
||||
\brief AC3 output module
|
||||
\author Moritz Bunkus <moritz @ bunkus.org>
|
||||
*/
|
||||
@ -24,7 +24,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include "mkvmerge.h"
|
||||
#include "queue.h"
|
||||
#include "pr_generic.h"
|
||||
#include "ac3_common.h"
|
||||
#include "p_ac3.h"
|
||||
|
||||
@ -37,8 +37,7 @@
|
||||
|
||||
ac3_packetizer_c::ac3_packetizer_c(unsigned long nsamples_per_sec,
|
||||
int nchannels, track_info_t *nti)
|
||||
throw (error_c):
|
||||
q_c(nti) {
|
||||
throw (error_c): generic_packetizer_c(nti) {
|
||||
packetno = 0;
|
||||
bytes_output = 0;
|
||||
packet_buffer = NULL;
|
||||
|
6
p_ac3.h
6
p_ac3.h
@ -13,7 +13,7 @@
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: p_ac3.h,v 1.9 2003/04/13 15:23:02 mosu Exp $
|
||||
\version \$Id: p_ac3.h,v 1.10 2003/04/18 10:28:14 mosu Exp $
|
||||
\brief class definition for the AC3 output module
|
||||
\author Moritz Bunkus <moritz @ bunkus.org>
|
||||
*/
|
||||
@ -22,10 +22,10 @@
|
||||
#define __P_AC3_H
|
||||
|
||||
#include "common.h"
|
||||
#include "queue.h"
|
||||
#include "pr_generic.h"
|
||||
#include "ac3_common.h"
|
||||
|
||||
class ac3_packetizer_c: public q_c {
|
||||
class ac3_packetizer_c: public generic_packetizer_c {
|
||||
private:
|
||||
int64_t bytes_output, packetno;
|
||||
unsigned long samples_per_sec;
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: p_mp3.cpp,v 1.12 2003/04/18 10:08:24 mosu Exp $
|
||||
\version \$Id: p_mp3.cpp,v 1.13 2003/04/18 10:28:14 mosu Exp $
|
||||
\brief MP3 output module
|
||||
\author Moritz Bunkus <moritz @ bunkus.org>
|
||||
*/
|
||||
@ -24,7 +24,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include "mkvmerge.h"
|
||||
#include "queue.h"
|
||||
#include "pr_generic.h"
|
||||
#include "mp3_common.h"
|
||||
#include "p_mp3.h"
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
|
||||
mp3_packetizer_c::mp3_packetizer_c(unsigned long nsamples_per_sec,
|
||||
int nchannels, track_info_t *nti)
|
||||
throw (error_c): q_c(nti) {
|
||||
throw (error_c): generic_packetizer_c(nti) {
|
||||
samples_per_sec = nsamples_per_sec;
|
||||
channels = nchannels;
|
||||
bytes_output = 0;
|
||||
|
6
p_mp3.h
6
p_mp3.h
@ -13,7 +13,7 @@
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: p_mp3.h,v 1.9 2003/04/13 15:23:02 mosu Exp $
|
||||
\version \$Id: p_mp3.h,v 1.10 2003/04/18 10:28:14 mosu Exp $
|
||||
\brief class definition for the MP3 output module
|
||||
\author Moritz Bunkus <moritz @ bunkus.org>
|
||||
*/
|
||||
@ -22,10 +22,10 @@
|
||||
#define __P_MP3_H
|
||||
|
||||
#include "common.h"
|
||||
#include "queue.h"
|
||||
#include "pr_generic.h"
|
||||
#include "mp3_common.h"
|
||||
|
||||
class mp3_packetizer_c: public q_c {
|
||||
class mp3_packetizer_c: public generic_packetizer_c {
|
||||
private:
|
||||
int64_t bytes_output, packetno;
|
||||
unsigned long samples_per_sec;
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: p_pcm.cpp,v 1.11 2003/04/18 10:08:24 mosu Exp $
|
||||
\version \$Id: p_pcm.cpp,v 1.12 2003/04/18 10:28:14 mosu Exp $
|
||||
\brief PCM output module
|
||||
\author Moritz Bunkus <moritz @ bunkus.org>
|
||||
*/
|
||||
@ -25,7 +25,7 @@
|
||||
|
||||
#include "mkvmerge.h"
|
||||
#include "common.h"
|
||||
#include "queue.h"
|
||||
#include "pr_generic.h"
|
||||
#include "p_pcm.h"
|
||||
|
||||
#include "KaxTracks.h"
|
||||
@ -38,7 +38,7 @@
|
||||
pcm_packetizer_c::pcm_packetizer_c(unsigned long nsamples_per_sec,
|
||||
int nchannels, int nbits_per_sample,
|
||||
track_info_t *nti) throw (error_c):
|
||||
q_c(nti) {
|
||||
generic_packetizer_c(nti) {
|
||||
packetno = 0;
|
||||
bps = nchannels * nbits_per_sample * nsamples_per_sec / 8;
|
||||
tempbuf = (unsigned char *)malloc(bps + 128);
|
||||
|
6
p_pcm.h
6
p_pcm.h
@ -13,7 +13,7 @@
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: p_pcm.h,v 1.10 2003/04/13 15:23:03 mosu Exp $
|
||||
\version \$Id: p_pcm.h,v 1.11 2003/04/18 10:28:14 mosu Exp $
|
||||
\brief class definition for the PCM output module
|
||||
\author Moritz Bunkus <moritz @ bunkus.org>
|
||||
*/
|
||||
@ -22,9 +22,9 @@
|
||||
#define __P_PCM_H
|
||||
|
||||
#include "common.h"
|
||||
#include "queue.h"
|
||||
#include "pr_generic.h"
|
||||
|
||||
class pcm_packetizer_c: public q_c {
|
||||
class pcm_packetizer_c: public generic_packetizer_c {
|
||||
private:
|
||||
int packetno;
|
||||
int bps, channels, bits_per_sample;
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: p_textsubs.cpp,v 1.3 2003/04/18 10:08:24 mosu Exp $
|
||||
\version \$Id: p_textsubs.cpp,v 1.4 2003/04/18 10:28:14 mosu Exp $
|
||||
\brief Subripper subtitle reader
|
||||
\author Moritz Bunkus <moritz @ bunkus.org>
|
||||
*/
|
||||
@ -36,7 +36,7 @@
|
||||
#endif
|
||||
|
||||
textsubs_packetizer_c::textsubs_packetizer_c(track_info_t *nti)
|
||||
throw (error_c): q_c(nti) {
|
||||
throw (error_c): generic_packetizer_c(nti) {
|
||||
packetno = 0;
|
||||
set_header();
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: p_textsubs.h,v 1.2 2003/04/11 11:23:54 mosu Exp $
|
||||
\version \$Id: p_textsubs.h,v 1.3 2003/04/18 10:28:14 mosu Exp $
|
||||
\brief class definition for the simple text subtitle packetizer
|
||||
\author Moritz Bunkus <moritz @ bunkus.org>
|
||||
*/
|
||||
@ -23,9 +23,9 @@
|
||||
|
||||
#include "common.h"
|
||||
#include "pr_generic.h"
|
||||
#include "queue.h"
|
||||
#include "pr_generic.h"
|
||||
|
||||
class textsubs_packetizer_c: public q_c {
|
||||
class textsubs_packetizer_c: public generic_packetizer_c {
|
||||
private:
|
||||
int packetno;
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: p_video.cpp,v 1.19 2003/04/18 10:08:24 mosu Exp $
|
||||
\version \$Id: p_video.cpp,v 1.20 2003/04/18 10:28:14 mosu Exp $
|
||||
\brief video output module
|
||||
\author Moritz Bunkus <moritz @ bunkus.org>
|
||||
*/
|
||||
@ -26,7 +26,7 @@
|
||||
|
||||
#include "mkvmerge.h"
|
||||
#include "common.h"
|
||||
#include "queue.h"
|
||||
#include "pr_generic.h"
|
||||
#include "p_video.h"
|
||||
|
||||
#include "KaxTracks.h"
|
||||
@ -40,7 +40,7 @@
|
||||
video_packetizer_c::video_packetizer_c(double nfps, int nwidth,
|
||||
int nheight, int nbpp,
|
||||
int navi_compat_mode, track_info_t *nti)
|
||||
throw (error_c) : q_c(nti) {
|
||||
throw (error_c) : generic_packetizer_c(nti) {
|
||||
packetno = 0;
|
||||
fps = nfps;
|
||||
width = nwidth;
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: p_video.h,v 1.17 2003/04/13 15:23:03 mosu Exp $
|
||||
\version \$Id: p_video.h,v 1.18 2003/04/18 10:28:14 mosu Exp $
|
||||
\brief class definition for the video output module
|
||||
\author Moritz Bunkus <moritz @ bunkus.org>
|
||||
*/
|
||||
@ -22,14 +22,14 @@
|
||||
#define __P_VIDEO_H
|
||||
|
||||
#include "common.h"
|
||||
#include "queue.h"
|
||||
#include "pr_generic.h"
|
||||
|
||||
#define VFT_IFRAME 0x10000000L
|
||||
#define VFT_PFRAME 0x20000000L
|
||||
#define VFT_BFRAME 0x40000000L
|
||||
#define VNUMFRAMES 0x0000FFFFL
|
||||
|
||||
class video_packetizer_c: public q_c {
|
||||
class video_packetizer_c: public generic_packetizer_c {
|
||||
private:
|
||||
double fps;
|
||||
int width, height, bpp, packetno;
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: p_vorbis.cpp,v 1.9 2003/04/18 10:08:24 mosu Exp $
|
||||
\version \$Id: p_vorbis.cpp,v 1.10 2003/04/18 10:28:14 mosu Exp $
|
||||
\brief Vorbis packetizer
|
||||
\author Moritz Bunkus <moritz @ bunkus.org>
|
||||
*/
|
||||
@ -49,7 +49,7 @@ vorbis_packetizer_c::vorbis_packetizer_c(unsigned char *d_header, int l_header,
|
||||
int l_comments,
|
||||
unsigned char *d_codecsetup,
|
||||
int l_codecsetup, track_info_t *nti)
|
||||
throw (error_c): q_c(nti) {
|
||||
throw (error_c): generic_packetizer_c(nti) {
|
||||
int i;
|
||||
|
||||
packetno = 0;
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: p_vorbis.h,v 1.7 2003/04/13 15:23:03 mosu Exp $
|
||||
\version \$Id: p_vorbis.h,v 1.8 2003/04/18 10:28:14 mosu Exp $
|
||||
\brief class definition for the Vorbis packetizer
|
||||
\author Moritz Bunkus <moritz @ bunkus.org>
|
||||
*/
|
||||
@ -30,9 +30,9 @@
|
||||
|
||||
#include "common.h"
|
||||
#include "pr_generic.h"
|
||||
#include "queue.h"
|
||||
#include "pr_generic.h"
|
||||
|
||||
class vorbis_packetizer_c: public q_c {
|
||||
class vorbis_packetizer_c: public generic_packetizer_c {
|
||||
private:
|
||||
int64_t last_bs, samples;
|
||||
int packetno;
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: pr_generic.cpp,v 1.19 2003/04/18 10:08:24 mosu Exp $
|
||||
\version \$Id: pr_generic.cpp,v 1.20 2003/04/18 10:28:14 mosu Exp $
|
||||
\brief functions common for all readers/packetizers
|
||||
\author Moritz Bunkus <moritz @ bunkus.org>
|
||||
*/
|
||||
@ -23,7 +23,8 @@
|
||||
#include "common.h"
|
||||
#include "pr_generic.h"
|
||||
|
||||
generic_packetizer_c::generic_packetizer_c(track_info_t *nti) {
|
||||
generic_packetizer_c::generic_packetizer_c(track_info_t *nti) throw(error_c):
|
||||
q_c() {
|
||||
serialno = -1;
|
||||
track_entry = NULL;
|
||||
ti = duplicate_track_info(nti);
|
||||
|
25
pr_generic.h
25
pr_generic.h
@ -13,7 +13,7 @@
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: pr_generic.h,v 1.20 2003/04/18 10:08:24 mosu Exp $
|
||||
\version \$Id: pr_generic.h,v 1.21 2003/04/18 10:28:14 mosu Exp $
|
||||
\brief class definition for the generic reader and packetizer
|
||||
\author Moritz Bunkus <moritz @ bunkus.org>
|
||||
*/
|
||||
@ -25,9 +25,10 @@
|
||||
#include "KaxCluster.h"
|
||||
#include "KaxTracks.h"
|
||||
|
||||
using namespace LIBMATROSKA_NAMESPACE;
|
||||
#include "error.h"
|
||||
#include "queue.h"
|
||||
|
||||
class generic_packetizer_c;
|
||||
using namespace LIBMATROSKA_NAMESPACE;
|
||||
|
||||
typedef struct {
|
||||
int displacement;
|
||||
@ -48,18 +49,7 @@ typedef struct {
|
||||
audio_sync_t async;
|
||||
} track_info_t;
|
||||
|
||||
typedef struct packet_t {
|
||||
DataBuffer *data_buffer;
|
||||
KaxBlockGroup *group;
|
||||
KaxBlock *block;
|
||||
KaxCluster *cluster;
|
||||
unsigned char *data;
|
||||
int length, superseeded;
|
||||
int64_t timecode, id, bref, fref;
|
||||
generic_packetizer_c *source;
|
||||
} packet_t;
|
||||
|
||||
class generic_packetizer_c {
|
||||
class generic_packetizer_c: public q_c {
|
||||
protected:
|
||||
int serialno;
|
||||
track_info_t *ti;
|
||||
@ -67,14 +57,11 @@ protected:
|
||||
public:
|
||||
KaxTrackEntry *track_entry;
|
||||
|
||||
generic_packetizer_c(track_info_t *nti);
|
||||
generic_packetizer_c(track_info_t *nti) throw (error_c);
|
||||
virtual ~generic_packetizer_c();
|
||||
virtual void set_free_refs(int64_t nfree_refs);
|
||||
virtual int64_t get_free_refs();
|
||||
virtual int packet_available() = 0;
|
||||
virtual packet_t *get_packet() = 0;
|
||||
virtual void set_header() = 0;
|
||||
virtual int64_t get_smallest_timecode() = 0;
|
||||
virtual int process(unsigned char *data, int size,
|
||||
int64_t timecode = -1, int64_t length = -1) = 0;
|
||||
};
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: queue.cpp,v 1.13 2003/04/18 10:08:24 mosu Exp $
|
||||
\version \$Id: queue.cpp,v 1.14 2003/04/18 10:28:14 mosu Exp $
|
||||
\brief packet queueing class used by every packetizer
|
||||
\author Moritz Bunkus <moritz @ bunkus.org>
|
||||
*/
|
||||
@ -33,7 +33,7 @@
|
||||
|
||||
int64_t q_c::id = 1;
|
||||
|
||||
q_c::q_c(track_info_t *nti) throw (error_c) : generic_packetizer_c(nti) {
|
||||
q_c::q_c() {
|
||||
first = NULL;
|
||||
current = NULL;
|
||||
}
|
||||
|
24
queue.h
24
queue.h
@ -13,7 +13,7 @@
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: queue.h,v 1.11 2003/04/18 10:08:24 mosu Exp $
|
||||
\version \$Id: queue.h,v 1.12 2003/04/18 10:28:14 mosu Exp $
|
||||
\brief class definition for the queueing class
|
||||
\author Moritz Bunkus <moritz @ bunkus.org>
|
||||
*/
|
||||
@ -21,8 +21,22 @@
|
||||
#ifndef __QUEUE_H
|
||||
#define __QUEUE_H
|
||||
|
||||
#include "error.h"
|
||||
#include "pr_generic.h"
|
||||
#include "KaxBlock.h"
|
||||
#include "KaxCluster.h"
|
||||
#include "KaxTracks.h"
|
||||
|
||||
using namespace LIBMATROSKA_NAMESPACE;
|
||||
|
||||
typedef struct packet_t {
|
||||
DataBuffer *data_buffer;
|
||||
KaxBlockGroup *group;
|
||||
KaxBlock *block;
|
||||
KaxCluster *cluster;
|
||||
unsigned char *data;
|
||||
int length, superseeded;
|
||||
int64_t timecode, id, bref, fref;
|
||||
void *source;
|
||||
} packet_t;
|
||||
|
||||
// q_page_t is used internally only
|
||||
typedef struct q_page {
|
||||
@ -30,13 +44,13 @@ typedef struct q_page {
|
||||
struct q_page *next;
|
||||
} q_page_t;
|
||||
|
||||
class q_c: public generic_packetizer_c {
|
||||
class q_c {
|
||||
private:
|
||||
static int64_t id;
|
||||
struct q_page *first, *current;
|
||||
|
||||
public:
|
||||
q_c(track_info_t *nti) throw (error_c);
|
||||
q_c();
|
||||
virtual ~q_c();
|
||||
|
||||
virtual int64_t add_packet(unsigned char *data, int lenth,
|
||||
|
Loading…
Reference in New Issue
Block a user