Mercurial > mplayer.hg
annotate libmpcodecs/ad_hwmpa.c @ 30496:26f673ba0675
Remove extern "C" declarations from loader code.
Our loader code is not a general-purpose library and not used from C++.
author | diego |
---|---|
date | Thu, 11 Feb 2010 14:33:57 +0000 |
parents | bbb6ebec87a0 |
children | cc27da5d7286 |
rev | line source |
---|---|
30421
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
1 /* |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
2 * This file is part of MPlayer. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
3 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
4 * MPlayer is free software; you can redistribute it and/or modify |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
6 * the Free Software Foundation; either version 2 of the License, or |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
7 * (at your option) any later version. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
8 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
9 * MPlayer is distributed in the hope that it will be useful, |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
12 * GNU General Public License for more details. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
13 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
14 * You should have received a copy of the GNU General Public License along |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
17 */ |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
18 |
17397
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
19 #include <stdio.h> |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
20 #include <stdlib.h> |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
21 #include <string.h> |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
22 #include <unistd.h> |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
23 |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
24 #include "config.h" |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
25 |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
26 #include "mp_msg.h" |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
27 #include "help_mp.h" |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
28 |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
29 #include "libaf/af_format.h" |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
30 #include "ad_internal.h" |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
31 |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
32 #include "libmpdemux/mp3_hdr.h" |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
33 |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
34 //based on ad_hwac3.c and ad_libmad.c |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
35 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
21531
diff
changeset
|
36 static ad_info_t info = |
17397
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
37 { |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
38 "MPEG audio pass-through (fake decoder)", |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
39 "hwmpa", |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
40 "NicoDVB", |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
41 "NicoDVB", |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
42 "For hardware decoders" |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
43 }; |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
44 |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
45 LIBAD_EXTERN(hwmpa) |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
46 |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
47 static int mpa_sync(sh_audio_t *sh, int no_frames, int *n, int *chans, int *srate, int *spf, int *mpa_layer, int *br) |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
48 { |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
49 int cnt = 0, x = 0, len, frames_count; |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
50 |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
51 frames_count = 0; |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
52 do |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
53 { |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
54 while(cnt + 4 < sh->a_in_buffer_len) |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
55 { |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
56 x = mp_get_mp3_header(&(sh->a_in_buffer[cnt]), chans, srate, spf, mpa_layer, br); |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
57 if(x > 0) |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
58 { |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
59 frames_count++; |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
60 if(frames_count == no_frames) |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
61 { |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
62 *n = x; |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
63 return cnt; |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
64 } |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
65 } |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
66 cnt++; |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
67 } |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
68 len = demux_read_data(sh->ds,&sh->a_in_buffer[sh->a_in_buffer_len],sh->a_in_buffer_size-sh->a_in_buffer_len); |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
69 if(len > 0) |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
70 sh->a_in_buffer_len += len; |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
71 } while(len > 0); |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
72 mp_msg(MSGT_DECAUDIO,MSGL_INFO,"Cannot sync MPA frame: %d\r\n", len); |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
73 return -1; |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
74 } |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
75 |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
76 static int preinit(sh_audio_t *sh) |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
77 { |
19157
597866a6793d
the value returned by decode_audio() must be the amount of _decoded_ bytes (finally it's beginning t work: no more toomanypackets... message)
nicodvb
parents:
19120
diff
changeset
|
78 sh->audio_out_minsize = 4608;//check |
17397
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
79 sh->audio_in_minsize = 4608;//check |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
80 sh->sample_format = AF_FORMAT_MPEG2; |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
81 return 1; |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
82 } |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
83 |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
84 static int init(sh_audio_t *sh) |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
85 { |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
86 int cnt, chans, srate, spf, mpa_layer, br, len; |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
87 |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
88 if((cnt = mpa_sync(sh, 1, &len, &chans, &srate, &spf, &mpa_layer, &br)) < 0) |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
89 return 0; |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
90 |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
91 sh->channels = chans; |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
92 sh->samplerate = srate; |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
93 sh->i_bps = br * 125; |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
94 sh->samplesize = 2; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
21531
diff
changeset
|
95 |
17397
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
96 mp_msg(MSGT_DECAUDIO,MSGL_V,"AC_HWMPA initialized, bitrate: %d kb/s\r\n", len); |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
97 return 1; |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
98 } |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
99 |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
100 static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen) |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
101 { |
19120
017a563d8d93
prevent buffer underflow; the code is still incorrect and leads to desync but at least it doesn't crash
nicodvb
parents:
18958
diff
changeset
|
102 int len, start, tot; |
17397
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
103 int chans, srate, spf, mpa_layer, br; |
19157
597866a6793d
the value returned by decode_audio() must be the amount of _decoded_ bytes (finally it's beginning t work: no more toomanypackets... message)
nicodvb
parents:
19120
diff
changeset
|
104 int tot2; |
17397
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
105 |
19157
597866a6793d
the value returned by decode_audio() must be the amount of _decoded_ bytes (finally it's beginning t work: no more toomanypackets... message)
nicodvb
parents:
19120
diff
changeset
|
106 tot = tot2 = 0; |
19120
017a563d8d93
prevent buffer underflow; the code is still incorrect and leads to desync but at least it doesn't crash
nicodvb
parents:
18958
diff
changeset
|
107 |
19157
597866a6793d
the value returned by decode_audio() must be the amount of _decoded_ bytes (finally it's beginning t work: no more toomanypackets... message)
nicodvb
parents:
19120
diff
changeset
|
108 while(tot2 < maxlen) |
17397
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
109 { |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
110 start = mpa_sync(sh, 1, &len, &chans, &srate, &spf, &mpa_layer, &br); |
19157
597866a6793d
the value returned by decode_audio() must be the amount of _decoded_ bytes (finally it's beginning t work: no more toomanypackets... message)
nicodvb
parents:
19120
diff
changeset
|
111 if(start < 0 || tot2 + spf * 2 * chans > maxlen) |
17397
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
112 break; |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
113 |
19120
017a563d8d93
prevent buffer underflow; the code is still incorrect and leads to desync but at least it doesn't crash
nicodvb
parents:
18958
diff
changeset
|
114 if(start + len > sh->a_in_buffer_len) |
017a563d8d93
prevent buffer underflow; the code is still incorrect and leads to desync but at least it doesn't crash
nicodvb
parents:
18958
diff
changeset
|
115 { |
017a563d8d93
prevent buffer underflow; the code is still incorrect and leads to desync but at least it doesn't crash
nicodvb
parents:
18958
diff
changeset
|
116 int l; |
21531
a90aa203186c
Get rid of min/max macros from aviheader.h, they do not belong here.
reimar
parents:
19286
diff
changeset
|
117 l = FFMIN(sh->a_in_buffer_size - sh->a_in_buffer_len, start + len); |
19120
017a563d8d93
prevent buffer underflow; the code is still incorrect and leads to desync but at least it doesn't crash
nicodvb
parents:
18958
diff
changeset
|
118 l = demux_read_data(sh->ds,&sh->a_in_buffer[sh->a_in_buffer_len], l); |
017a563d8d93
prevent buffer underflow; the code is still incorrect and leads to desync but at least it doesn't crash
nicodvb
parents:
18958
diff
changeset
|
119 if(! l) |
19159
7945609397b0
in decode_audio() memset(0) unused memory in buf before returning
nicodvb
parents:
19158
diff
changeset
|
120 break; |
19120
017a563d8d93
prevent buffer underflow; the code is still incorrect and leads to desync but at least it doesn't crash
nicodvb
parents:
18958
diff
changeset
|
121 sh->a_in_buffer_len += l; |
017a563d8d93
prevent buffer underflow; the code is still incorrect and leads to desync but at least it doesn't crash
nicodvb
parents:
18958
diff
changeset
|
122 continue; |
017a563d8d93
prevent buffer underflow; the code is still incorrect and leads to desync but at least it doesn't crash
nicodvb
parents:
18958
diff
changeset
|
123 } |
017a563d8d93
prevent buffer underflow; the code is still incorrect and leads to desync but at least it doesn't crash
nicodvb
parents:
18958
diff
changeset
|
124 |
017a563d8d93
prevent buffer underflow; the code is still incorrect and leads to desync but at least it doesn't crash
nicodvb
parents:
18958
diff
changeset
|
125 memcpy(&buf[tot], &(sh->a_in_buffer[start]), len); |
017a563d8d93
prevent buffer underflow; the code is still incorrect and leads to desync but at least it doesn't crash
nicodvb
parents:
18958
diff
changeset
|
126 tot += len; |
017a563d8d93
prevent buffer underflow; the code is still incorrect and leads to desync but at least it doesn't crash
nicodvb
parents:
18958
diff
changeset
|
127 |
17397
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
128 sh->a_in_buffer_len -= start + len; |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
129 memmove(sh->a_in_buffer, &(sh->a_in_buffer[start + len]), sh->a_in_buffer_len); |
19157
597866a6793d
the value returned by decode_audio() must be the amount of _decoded_ bytes (finally it's beginning t work: no more toomanypackets... message)
nicodvb
parents:
19120
diff
changeset
|
130 tot2 += spf * 2 * chans; |
19286 | 131 |
132 /* HACK: seems to fix most A/V sync issues */ | |
133 break; | |
17397
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
134 } |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
135 |
19159
7945609397b0
in decode_audio() memset(0) unused memory in buf before returning
nicodvb
parents:
19158
diff
changeset
|
136 memset(&buf[tot], 0, tot2-tot); |
19157
597866a6793d
the value returned by decode_audio() must be the amount of _decoded_ bytes (finally it's beginning t work: no more toomanypackets... message)
nicodvb
parents:
19120
diff
changeset
|
137 return tot2; |
17397
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
138 } |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
139 |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
140 |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
141 static int control(sh_audio_t *sh,int cmd,void* arg, ...) |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
142 { |
18958
a8e681ad7c90
Remove unused variables, patch by Stefan Huehner stefan at huehner org.
diego
parents:
17397
diff
changeset
|
143 int start, len; |
17397
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
144 |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
145 switch(cmd) |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
146 { |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
147 case ADCTRL_RESYNC_STREAM: |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
148 if(mpa_sync(sh, 1, &len, NULL, NULL, NULL, NULL, NULL) >= 0) |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
149 return CONTROL_TRUE; |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
150 else |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
151 return CONTROL_FALSE; |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
152 case ADCTRL_SKIP_FRAME: |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
153 start = mpa_sync(sh, 2, &len, NULL, NULL, NULL, NULL, NULL); |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
154 if(len < 0) |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
155 return CONTROL_FALSE; |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
156 |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
157 sh->a_in_buffer_len -= start; |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
158 memmove(sh->a_in_buffer, &(sh->a_in_buffer[start]), sh->a_in_buffer_len); |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
159 return CONTROL_TRUE; |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
160 } |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
161 return CONTROL_UNKNOWN; |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
162 } |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
163 |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
164 |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
165 static void uninit(sh_audio_t *sh) |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
166 { |
2e20dd653147
ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents:
diff
changeset
|
167 } |