Mercurial > mplayer.hg
annotate libvo/vo_mpegpes.c @ 8449:ff22f772bd38
link added, section reworded.
author | diego |
---|---|
date | Sat, 14 Dec 2002 15:50:27 +0000 |
parents | 5b39e79af5fe |
children | 00326905484b |
rev | line source |
---|---|
5059 | 1 // Don't change for DVB card, it must be 2048 |
1876 | 2 #define PES_MAX_SIZE 2048 |
5059 | 3 |
1876 | 4 /* |
5 * Based on: | |
6 * | |
7 * test_av.c - Test program for new API | |
8 * | |
9 * Copyright (C) 2000 Ralph Metzler <ralph@convergence.de> | |
10 * & Marcus Metzler <marcus@convergence.de> | |
11 * for convergence integrated media GmbH | |
12 * | |
13 * libav - MPEG-PS multiplexer, part of ffmpeg | |
14 * Copyright Gerard Lantau (see http://ffmpeg.sf.net) | |
15 * | |
16 */ | |
1871 | 17 |
6239 | 18 #include "config.h" |
1871 | 19 #include <stdio.h> |
20 #include <stdlib.h> | |
21 #include <string.h> | |
4737
32e1f5042f65
I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents:
4596
diff
changeset
|
22 #include <errno.h> |
1876 | 23 #include <sys/types.h> |
24 #include <sys/stat.h> | |
25 #include <fcntl.h> | |
6239 | 26 #include <unistd.h> |
1876 | 27 |
5877
93de400ad48e
libfame code removed (use -vop fame/-vop lavc), init code moved to preinit, height checks added to config()
arpi
parents:
5844
diff
changeset
|
28 #include "mp_msg.h" |
2727 | 29 |
1876 | 30 #ifdef HAVE_DVB |
31 | |
2066
2b14cad013b7
using poll() only for DVB card - not required for file write
arpi
parents:
1986
diff
changeset
|
32 #include <sys/poll.h> |
2b14cad013b7
using poll() only for DVB card - not required for file write
arpi
parents:
1986
diff
changeset
|
33 |
1876 | 34 #include <sys/ioctl.h> |
35 #include <stdio.h> | |
36 #include <time.h> | |
37 | |
38 #include <ost/dmx.h> | |
39 #include <ost/frontend.h> | |
40 #include <ost/sec.h> | |
41 #include <ost/video.h> | |
42 #include <ost/audio.h> | |
43 | |
44 #endif | |
45 | |
1871 | 46 #include "config.h" |
47 #include "video_out.h" | |
48 #include "video_out_internal.h" | |
49 | |
1872 | 50 int vo_mpegpes_fd=-1; |
1876 | 51 int vo_mpegpes_fd2=-1; |
1872 | 52 |
8148
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
7860
diff
changeset
|
53 static vo_info_t info = |
1871 | 54 { |
1876 | 55 #ifdef HAVE_DVB |
56 "Mpeg-PES to DVB card", | |
57 #else | |
1871 | 58 "Mpeg-PES file", |
1876 | 59 #endif |
60 "mpegpes", | |
1871 | 61 "A'rpi", |
62 "" | |
63 }; | |
64 | |
8148
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
7860
diff
changeset
|
65 LIBVO_EXTERN (mpegpes) |
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
7860
diff
changeset
|
66 |
1871 | 67 static uint32_t |
7124
eca7dbad0166
finally removed query_vaa, bes_da and vo_tune_info - the obsoleted libvo api
alex
parents:
6273
diff
changeset
|
68 config(uint32_t s_width, uint32_t s_height, uint32_t width, uint32_t height, uint32_t fullscreen, char *title, uint32_t format) |
1871 | 69 { |
1876 | 70 #ifdef HAVE_DVB |
5877
93de400ad48e
libfame code removed (use -vop fame/-vop lavc), init code moved to preinit, height checks added to config()
arpi
parents:
5844
diff
changeset
|
71 switch(s_height){ |
93de400ad48e
libfame code removed (use -vop fame/-vop lavc), init code moved to preinit, height checks added to config()
arpi
parents:
5844
diff
changeset
|
72 case 288: |
93de400ad48e
libfame code removed (use -vop fame/-vop lavc), init code moved to preinit, height checks added to config()
arpi
parents:
5844
diff
changeset
|
73 case 576: |
93de400ad48e
libfame code removed (use -vop fame/-vop lavc), init code moved to preinit, height checks added to config()
arpi
parents:
5844
diff
changeset
|
74 case 240: |
93de400ad48e
libfame code removed (use -vop fame/-vop lavc), init code moved to preinit, height checks added to config()
arpi
parents:
5844
diff
changeset
|
75 case 480: |
93de400ad48e
libfame code removed (use -vop fame/-vop lavc), init code moved to preinit, height checks added to config()
arpi
parents:
5844
diff
changeset
|
76 break; |
93de400ad48e
libfame code removed (use -vop fame/-vop lavc), init code moved to preinit, height checks added to config()
arpi
parents:
5844
diff
changeset
|
77 default: |
93de400ad48e
libfame code removed (use -vop fame/-vop lavc), init code moved to preinit, height checks added to config()
arpi
parents:
5844
diff
changeset
|
78 mp_msg(MSGT_VO,MSGL_ERR,"DVB: height=%d not supported (try 240/480 (ntsc) or 288/576 (pal)\n",s_height); |
93de400ad48e
libfame code removed (use -vop fame/-vop lavc), init code moved to preinit, height checks added to config()
arpi
parents:
5844
diff
changeset
|
79 return -1; |
93de400ad48e
libfame code removed (use -vop fame/-vop lavc), init code moved to preinit, height checks added to config()
arpi
parents:
5844
diff
changeset
|
80 } |
93de400ad48e
libfame code removed (use -vop fame/-vop lavc), init code moved to preinit, height checks added to config()
arpi
parents:
5844
diff
changeset
|
81 #endif |
93de400ad48e
libfame code removed (use -vop fame/-vop lavc), init code moved to preinit, height checks added to config()
arpi
parents:
5844
diff
changeset
|
82 return 0; |
93de400ad48e
libfame code removed (use -vop fame/-vop lavc), init code moved to preinit, height checks added to config()
arpi
parents:
5844
diff
changeset
|
83 } |
93de400ad48e
libfame code removed (use -vop fame/-vop lavc), init code moved to preinit, height checks added to config()
arpi
parents:
5844
diff
changeset
|
84 |
93de400ad48e
libfame code removed (use -vop fame/-vop lavc), init code moved to preinit, height checks added to config()
arpi
parents:
5844
diff
changeset
|
85 static uint32_t preinit(const char *arg){ |
93de400ad48e
libfame code removed (use -vop fame/-vop lavc), init code moved to preinit, height checks added to config()
arpi
parents:
5844
diff
changeset
|
86 #ifdef HAVE_DVB |
7672
e6b46875e1b9
- fixed a 10l bug: setting PTS flag even if no PTS stored
arpi
parents:
7124
diff
changeset
|
87 if(!arg){ |
1876 | 88 //|O_NONBLOCK |
89 if((vo_mpegpes_fd = open("/dev/ost/video",O_RDWR)) < 0){ | |
90 perror("DVB VIDEO DEVICE: "); | |
91 return -1; | |
92 } | |
93 if((vo_mpegpes_fd2 = open("/dev/ost/audio",O_RDWR|O_NONBLOCK)) < 0){ | |
94 perror("DVB AUDIO DEVICE: "); | |
95 return -1; | |
96 } | |
97 if ( (ioctl(vo_mpegpes_fd,VIDEO_SET_BLANK, false) < 0)){ | |
98 perror("DVB VIDEO SET BLANK: "); | |
99 return -1; | |
100 } | |
101 if ( (ioctl(vo_mpegpes_fd,VIDEO_SELECT_SOURCE, VIDEO_SOURCE_MEMORY) < 0)){ | |
102 perror("DVB VIDEO SELECT SOURCE: "); | |
103 return -1; | |
104 } | |
105 #if 1 | |
106 if ( (ioctl(vo_mpegpes_fd2,AUDIO_SELECT_SOURCE, AUDIO_SOURCE_MEMORY) < 0)){ | |
107 perror("DVB AUDIO SELECT SOURCE: "); | |
108 return -1; | |
109 } | |
110 if ( (ioctl(vo_mpegpes_fd2,AUDIO_PLAY) < 0)){ | |
111 perror("DVB AUDIO PLAY: "); | |
112 return -1; | |
113 } | |
114 #else | |
115 if ( (ioctl(vo_mpegpes_fd2,AUDIO_STOP,0) < 0)){ | |
116 perror("DVB AUDIO STOP: "); | |
117 return -1; | |
118 } | |
119 #endif | |
120 if ( (ioctl(vo_mpegpes_fd,VIDEO_PLAY) < 0)){ | |
121 perror("DVB VIDEO PLAY: "); | |
122 return -1; | |
123 } | |
7860 | 124 if ( (ioctl(vo_mpegpes_fd2,AUDIO_SET_AV_SYNC, true) < 0)){ |
1876 | 125 perror("DVB AUDIO SET AV SYNC: "); |
126 return -1; | |
127 } | |
7672
e6b46875e1b9
- fixed a 10l bug: setting PTS flag even if no PTS stored
arpi
parents:
7124
diff
changeset
|
128 // if ( (ioctl(vo_mpegpes_fd2,AUDIO_SET_MUTE, false) < 0)){ |
e6b46875e1b9
- fixed a 10l bug: setting PTS flag even if no PTS stored
arpi
parents:
7124
diff
changeset
|
129 if ( (ioctl(vo_mpegpes_fd2,AUDIO_SET_MUTE, true) < 0)){ |
1876 | 130 perror("DVB AUDIO SET MUTE: "); |
131 return -1; | |
132 } | |
7672
e6b46875e1b9
- fixed a 10l bug: setting PTS flag even if no PTS stored
arpi
parents:
7124
diff
changeset
|
133 return 0; |
e6b46875e1b9
- fixed a 10l bug: setting PTS flag even if no PTS stored
arpi
parents:
7124
diff
changeset
|
134 } |
e6b46875e1b9
- fixed a 10l bug: setting PTS flag even if no PTS stored
arpi
parents:
7124
diff
changeset
|
135 #endif |
e6b46875e1b9
- fixed a 10l bug: setting PTS flag even if no PTS stored
arpi
parents:
7124
diff
changeset
|
136 vo_mpegpes_fd=open(arg ? arg : "grab.mpg",O_WRONLY|O_CREAT,0666); |
1872 | 137 if(vo_mpegpes_fd<0){ |
138 perror("vo_mpegpes"); | |
139 return -1; | |
140 } | |
7672
e6b46875e1b9
- fixed a 10l bug: setting PTS flag even if no PTS stored
arpi
parents:
7124
diff
changeset
|
141 vo_mpegpes_fd2=vo_mpegpes_fd; |
1871 | 142 return 0; |
143 } | |
144 | |
145 | |
146 static void draw_osd(void) | |
147 { | |
148 } | |
149 | |
1876 | 150 |
1872 | 151 static void my_write(unsigned char* data,int len){ |
2066
2b14cad013b7
using poll() only for DVB card - not required for file write
arpi
parents:
1986
diff
changeset
|
152 #ifdef HAVE_DVB |
2b14cad013b7
using poll() only for DVB card - not required for file write
arpi
parents:
1986
diff
changeset
|
153 #define NFD 2 |
1876 | 154 struct pollfd pfd[NFD]; |
155 | |
156 // printf("write %d bytes \n",len); | |
157 | |
158 pfd[0].fd = vo_mpegpes_fd; | |
159 pfd[0].events = POLLOUT; | |
160 | |
161 pfd[1].fd = vo_mpegpes_fd2; | |
162 pfd[1].events = POLLOUT; | |
163 | |
1872 | 164 while(len>0){ |
1876 | 165 if (poll(pfd,NFD,1)){ |
166 if (pfd[0].revents & POLLOUT){ | |
167 int ret=write(vo_mpegpes_fd,data,len); | |
168 // printf("ret=%d \n",ret); | |
169 if(ret<=0){ | |
170 perror("write"); | |
171 usleep(0); | |
172 } else { | |
173 len-=ret; data+=ret; | |
174 } | |
175 } else usleep(1000); | |
176 } | |
1872 | 177 } |
2066
2b14cad013b7
using poll() only for DVB card - not required for file write
arpi
parents:
1986
diff
changeset
|
178 |
2b14cad013b7
using poll() only for DVB card - not required for file write
arpi
parents:
1986
diff
changeset
|
179 #else |
2b14cad013b7
using poll() only for DVB card - not required for file write
arpi
parents:
1986
diff
changeset
|
180 write(vo_mpegpes_fd,data,len); // write to file |
2b14cad013b7
using poll() only for DVB card - not required for file write
arpi
parents:
1986
diff
changeset
|
181 #endif |
1872 | 182 } |
1871 | 183 |
1876 | 184 static unsigned char pes_header[PES_MAX_SIZE]; |
185 | |
2706 | 186 void send_pes_packet(unsigned char* data,int len,int id,int timestamp){ |
4306 | 187 int ptslen=timestamp?5:1; |
1876 | 188 |
4306 | 189 // startcode: |
1876 | 190 pes_header[0]=pes_header[1]=0; |
191 pes_header[2]=id>>8; pes_header[3]=id&255; | |
192 | |
4306 | 193 while(len>0){ |
194 int payload_size=len; // data + PTS | |
195 if(6+ptslen+payload_size>PES_MAX_SIZE) payload_size=PES_MAX_SIZE-(6+ptslen); | |
1876 | 196 |
197 // construct PES header: (code from ffmpeg's libav) | |
198 // packetsize: | |
4306 | 199 pes_header[4]=(ptslen+payload_size)>>8; |
200 pes_header[5]=(ptslen+payload_size)&255; | |
201 | |
202 if(ptslen==5){ | |
203 int x; | |
1876 | 204 // presentation time stamp: |
205 x=(0x02 << 4) | (((timestamp >> 30) & 0x07) << 1) | 1; | |
206 pes_header[6]=x; | |
207 x=((((timestamp >> 15) & 0x7fff) << 1) | 1); | |
208 pes_header[7]=x>>8; pes_header[8]=x&255; | |
209 x=((((timestamp) & 0x7fff) << 1) | 1); | |
210 pes_header[9]=x>>8; pes_header[10]=x&255; | |
4306 | 211 } else { |
212 // stuffing and header bits: | |
213 pes_header[6]=0x0f; | |
214 } | |
215 | |
216 memcpy(&pes_header[6+ptslen],data,payload_size); | |
217 my_write(pes_header,6+ptslen+payload_size); | |
1876 | 218 |
219 len-=payload_size; data+=payload_size; | |
4306 | 220 ptslen=1; // store PTS only once, at first packet! |
1876 | 221 } |
222 | |
223 // printf("PES: draw frame! pts=%d size=%d \n",timestamp,len); | |
224 | |
225 } | |
226 | |
4299
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
227 void send_lpcm_packet(unsigned char* data,int len,int id,unsigned int timestamp,int freq_id){ |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
228 |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
229 int ptslen=timestamp?5:0; |
2706 | 230 |
4306 | 231 // startcode: |
2706 | 232 pes_header[0]=pes_header[1]=0; |
233 pes_header[2]=1; pes_header[3]=0xBD; | |
234 | |
235 while(len>=4){ | |
236 int payload_size; | |
237 | |
238 payload_size=PES_MAX_SIZE-6-20; // max possible data len | |
239 if(payload_size>len) payload_size=len; | |
240 payload_size&=(~3); // align! | |
241 | |
242 //if(6+payload_size>PES_MAX_SIZE) payload_size=PES_MAX_SIZE-6; | |
243 | |
244 // packetsize: | |
4299
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
245 pes_header[4]=(payload_size+3+ptslen+7)>>8; |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
246 pes_header[5]=(payload_size+3+ptslen+7)&255; |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
247 |
2706 | 248 // stuffing: |
7672
e6b46875e1b9
- fixed a 10l bug: setting PTS flag even if no PTS stored
arpi
parents:
7124
diff
changeset
|
249 // TTCCxxxx CC=css TT=type: 1=STD 0=mpeg1 2=vob |
2706 | 250 pes_header[6]=0x81; |
7672
e6b46875e1b9
- fixed a 10l bug: setting PTS flag even if no PTS stored
arpi
parents:
7124
diff
changeset
|
251 |
e6b46875e1b9
- fixed a 10l bug: setting PTS flag even if no PTS stored
arpi
parents:
7124
diff
changeset
|
252 // FFxxxxxx FF=pts flags=2 vs 0 |
e6b46875e1b9
- fixed a 10l bug: setting PTS flag even if no PTS stored
arpi
parents:
7124
diff
changeset
|
253 pes_header[7]=ptslen ? 0x80 : 0; |
4299
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
254 |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
255 // hdrlen: |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
256 pes_header[8]=ptslen; |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
257 |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
258 if(ptslen){ |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
259 int x; |
2706 | 260 // presentation time stamp: |
261 x=(0x02 << 4) | (((timestamp >> 30) & 0x07) << 1) | 1; | |
262 pes_header[9]=x; | |
263 x=((((timestamp >> 15) & 0x7fff) << 1) | 1); | |
264 pes_header[10]=x>>8; pes_header[11]=x&255; | |
265 x=((((timestamp) & 0x7fff) << 1) | 1); | |
266 pes_header[12]=x>>8; pes_header[13]=x&255; | |
4299
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
267 } |
2706 | 268 |
4299
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
269 // ============ LPCM header: (7 bytes) ================= |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
270 // Info by mocm@convergence.de |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
271 |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
272 // ID: |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
273 pes_header[ptslen+9]=id; |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
274 |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
275 // number of frames: |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
276 pes_header[ptslen+10]=0x07; |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
277 |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
278 // first acces unit pointer, i.e. start of audio frame: |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
279 pes_header[ptslen+11]=0x00; |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
280 pes_header[ptslen+12]=0x04; |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
281 |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
282 // audio emphasis on-off 1 bit |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
283 // audio mute on-off 1 bit |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
284 // reserved 1 bit |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
285 // audio frame number 5 bit |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
286 pes_header[ptslen+13]=0x0C; |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
287 |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
288 // quantization word length 2 bit |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
289 // audio sampling frequency (48khz = 0, 96khz = 1) 2 bit |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
290 // reserved 1 bit |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
291 // number of audio channels - 1 (e.g. stereo = 1) 3 bit |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
292 pes_header[ptslen+14]=1|(freq_id<<4); |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
293 |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
294 // dynamic range control (0x80 if off) |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
295 pes_header[ptslen+15]=0x80; |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
296 |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
297 memcpy(&pes_header[6+3+ptslen+7],data,payload_size); |
8e157167cee5
LPCM write code rewritten, thanks to Marcus at mocm@convergence.de
arpi
parents:
2727
diff
changeset
|
298 my_write(pes_header,6+3+ptslen+7+payload_size); |
2706 | 299 |
300 len-=payload_size; data+=payload_size; | |
4306 | 301 ptslen=0; // store PTS only once, at first packet! |
2706 | 302 } |
303 | |
304 // printf("PES: draw frame! pts=%d size=%d \n",timestamp,len); | |
305 | |
306 } | |
307 | |
308 | |
1871 | 309 static uint32_t draw_frame(uint8_t * src[]) |
310 { | |
1872 | 311 vo_mpegpes_t *p=(vo_mpegpes_t *)src[0]; |
5877
93de400ad48e
libfame code removed (use -vop fame/-vop lavc), init code moved to preinit, height checks added to config()
arpi
parents:
5844
diff
changeset
|
312 send_pes_packet(p->data,p->size,p->id,(p->timestamp>0)?p->timestamp:vo_pts); // video data |
1871 | 313 return 0; |
314 } | |
315 | |
1935 | 316 static void flip_page (void) |
317 { | |
318 } | |
319 | |
320 static uint32_t draw_slice(uint8_t *srcimg[], int stride[], int w,int h,int x0,int y0) | |
321 { | |
322 return 0; | |
323 } | |
324 | |
325 | |
1871 | 326 static uint32_t |
327 query_format(uint32_t format) | |
328 { | |
5566 | 329 if(format==IMGFMT_MPEGPES) return 3|VFCAP_TIMER; |
1871 | 330 return 0; |
331 } | |
332 | |
333 static void | |
334 uninit(void) | |
335 { | |
7672
e6b46875e1b9
- fixed a 10l bug: setting PTS flag even if no PTS stored
arpi
parents:
7124
diff
changeset
|
336 if(vo_mpegpes_fd2>=0 && vo_mpegpes_fd2!=vo_mpegpes_fd) close(vo_mpegpes_fd2); |
e6b46875e1b9
- fixed a 10l bug: setting PTS flag even if no PTS stored
arpi
parents:
7124
diff
changeset
|
337 vo_mpegpes_fd2=-1; |
1876 | 338 if(vo_mpegpes_fd>=0){ close(vo_mpegpes_fd);vo_mpegpes_fd=-1;} |
1871 | 339 } |
340 | |
341 | |
342 static void check_events(void) | |
343 { | |
344 } | |
345 | |
4596 | 346 static uint32_t control(uint32_t request, void *data, ...) |
4352 | 347 { |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
348 switch (request) { |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
349 case VOCTRL_QUERY_FORMAT: |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
350 return query_format(*((uint32_t*)data)); |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
351 } |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
352 return VO_NOTIMPL; |
4352 | 353 } |