summaryrefslogtreecommitdiff
path: root/libdvbmpeg/remux.h
blob: 3a94a11e71293a5fdc6c673f4f7c6a4d83ec18bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/*
 *  dvb-mpegtools for the Siemens Fujitsu DVB PCI card
 *
 * Copyright (C) 2000, 2001 Marcus Metzler 
 *            for convergence integrated media GmbH
 * Copyright (C) 2002 Marcus Metzler 
 * 
 *
 * This program 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.
 * 

 * This program 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 this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
 * 

 * The author can be reached at mocm@metzlerbros.de, 
 */

#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
#include <netinet/in.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
//#include <libgen.h>
#include <stdint.h>

#include "ringbuffy.h"
#include "ctools.h"

#ifndef _REMUX_H_
#define _REMUX_H_

#ifdef __cplusplus
extern "C" {
#endif				/* __cplusplus */

	typedef struct video_i{
		uint32_t horizontal_size;
		uint32_t vertical_size 	;
		uint32_t aspect_ratio	;
		double framerate	;
		uint32_t video_format;
		uint32_t bit_rate 	;
		uint32_t comp_bit_rate	;
		uint32_t vbv_buffer_size;
		uint32_t CSPF 		;
		uint32_t off;
	} VideoInfo; 		

	typedef struct audio_i{
		int layer;
		uint32_t bit_rate;
		uint32_t frequency;
		uint32_t mode;
		uint32_t mode_extension;
		uint32_t emphasis;
		uint32_t framesize;
		uint32_t off;
	} AudioInfo;



	typedef
	struct PTS_list_struct{
		uint32_t PTS;
		int pos;
		uint32_t dts;
		int spos;
	} PTS_List;

	typedef
	struct frame_list_struct{
		int type;
		int pos;
		uint32_t FRAME;
		uint32_t time;
		uint32_t pts;
		uint32_t dts;
	} FRAME_List;

	typedef
	struct remux_struct{
		ringbuffy vid_buffy;
		ringbuffy aud_buffy;
		PTS_List vpts_list[MAX_PTS];
		PTS_List apts_list[MAX_PTS];
		FRAME_List vframe_list[MAX_FRAME];
		FRAME_List aframe_list[MAX_FRAME];
		int vptsn;
		int aptsn;
		int vframen;
		int aframen;
		long apes;
		long vpes;
		uint32_t vframe;
		uint32_t aframe;
		uint32_t vcframe;
		uint32_t acframe;
		uint32_t vpts;
		uint32_t vdts;
		uint32_t apts;
		uint32_t vpts_old;
		uint32_t apts_old;
		uint32_t SCR;
		uint32_t apts_off;
		uint32_t vpts_off;
		uint32_t apts_delay;
		uint32_t vpts_delay;
		uint32_t dts_delay;
		AudioInfo audio_info;
		VideoInfo video_info;
		int fin;
		int fout;
		long int awrite;
		long int vwrite;
		long int aread;
		long int vread;
		uint32_t group;
		uint32_t groupframe;
		uint32_t muxr;
		int pack_size;
		uint32_t time_off;
	} Remux;

	enum { NONE, I_FRAME, P_FRAME, B_FRAME, D_FRAME };

	void remux(int fin, int fout, int pack_size, int mult);
	void remux2(int fdin, int fdout);
#ifdef __cplusplus
}
#endif				/* __cplusplus */

#endif /*_REMUX_H_*/