comparison libao2/ao_dxr2.c @ 19151:ce6ad55eb7a2

use new mpeg_packetizer helpers
author ben
date Sat, 22 Jul 2006 10:39:00 +0000
parents 99e20a22d5d0
children 39d60ed7edfe
comparison
equal deleted inserted replaced
19150:8f2b737e2a70 19151:ce6ad55eb7a2
10 #include "bswap.h" 10 #include "bswap.h"
11 11
12 #include "audio_out.h" 12 #include "audio_out.h"
13 #include "audio_out_internal.h" 13 #include "audio_out_internal.h"
14 #include "libaf/af_format.h" 14 #include "libaf/af_format.h"
15 #include "libmpdemux/mpeg_packetizer.h"
15 16
16 17
17 static ao_info_t info = 18 static ao_info_t info =
18 { 19 {
19 "DXR2 audio output", 20 "DXR2 audio output",
137 // resume playing, after audio_pause() 138 // resume playing, after audio_pause()
138 static void audio_resume(void) 139 static void audio_resume(void)
139 { 140 {
140 } 141 }
141 142
142 extern void dxr2_send_packet(unsigned char* data,int len,int id,int timestamp);
143 extern void dxr2_send_lpcm_packet(unsigned char* data,int len,int id,int timestamp,int freq_id);
144 extern int vo_pts; 143 extern int vo_pts;
145 // return: how many bytes can be played without blocking 144 // return: how many bytes can be played without blocking
146 static int get_space(void){ 145 static int get_space(void){
147 float x=(float)(vo_pts-ao_data.pts)/90000.0; 146 float x=(float)(vo_pts-ao_data.pts)/90000.0;
148 int y; 147 int y;
154 153
155 // plays 'len' bytes of 'data' 154 // plays 'len' bytes of 'data'
156 // it should round it down to outburst*n 155 // it should round it down to outburst*n
157 // return: number of bytes played 156 // return: number of bytes played
158 static int play(void* data,int len,int flags){ 157 static int play(void* data,int len,int flags){
158 extern int write_dxr2(unsigned char *data, int len);
159 extern void dxr2_send_lpcm_packet(unsigned char* data,int len,int id,int timestamp,int freq_id);
160
159 // MPEG and AC3 don't work :-( 161 // MPEG and AC3 don't work :-(
160 if(ao_data.format==AF_FORMAT_MPEG2) 162 if(ao_data.format==AF_FORMAT_MPEG2)
161 dxr2_send_packet(data,len,0xC0,ao_data.pts); 163 send_mpeg_ps_packet (data, len, 0xC0, ao_data.pts, 2, write_dxr2);
162 else if(ao_data.format==AF_FORMAT_AC3) 164 else if(ao_data.format==AF_FORMAT_AC3)
163 dxr2_send_packet(data,len,0x80,ao_data.pts); 165 send_mpeg_ps_packet (data, len, 0x80, ao_data.pts, 2, write_dxr2);
164 else { 166 else {
165 int i; 167 int i;
166 //unsigned short *s=data; 168 //unsigned short *s=data;
167 uint16_t *s=data; 169 uint16_t *s=data;
168 #ifndef WORDS_BIGENDIAN 170 #ifndef WORDS_BIGENDIAN