annotate libao2/ao_mpegpes.c @ 22697:2fe9bd97a7f6

Fix configure -march detection for athlon-xp The configure script uses SSE support to distinguish between athlon and athlon-xp, but SSE support was tested _after_ deciding the basic CPU type. Thus athlon-xp was always misdetected as athlon. Fix this by moving the CPU extensions check before the CPU type check. Patch from Andrew Savchenko, bircoph list ru.
author uau
date Sun, 18 Mar 2007 13:38:55 +0000
parents 3a998ae2f952
children 44984ad9f6c3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2708
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
1 #include <stdio.h>
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
2 #include <stdlib.h>
7472
c4434bdf6e51 tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents: 7164
diff changeset
3 #include <string.h>
19184
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
4 #include <sys/types.h>
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
5 #include <sys/stat.h>
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
6 #include <fcntl.h>
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
7 #include <unistd.h>
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
8 #include <inttypes.h>
19362
3a998ae2f952 replace calls to perror() with calls to mp_msg()
ivo
parents: 19222
diff changeset
9 #include <errno.h>
9411
arpi
parents: 9265
diff changeset
10
14123
a92101a7eb49 Make include paths consistent.
diego
parents: 13383
diff changeset
11 #include "config.h"
9411
arpi
parents: 9265
diff changeset
12
arpi
parents: 9265
diff changeset
13 #ifdef HAVE_DVB_HEAD
8594
00326905484b DVB-HEAD (aka. NEWSTRUCT) detection & support
arpi
parents: 7609
diff changeset
14 #define HAVE_DVB 1
00326905484b DVB-HEAD (aka. NEWSTRUCT) detection & support
arpi
parents: 7609
diff changeset
15 #endif
00326905484b DVB-HEAD (aka. NEWSTRUCT) detection & support
arpi
parents: 7609
diff changeset
16
6856
23221df30608 no need for ioctl.h if not using dvb
rfelker
parents: 5060
diff changeset
17 #ifdef HAVE_DVB
19215
64264df4c4e1 include sys/poll.h only when HAVE_DVB[_HEAD] is set
nicodvb
parents: 19184
diff changeset
18 #include <sys/poll.h>
4788
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 4331
diff changeset
19 #include <sys/ioctl.h>
6856
23221df30608 no need for ioctl.h if not using dvb
rfelker
parents: 5060
diff changeset
20 #endif
2708
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
21
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
22 #include "audio_out.h"
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
23 #include "audio_out_internal.h"
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
24
14245
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 14123
diff changeset
25 #include "libaf/af_format.h"
19184
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
26 #include "libmpdemux/mpeg_packetizer.h"
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
27 #include "subopt-helper.h"
2708
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
28
14123
a92101a7eb49 Make include paths consistent.
diego
parents: 13383
diff changeset
29 #include "mp_msg.h"
a92101a7eb49 Make include paths consistent.
diego
parents: 13383
diff changeset
30 #include "help_mp.h"
7161
13bc391fc19c mp_msg'ized
alex
parents: 6856
diff changeset
31
4792
c85ee559fc3d compilation fixed
arpi
parents: 4788
diff changeset
32 #ifdef HAVE_DVB
8594
00326905484b DVB-HEAD (aka. NEWSTRUCT) detection & support
arpi
parents: 7609
diff changeset
33 #ifndef HAVE_DVB_HEAD
4792
c85ee559fc3d compilation fixed
arpi
parents: 4788
diff changeset
34 #include <ost/audio.h>
4788
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 4331
diff changeset
35 audioMixer_t dvb_mixer={255,255};
8594
00326905484b DVB-HEAD (aka. NEWSTRUCT) detection & support
arpi
parents: 7609
diff changeset
36 #else
9411
arpi
parents: 9265
diff changeset
37 #include <linux/dvb/audio.h>
8594
00326905484b DVB-HEAD (aka. NEWSTRUCT) detection & support
arpi
parents: 7609
diff changeset
38 audio_mixer_t dvb_mixer={255,255};
00326905484b DVB-HEAD (aka. NEWSTRUCT) detection & support
arpi
parents: 7609
diff changeset
39 #endif
7609
arpi
parents: 7607
diff changeset
40 #endif
19184
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
41
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
42 #define true 1
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
43 #define false 0
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
44
4788
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 4331
diff changeset
45 extern int vo_mpegpes_fd;
19184
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
46 int vo_mpegpes_fd2 = -1;
4788
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 4331
diff changeset
47
7164
6175f7d18f8c added needed errno.h
alex
parents: 7161
diff changeset
48 #include <errno.h>
6175f7d18f8c added needed errno.h
alex
parents: 7161
diff changeset
49
2708
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
50 static ao_info_t info =
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
51 {
4792
c85ee559fc3d compilation fixed
arpi
parents: 4788
diff changeset
52 #ifdef HAVE_DVB
c85ee559fc3d compilation fixed
arpi
parents: 4788
diff changeset
53 "DVB audio output",
c85ee559fc3d compilation fixed
arpi
parents: 4788
diff changeset
54 #else
c85ee559fc3d compilation fixed
arpi
parents: 4788
diff changeset
55 "Mpeg-PES audio output",
c85ee559fc3d compilation fixed
arpi
parents: 4788
diff changeset
56 #endif
2708
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
57 "mpegpes",
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
58 "A'rpi",
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
59 ""
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
60 };
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
61
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
62 LIBAO_EXTERN(mpegpes)
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
63
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
64
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
65 // to set/get/query special features/parameters
9633
12b1790038b0 64bit libao2 fix by Jens Axboe <mplayer-dev@kernel.dk>
alex
parents: 9411
diff changeset
66 static int control(int cmd,void *arg){
4792
c85ee559fc3d compilation fixed
arpi
parents: 4788
diff changeset
67 #ifdef HAVE_DVB
4788
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 4331
diff changeset
68 switch(cmd){
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 4331
diff changeset
69 case AOCONTROL_GET_VOLUME:
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 4331
diff changeset
70 if(vo_mpegpes_fd2>=0){
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 4331
diff changeset
71 ((ao_control_vol_t*)(arg))->left=dvb_mixer.volume_left/2.56;
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 4331
diff changeset
72 ((ao_control_vol_t*)(arg))->right=dvb_mixer.volume_right/2.56;
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 4331
diff changeset
73 return CONTROL_OK;
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 4331
diff changeset
74 }
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 4331
diff changeset
75 return CONTROL_ERROR;
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 4331
diff changeset
76 case AOCONTROL_SET_VOLUME:
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 4331
diff changeset
77 if(vo_mpegpes_fd2>=0){
5060
485ef815e786 10l - config.h should be included...
arpi
parents: 4792
diff changeset
78 dvb_mixer.volume_left=((ao_control_vol_t*)(arg))->left*2.56;
485ef815e786 10l - config.h should be included...
arpi
parents: 4792
diff changeset
79 dvb_mixer.volume_right=((ao_control_vol_t*)(arg))->right*2.56;
4788
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 4331
diff changeset
80 if(dvb_mixer.volume_left>255) dvb_mixer.volume_left=255;
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 4331
diff changeset
81 if(dvb_mixer.volume_right>255) dvb_mixer.volume_right=255;
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 4331
diff changeset
82 // printf("Setting DVB volume: %d ; %d \n",dvb_mixer.volume_left,dvb_mixer.volume_right);
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 4331
diff changeset
83 if ( (ioctl(vo_mpegpes_fd2,AUDIO_SET_MIXER, &dvb_mixer) < 0)){
13383
c1955840883d mp_msg transition of unmaintained audio output drivers.
ivo
parents: 12145
diff changeset
84 mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_MPEGPES_CantSetMixer,
7161
13bc391fc19c mp_msg'ized
alex
parents: 6856
diff changeset
85 strerror(errno));
4788
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 4331
diff changeset
86 return CONTROL_ERROR;
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 4331
diff changeset
87 }
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 4331
diff changeset
88 return CONTROL_OK;
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 4331
diff changeset
89 }
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 4331
diff changeset
90 return CONTROL_ERROR;
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 4331
diff changeset
91 }
4792
c85ee559fc3d compilation fixed
arpi
parents: 4788
diff changeset
92 #endif
4788
d678ce495a75 Moved HW dependent mixer stuff to libao and removed master switch
anders
parents: 4331
diff changeset
93 return CONTROL_UNKNOWN;
2708
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
94 }
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
95
4331
ce1e3668fa2b freq fix, removed muxer delay
arpi
parents: 4305
diff changeset
96 static int freq=0;
4300
4ebab79785b7 passing samplerate to LPCM writer - 44, 32 and 96khz are also supported from now
arpi
parents: 3095
diff changeset
97 static int freq_id=0;
4ebab79785b7 passing samplerate to LPCM writer - 44, 32 and 96khz are also supported from now
arpi
parents: 3095
diff changeset
98
19184
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
99 #ifdef HAVE_DVB
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
100 static int init_device(int card)
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
101 {
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
102 char ao_file[30];
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
103 #ifndef HAVE_DVB_HEAD
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
104 mp_msg(MSGT_VO,MSGL_INFO, "Opening /dev/ost/audio\n");
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
105 sprintf(ao_file, "/dev/ost/audio");
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
106 #else
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
107 mp_msg(MSGT_VO,MSGL_INFO, "Opening /dev/dvb/adapter%d/audio0\n", card);
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
108 sprintf(ao_file, "/dev/dvb/adapter%d/audio0", card);
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
109 #endif
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
110 if((vo_mpegpes_fd2 = open(ao_file,O_RDWR|O_NONBLOCK)) < 0)
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
111 {
19362
3a998ae2f952 replace calls to perror() with calls to mp_msg()
ivo
parents: 19222
diff changeset
112 mp_msg(MSGT_VO, MSGL_ERR, "DVB AUDIO DEVICE: %s\n", strerror(errno));
19184
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
113 return -1;
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
114 }
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
115 if( (ioctl(vo_mpegpes_fd2,AUDIO_SELECT_SOURCE, AUDIO_SOURCE_MEMORY) < 0))
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
116 {
19362
3a998ae2f952 replace calls to perror() with calls to mp_msg()
ivo
parents: 19222
diff changeset
117 mp_msg(MSGT_VO, MSGL_ERR, "DVB AUDIO SELECT SOURCE: %s\n", strerror(errno));
19184
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
118 return -1;
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
119 }
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
120 if((ioctl(vo_mpegpes_fd2,AUDIO_PLAY) < 0))
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
121 {
19362
3a998ae2f952 replace calls to perror() with calls to mp_msg()
ivo
parents: 19222
diff changeset
122 mp_msg(MSGT_VO, MSGL_ERR, "DVB AUDIO PLAY: %s\n", strerror(errno));
19184
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
123 return -1;
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
124 }
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
125 if((ioctl(vo_mpegpes_fd2,AUDIO_SET_AV_SYNC, true) < 0))
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
126 {
19362
3a998ae2f952 replace calls to perror() with calls to mp_msg()
ivo
parents: 19222
diff changeset
127 mp_msg(MSGT_VO, MSGL_ERR, "DVB AUDIO SET AV SYNC: %s\n", strerror(errno));
19184
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
128 return -1;
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
129 }
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
130 //FIXME: in vo_mpegpes audio was inited as MUTEd
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
131 if((ioctl(vo_mpegpes_fd2,AUDIO_SET_MUTE, false) < 0))
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
132 {
19362
3a998ae2f952 replace calls to perror() with calls to mp_msg()
ivo
parents: 19222
diff changeset
133 mp_msg(MSGT_VO, MSGL_ERR, "DVB AUDIO SET MUTE: %s\n", strerror(errno));
19184
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
134 return -1;
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
135 }
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
136 return vo_mpegpes_fd2;
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
137 }
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
138 #endif
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
139
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
140 static int preinit(const char *arg)
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
141 {
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
142 int card = 1;
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
143 char *ao_file = NULL;
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
144
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
145 opt_t subopts[] = {
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
146 {"card", OPT_ARG_INT, &card, NULL},
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
147 {"file", OPT_ARG_MSTRZ, &ao_file, NULL},
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
148 {NULL}
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
149 };
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
150
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
151 if(subopt_parse(ao_subdevice, subopts) != 0)
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
152 {
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
153 mp_msg(MSGT_VO, MSGL_ERR, "AO_MPEGPES, Unrecognized options\n");
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
154 return -1;
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
155 }
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
156 if((card < 1) || (card > 4))
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
157 {
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
158 mp_msg(MSGT_VO, MSGL_ERR, "DVB card number must be between 1 and 4\n");
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
159 return -1;
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
160 }
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
161 card--;
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
162
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
163 #ifdef HAVE_DVB
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
164 if(!ao_file)
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
165 return init_device(card);
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
166 #else
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
167 if(!ao_file)
19222
5500b7fa33c0 if HAVE_DVB isn't set don't fall back to outputting audiograb.mpg by default, fail instead
nicodvb
parents: 19215
diff changeset
168 return vo_mpegpes_fd; //video fd
19184
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
169 #endif
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
170
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
171 vo_mpegpes_fd2=open(ao_file,O_WRONLY|O_CREAT,0666);
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
172 if(vo_mpegpes_fd2<0)
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
173 {
19362
3a998ae2f952 replace calls to perror() with calls to mp_msg()
ivo
parents: 19222
diff changeset
174 mp_msg(MSGT_VO, MSGL_ERR, "ao_mpegpes: %s\n", strerror(errno));
19184
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
175 return -1;
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
176 }
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
177 return vo_mpegpes_fd2;
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
178 }
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
179
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
180 static int my_ao_write(unsigned char* data,int len){
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
181 int orig_len = len;
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
182 #ifdef HAVE_DVB
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
183 #define NFD 1
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
184 struct pollfd pfd[NFD];
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
185
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
186 pfd[0].fd = vo_mpegpes_fd2;
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
187 pfd[0].events = POLLOUT;
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
188
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
189 while(len>0){
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
190 if(poll(pfd,NFD,1)){
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
191 if(pfd[0].revents & POLLOUT){
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
192 int ret=write(vo_mpegpes_fd2,data,len);
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
193 if(ret<=0){
19362
3a998ae2f952 replace calls to perror() with calls to mp_msg()
ivo
parents: 19222
diff changeset
194 mp_msg(MSGT_VO, MSGL_ERR, "ao_mpegpes write: %s\n", strerror(errno));
19184
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
195 usleep(0);
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
196 } else {
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
197 len-=ret;
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
198 data+=ret;
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
199 }
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
200 } else usleep(1000);
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
201 }
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
202 }
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
203
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
204 #else
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
205 if(vo_mpegpes_fd2<0) return 0; // no file
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
206 write(vo_mpegpes_fd2,data,len); // write to file
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
207 #endif
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
208 return orig_len;
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
209 }
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
210
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
211
2708
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
212 // open & setup audio device
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
213 // return: 1=success 0=fail
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
214 static int init(int rate,int channels,int format,int flags){
19184
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
215 if(preinit(NULL)<0) return 0;
7607
8d73a0292932 - init fails if no -vo mpegpes
arpi
parents: 7472
diff changeset
216
8d73a0292932 - init fails if no -vo mpegpes
arpi
parents: 7472
diff changeset
217 ao_data.channels=2;
3095
981a9e5118ce interface to libao2 changed ao_plugin added
anders
parents: 2708
diff changeset
218 ao_data.outburst=2000;
7607
8d73a0292932 - init fails if no -vo mpegpes
arpi
parents: 7472
diff changeset
219 switch(format){
14245
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 14123
diff changeset
220 case AF_FORMAT_S16_LE:
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 14123
diff changeset
221 case AF_FORMAT_S16_BE:
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 14123
diff changeset
222 case AF_FORMAT_MPEG2:
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 14123
diff changeset
223 case AF_FORMAT_AC3:
7607
8d73a0292932 - init fails if no -vo mpegpes
arpi
parents: 7472
diff changeset
224 ao_data.format=format;
8d73a0292932 - init fails if no -vo mpegpes
arpi
parents: 7472
diff changeset
225 break;
8d73a0292932 - init fails if no -vo mpegpes
arpi
parents: 7472
diff changeset
226 default:
14245
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 14123
diff changeset
227 ao_data.format=AF_FORMAT_S16_BE;
7607
8d73a0292932 - init fails if no -vo mpegpes
arpi
parents: 7472
diff changeset
228 }
4300
4ebab79785b7 passing samplerate to LPCM writer - 44, 32 and 96khz are also supported from now
arpi
parents: 3095
diff changeset
229
7607
8d73a0292932 - init fails if no -vo mpegpes
arpi
parents: 7472
diff changeset
230 retry:
4300
4ebab79785b7 passing samplerate to LPCM writer - 44, 32 and 96khz are also supported from now
arpi
parents: 3095
diff changeset
231 switch(rate){
4ebab79785b7 passing samplerate to LPCM writer - 44, 32 and 96khz are also supported from now
arpi
parents: 3095
diff changeset
232 case 48000: freq_id=0;break;
4ebab79785b7 passing samplerate to LPCM writer - 44, 32 and 96khz are also supported from now
arpi
parents: 3095
diff changeset
233 case 96000: freq_id=1;break;
4ebab79785b7 passing samplerate to LPCM writer - 44, 32 and 96khz are also supported from now
arpi
parents: 3095
diff changeset
234 case 44100: freq_id=2;break;
4ebab79785b7 passing samplerate to LPCM writer - 44, 32 and 96khz are also supported from now
arpi
parents: 3095
diff changeset
235 case 32000: freq_id=3;break;
4ebab79785b7 passing samplerate to LPCM writer - 44, 32 and 96khz are also supported from now
arpi
parents: 3095
diff changeset
236 default:
13383
c1955840883d mp_msg transition of unmaintained audio output drivers.
ivo
parents: 12145
diff changeset
237 mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_MPEGPES_UnsupSamplerate, rate);
7607
8d73a0292932 - init fails if no -vo mpegpes
arpi
parents: 7472
diff changeset
238 #if 0
8d73a0292932 - init fails if no -vo mpegpes
arpi
parents: 7472
diff changeset
239 if(rate>48000) rate=96000; else
8d73a0292932 - init fails if no -vo mpegpes
arpi
parents: 7472
diff changeset
240 if(rate>44100) rate=48000; else
8d73a0292932 - init fails if no -vo mpegpes
arpi
parents: 7472
diff changeset
241 if(rate>32000) rate=44100; else
8d73a0292932 - init fails if no -vo mpegpes
arpi
parents: 7472
diff changeset
242 rate=32000;
8d73a0292932 - init fails if no -vo mpegpes
arpi
parents: 7472
diff changeset
243 goto retry;
8d73a0292932 - init fails if no -vo mpegpes
arpi
parents: 7472
diff changeset
244 #else
8d73a0292932 - init fails if no -vo mpegpes
arpi
parents: 7472
diff changeset
245 rate=48000; freq_id=0;
8d73a0292932 - init fails if no -vo mpegpes
arpi
parents: 7472
diff changeset
246 #endif
4300
4ebab79785b7 passing samplerate to LPCM writer - 44, 32 and 96khz are also supported from now
arpi
parents: 3095
diff changeset
247 }
2708
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
248
7607
8d73a0292932 - init fails if no -vo mpegpes
arpi
parents: 7472
diff changeset
249 ao_data.bps=rate*2*2;
8d73a0292932 - init fails if no -vo mpegpes
arpi
parents: 7472
diff changeset
250 freq=ao_data.samplerate=rate;
8d73a0292932 - init fails if no -vo mpegpes
arpi
parents: 7472
diff changeset
251
2708
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
252 return 1;
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
253 }
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
254
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
255 // close audio device
12145
99798c3cdb93 uninit immed flag
alex
parents: 9633
diff changeset
256 static void uninit(int immed){
2708
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
257
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
258 }
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
259
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
260 // stop playing and empty buffers (for seeking/pause)
17566
f580a7755ac5 Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents: 14245
diff changeset
261 static void reset(void){
2708
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
262
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
263 }
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
264
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
265 // stop playing, keep buffers (for pause)
17566
f580a7755ac5 Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents: 14245
diff changeset
266 static void audio_pause(void)
2708
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
267 {
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
268 // for now, just call reset();
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
269 reset();
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
270 }
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
271
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
272 // resume playing, after audio_pause()
17566
f580a7755ac5 Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents: 14245
diff changeset
273 static void audio_resume(void)
2708
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
274 {
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
275 }
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
276
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
277 void send_pes_packet(unsigned char* data,int len,int id,int timestamp);
4300
4ebab79785b7 passing samplerate to LPCM writer - 44, 32 and 96khz are also supported from now
arpi
parents: 3095
diff changeset
278 void send_lpcm_packet(unsigned char* data,int len,int id,int timestamp,int freq_id);
2708
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
279 extern int vo_pts;
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
280
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
281 // return: how many bytes can be played without blocking
17566
f580a7755ac5 Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents: 14245
diff changeset
282 static int get_space(void){
4331
ce1e3668fa2b freq fix, removed muxer delay
arpi
parents: 4305
diff changeset
283 float x=(float)(vo_pts-ao_data.pts)/90000.0;
2708
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
284 int y;
19184
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
285 //FIXME: is it correct?
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
286 if(vo_mpegpes_fd < 0) return 32000; //not using -vo mpegpes
7607
8d73a0292932 - init fails if no -vo mpegpes
arpi
parents: 7472
diff changeset
287 // printf("vo_pts: %5.3f ao_pts: %5.3f\n",vo_pts/90000.0,ao_data.pts/90000.0);
2708
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
288 if(x<=0) return 0;
4331
ce1e3668fa2b freq fix, removed muxer delay
arpi
parents: 4305
diff changeset
289 y=freq*4*x;y/=ao_data.outburst;y*=ao_data.outburst;
ce1e3668fa2b freq fix, removed muxer delay
arpi
parents: 4305
diff changeset
290 if(y>32000) y=32000;
2708
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
291 // printf("diff: %5.3f -> %d \n",x,y);
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
292 return y;
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
293 }
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
294
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
295 // plays 'len' bytes of 'data'
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
296 // it should round it down to outburst*n
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
297 // return: number of bytes played
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
298 static int play(void* data,int len,int flags){
7607
8d73a0292932 - init fails if no -vo mpegpes
arpi
parents: 7472
diff changeset
299 // printf("\nao_mpegpes: play(%d) freq=%d\n",len,freq_id);
14245
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 14123
diff changeset
300 if(ao_data.format==AF_FORMAT_MPEG2)
19184
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
301 send_mpeg_pes_packet (data, len, 0x1C0, ao_data.pts, 1, my_ao_write);
2708
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
302 else {
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
303 int i;
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
304 unsigned short *s=data;
4300
4ebab79785b7 passing samplerate to LPCM writer - 44, 32 and 96khz are also supported from now
arpi
parents: 3095
diff changeset
305 // if(len>2000) len=2000;
4305
624c73ec1c54 10l, debug printf removed
arpi
parents: 4300
diff changeset
306 // printf("ao_mpegpes: len=%d \n",len);
14245
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 14123
diff changeset
307 if(ao_data.format==AF_FORMAT_S16_LE || ao_data.format==AF_FORMAT_AC3)
7607
8d73a0292932 - init fails if no -vo mpegpes
arpi
parents: 7472
diff changeset
308 for(i=0;i<len/2;i++) s[i]=(s[i]>>8)|(s[i]<<8); // le<->be
19184
3f2de7ba8aa0 split the incestous intercourse between ao_mpegpes and vo_mpegpes; now the devices can be used separately
nicodvb
parents: 17566
diff changeset
309 send_mpeg_lpcm_packet(data, len, 0xA0, ao_data.pts, freq_id, my_ao_write);
2708
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
310 }
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
311 return len;
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
312 }
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
313
3095
981a9e5118ce interface to libao2 changed ao_plugin added
anders
parents: 2708
diff changeset
314 // return: delay in seconds between first and last sample in buffer
17566
f580a7755ac5 Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents: 14245
diff changeset
315 static float get_delay(void){
2708
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
316
3095
981a9e5118ce interface to libao2 changed ao_plugin added
anders
parents: 2708
diff changeset
317 return 0.0;
2708
b24661a9924e ao_mpegpes
arpi
parents:
diff changeset
318 }