Changeset e43b973a16b4dbf594d90947bbb6228b51604b70
- Timestamp:
- 13/12/07 16:14:10
(1 year ago)
- Author:
- Richard Hosking <hovis@videolan.org>
- git-committer:
- Richard Hosking <hovis@videolan.org> 1197558850 +0000
- git-parent:
[191479d73b82fcfcfe55e0efb7a0088ac0e418ac]
- git-author:
- Richard Hosking <hovis@videolan.org> 1197558850 +0000
- Message:
v4l2: ALSA error handling.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r2d40161 |
re43b973 |
|
| 36 | 36 | /* |
|---|
| 37 | 37 | * TODO: Tuner partial implementation. |
|---|
| 38 | | * TODO: Alsa input support - experimental |
|---|
| 39 | 38 | */ |
|---|
| 40 | 39 | |
|---|
| … | … | |
| 1130 | 1129 | /* ALSA */ |
|---|
| 1131 | 1130 | i_read = snd_pcm_readi( p_sys->p_alsa_pcm, p_block->p_buffer, p_sys->i_alsa_chunk_size ); |
|---|
| 1132 | | /* TODO: ALSA ERROR HANDLING?? xrun?? */ |
|---|
| 1133 | | |
|---|
| 1134 | | /* convert from frames to bytes */ |
|---|
| 1135 | | if( i_read > 0 ) i_read *= p_sys->i_alsa_frame_size; |
|---|
| | 1131 | if( i_read <= 0 ) |
|---|
| | 1132 | { |
|---|
| | 1133 | int i_resume; |
|---|
| | 1134 | switch( i_read ) |
|---|
| | 1135 | { |
|---|
| | 1136 | case -EAGAIN: |
|---|
| | 1137 | break; |
|---|
| | 1138 | case -EPIPE: |
|---|
| | 1139 | /* xrun */ |
|---|
| | 1140 | snd_pcm_prepare( p_sys->p_alsa_pcm ); |
|---|
| | 1141 | break; |
|---|
| | 1142 | case -ESTRPIPE: |
|---|
| | 1143 | /* suspend */ |
|---|
| | 1144 | i_resume = snd_pcm_resume( p_sys->p_alsa_pcm ); |
|---|
| | 1145 | if( i_resume < 0 && i_resume != -EAGAIN ) snd_pcm_prepare( p_sys->p_alsa_pcm ); |
|---|
| | 1146 | break; |
|---|
| | 1147 | default: |
|---|
| | 1148 | msg_Err( p_demux, "Failed to read alsa frame (%s)", snd_strerror( i_read ) ); |
|---|
| | 1149 | return 0; |
|---|
| | 1150 | } |
|---|
| | 1151 | } |
|---|
| | 1152 | else |
|---|
| | 1153 | { |
|---|
| | 1154 | /* convert from frames to bytes */ |
|---|
| | 1155 | i_read *= p_sys->i_alsa_frame_size; |
|---|
| | 1156 | } |
|---|
| 1136 | 1157 | } |
|---|
| 1137 | 1158 | else |
|---|
| … | … | |
| 1154 | 1175 | #endif |
|---|
| 1155 | 1176 | { |
|---|
| | 1177 | /* OSS */ |
|---|
| 1156 | 1178 | if( ioctl( p_sys->i_fd_audio, SNDCTL_DSP_GETISPACE, &buf_info ) == 0 ) |
|---|
| 1157 | 1179 | { |
|---|
| … | … | |
| 1162 | 1184 | else |
|---|
| 1163 | 1185 | { |
|---|
| 1164 | | /* TODO: ALSA timing */ |
|---|
| 1165 | | /* Very experimental code... */ |
|---|
| | 1186 | /* ALSA */ |
|---|
| 1166 | 1187 | int i_err; |
|---|
| 1167 | 1188 | snd_pcm_sframes_t delay = 0; |
|---|