summaryrefslogtreecommitdiff
path: root/src/multiplexer.h
diff options
context:
space:
mode:
authordeva <deva>2005-09-12 15:46:52 +0000
committerdeva <deva>2005-09-12 15:46:52 +0000
commit2a6d51ad49faa39af5e627df605d3365503b5cb4 (patch)
tree5b21988cf7457ca7cabc2cd945a61a41714b6001 /src/multiplexer.h
parent701608f39c59b530f6cede66ec24e9ddda8beae6 (diff)
*** empty log message ***
Diffstat (limited to 'src/multiplexer.h')
-rw-r--r--src/multiplexer.h118
1 files changed, 118 insertions, 0 deletions
diff --git a/src/multiplexer.h b/src/multiplexer.h
new file mode 100644
index 0000000..25c89e0
--- /dev/null
+++ b/src/multiplexer.h
@@ -0,0 +1,118 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/***************************************************************************
+ * multiplexer.h
+ *
+ * Wed Aug 31 13:05:18 CEST 2005
+ * Copyright 2005 Bent Bisballe Nyeng
+ * deva@aasimon.org
+ ****************************************************************************/
+
+/*
+ * This file is part of MIaV.
+ *
+ * MIaV is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * MIaV is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with MIaV; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+#include "config.h"
+#ifndef __MIAV_MULTIPLEXER_H__
+#define __MIAV_MULTIPLEXER_H__
+
+#include "iso11172-1.h"
+#include "iso11172-2.h"
+#include "iso11172-3.h"
+
+#include "file.h"
+#include "info.h"
+#include "frame.h"
+
+/**
+ * Multiplexer configuration
+ */
+// How many packets should we put in one pack
+#define NUMBER_OF_PACKETS_IN_A_PACK 3
+
+// How many packets bewteen audio packs
+#define AUDIO_PACKET_FREQUENCY 10
+
+// How many packs bewteen system headers
+#define SYSTEM_HEADER_FREQUENCY 5
+
+// Size of video or audio data pr. packet
+#define PACKET_SIZE 2048
+
+/**
+ * Other stuff
+ */
+// The number of streamtypes.
+#define NUM_TYPES 2
+
+// Enum of the streamtypes.
+typedef enum {
+ TYPE_VIDEO,
+ TYPE_AUDIO
+} StreamType;
+
+
+class Multiplexer {
+public:
+ Multiplexer(File *file, Info *info, volatile bool *running,
+ FramePriorityQueue *v_q, pthread_mutex_t *v_m, sem_t *v_s,
+ FramePriorityQueue *a_q, pthread_mutex_t *a_m, sem_t *a_s);
+ ~Multiplexer();
+
+ void multiplex();
+
+private:
+ double written[NUM_TYPES];
+
+ void iso11172_stream();
+ void pack();
+ void system_header();
+ void packet();
+ void packet(StreamType type);
+ /*
+ void audio_packet();
+ void video_packet();
+
+ void audio_data(ISO11172_3::header *header);
+ void audio_data_layer_I(ISO11172_3::header *header);
+ void audio_data_layer_II(ISO11172_3::header *header);
+ void audio_data_layer_III(ISO11172_3::header *header);
+
+ void video_data(ISO11172_2::sequence_header_1 *header1,
+ ISO11172_2::sequence_header_2 *header2);
+ */
+ // Frequency variables
+ unsigned int write_system_header;
+ unsigned int write_audio_packet;
+
+ int read_stream(char *buf, unsigned int size, StreamType type);
+
+ FramePriorityQueue *queue[NUM_TYPES];
+ pthread_mutex_t *mutex[NUM_TYPES];
+ sem_t *sem[NUM_TYPES];
+
+ Frame *frame[NUM_TYPES];
+ unsigned int frame_number[NUM_TYPES];
+ unsigned int read[NUM_TYPES];
+
+ File *file;
+ Info *info;
+ volatile bool *running;
+
+ // Audio Header
+ bool audio_header_read;
+};
+
+#endif/*__MIAV_MULTIPLEXER_H__*/