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
|
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __BUFFER_H__
#define __BUFFER_H__
#include <gst/gst.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define MPEG1MUX_BUFFER_QUEUED(mb) (g_list_length((mb)->timecode_list))
#define MPEG1MUX_BUFFER_SPACE(mb) ((mb)->length)
#define MPEG1MUX_BUFFER_DATA(mb) ((mb)->buffer)
#define MPEG1MUX_BUFFER_TYPE(mb) ((mb)->buffer)
#define MPEG1MUX_BUFFER_FIRST_TIMECODE(mb) (g_list_first((mb)->timecode_list)->data)
#define BUFFER_TYPE_VIDEO 1
#define BUFFER_TYPE_AUDIO 2
#define FRAME_TYPE_IFRAME 1
#define FRAME_TYPE_BFRAME 2
#define FRAME_TYPE_PFRAME 3
#define FRAME_TYPE_AUDIO 4
typedef struct _Mpeg1MuxBuffer Mpeg1MuxBuffer;
typedef struct _Mpeg1MuxTimecode Mpeg1MuxTimecode;
typedef struct video_struc /* Informationen ueber Video Stream */
{
unsigned int stream_length ;
unsigned int num_sequence ;
unsigned int num_seq_end ;
unsigned int num_pictures ;
unsigned int num_groups ;
unsigned int num_frames[4] ;
unsigned int avg_frames[4] ;
unsigned int horizontal_size;
unsigned int vertical_size ;
unsigned int aspect_ratio ;
unsigned int picture_rate ;
unsigned int bit_rate ;
unsigned int comp_bit_rate ;
unsigned int vbv_buffer_size;
unsigned int CSPF ;
guint64 PTS;
guint64 DTS;
guint64 current_PTS;
guint64 current_DTS;
guchar current_type;
double secs_per_frame;
gulong group_order, decoding_order;
} Video_struc;
typedef struct audio_struc /* Informationen ueber Audio Stream */
{
unsigned int stream_length ;
unsigned int num_syncword ;
unsigned int num_frames [2] ;
unsigned int framesize ;
unsigned int layer ;
unsigned int protection ;
unsigned int bit_rate ;
unsigned int frequency ;
unsigned int mode ;
unsigned int mode_extension ;
unsigned int copyright ;
unsigned int original_copy ;
unsigned int emphasis ;
guint64 PTS;
guint64 current_PTS;
double samples_per_second;
gulong decoding_order;
} Audio_struc;
struct _Mpeg1MuxTimecode {
gulong length;
gulong original_length;
guchar frame_type;
guint64 PTS;
guint64 DTS;
};
struct _Mpeg1MuxBuffer {
unsigned char *buffer;
gulong length;
gulong base;
gulong scan_pos;
gulong last_pos;
gulong current_start;
guchar buffer_type;
guchar stream_id;
gboolean new_frame;
guint64 next_frame_time;
union {
Video_struc video;
Audio_struc audio;
} info;
GList *timecode_list;
GList *queued_list;
};
Mpeg1MuxBuffer *mpeg1mux_buffer_new(guchar type, guchar id);
void mpeg1mux_buffer_queue(Mpeg1MuxBuffer *mb, GstBuffer *buf);
void mpeg1mux_buffer_shrink(Mpeg1MuxBuffer *mb, gulong size);
gulong mpeg1mux_buffer_update_queued(Mpeg1MuxBuffer *mb, guint64 scr);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __BUFFER_H__ */
|