File: queue.h

package info (click to toggle)
ogle 0.9.2-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,940 kB
  • ctags: 3,499
  • sloc: ansic: 35,155; sh: 7,555; makefile: 259; asm: 71
file content (174 lines) | stat: -rw-r--r-- 3,942 bytes parent folder | download | duplicates (3)
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#ifndef QUEUE_H_INCLUDED
#define QUEUE_H_INCLUDED

/* Ogle - A video player
 * Copyright (C) 2000, 2001 Bjrn Englund, Hkan Hjort
 *
 * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include "ogle/dvd.h"
#include "ogle/dvdevents.h"
#include "ogle/msgevents.h"

typedef enum {
  PacketType_MPEG1 = 0,
  PacketType_PES   = 1
} PacketType_t;

typedef struct {
  uint64_t PTS;
  uint64_t DTS;
  uint64_t SCR_base;
  uint16_t SCR_ext;
  int in_use;
  uint8_t PTS_DTS_flags;
  uint8_t SCR_flags;
  int scr_nr;
  uint32_t packet_data_offset;
  uint32_t packet_data_len;
  char *q_addr;
  char filename[PATH_MAX+1]; // hack for mmap
  int flowcmd;
  PacketType_t packet_type;
  uint32_t packet_offset;
} data_elem_t;


typedef struct {
  int y_offset; //[480][720];  //y-component image
  int u_offset; //[480/2][720/2]; //u-component
  int v_offset; //[480/2][720/2]; //v-component
  uint16_t start_x, start_y;
  uint16_t horizontal_size;
  uint16_t vertical_size;
  uint16_t padded_width, padded_height;
  uint16_t display_start_x;
  uint16_t display_start_y;
  uint16_t display_width;
  uint16_t display_height;
  int sar_frac_n;
  int sar_frac_d;
  float sar;
} yuv_picture_t;


typedef struct {
  uint64_t PTS;
  uint64_t DTS;
  uint64_t SCR_base;
  uint16_t SCR_ext;
  int displayed;
  int is_reference;
  uint8_t PTS_DTS_flags;
  uint8_t SCR_flags;
  int scr_nr;
  yuv_picture_t picture;
  int picture_off;
  int picture_len;
  long int frame_interval;
  char *q_addr;
} picture_data_elem_t;


typedef struct {
  uint8_t *y; //[480][720];  //y-component image
  uint8_t *u; //[480/2][720/2]; //u-component
  uint8_t *v; //[480/2][720/2]; //v-component
  picture_data_elem_t *info;
} yuv_image_t;

typedef enum {
  DataBufferType_Raw,
  DataBufferType_Video,
  DataBufferType_Audio,
  DataBufferType_MpegPES,
  DataBufferType_MpegES,
  DataBufferType_MpegPS,
  DataBufferType_MpegTS
} DataBufferType_t;

typedef struct {
  DataBufferType_t type;
  int format;
  int width;
  int height;
  int stride;
} DataBufferVideoInfo_t;

typedef struct {
  DataBufferType_t type;
  int format;
} DataBufferAudioInfo_t;

typedef struct {
  DataBufferType_t type;
} DataBufferRawInfo_t;

typedef union {
  DataBufferType_t type;
  DataBufferRawInfo_t raw;
  DataBufferVideoInfo_t video;
  DataBufferAudioInfo_t audio;
} DataBufferInfo_t;

typedef struct {
  int shmid;
  DataBufferInfo_t info;
  int nr_of_dataelems;
  int write_nr;
  int read_nr;
  int buffer_start_offset;
  int buffer_size;
  int pad;         //8 byte alignment needed for data elements
} data_buf_head_t;

typedef struct {
  int data_elem_index;
  int in_use;
} q_elem_t;


#define BUFS_FULL 0
#define BUFS_EMPTY 1
typedef struct {
  int qid;
  int data_buf_shmid;
  int nr_of_qelems;
  int write_nr;
  int read_nr;
  MsgEventClient_t writer;
  MsgEventClient_t reader;
  int writer_requests_notification; //writer sets/unsets this
  int reader_requests_notification; //reader sets/unsets this 
} q_head_t;


typedef struct _data_q_t {
  int in_use;
  int eoq;
  q_head_t *q_head;
  q_elem_t *q_elems;
  data_buf_head_t *data_head;
  picture_data_elem_t *data_elems;
  yuv_image_t *image_bufs;
#ifdef HAVE_XV
  yuv_image_t *reserv_image;
#endif
  struct _data_q_t *next;
} data_q_t;


#endif /* QUEUE_H_INCLUDED */