~ubuntu-branches/ubuntu/karmic/mpg123/karmic

« back to all changes in this revision

Viewing changes to src/output/alsa.c

  • Committer: Bazaar Package Importer
  • Author(s): César Muñoz Albitres
  • Date: 2009-05-03 17:55:27 UTC
  • mfrom: (6.2.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090503175527-z94edsnxmiccxpy8
Tags: 1.7.2-3ubuntu1
* Merge from debian unstable, remaining changes:
  - Remove arts from dependencies

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
        { SND_PCM_FORMAT_S8,     MPG123_ENC_SIGNED_8    },
34
34
        { SND_PCM_FORMAT_A_LAW,  MPG123_ENC_ALAW_8      },
35
35
        { SND_PCM_FORMAT_MU_LAW, MPG123_ENC_ULAW_8      },
 
36
        { SND_PCM_FORMAT_S32,    MPG123_ENC_SIGNED_32   },
 
37
        { SND_PCM_FORMAT_U32,    MPG123_ENC_UNSIGNED_32 },
 
38
        { SND_PCM_FORMAT_FLOAT,  MPG123_ENC_FLOAT_32    },
 
39
        { SND_PCM_FORMAT_FLOAT64, MPG123_ENC_FLOAT_64   }
36
40
};
37
41
#define NUM_FORMATS (sizeof format_map / sizeof format_map[0])
38
42
 
136
140
        return 0;
137
141
}
138
142
 
139
 
void error_ignorer(const char *file, int line, const char *function, int err, const char *fmt,...)
 
143
static void error_ignorer(const char *file, int line, const char *function, int err, const char *fmt,...)
140
144
{
141
145
        /* I can make ALSA silent. */
142
146
}
210
214
        if (written >= 0)
211
215
                return snd_pcm_frames_to_bytes(pcm, written);
212
216
        else
213
 
                return written;
 
217
        {
 
218
                if(snd_pcm_state(pcm) == SND_PCM_STATE_SUSPENDED)
 
219
                {
 
220
                        /* Iamnothappyabouthisnothappyreallynot. */
 
221
                        snd_pcm_resume(pcm);
 
222
                        if(snd_pcm_state(pcm) == SND_PCM_STATE_SUSPENDED)
 
223
                        {
 
224
                                error("device still suspended after resume hackery... giving up");
 
225
                                return -1;
 
226
                        }
 
227
                }
 
228
                return 0;
 
229
        }
214
230
}
215
231
 
216
232
static void flush_alsa(audio_output_t *ao)
218
234
        snd_pcm_t *pcm=(snd_pcm_t*)ao->userptr;
219
235
 
220
236
        /* is this the optimal solution? - we should figure out what we really whant from this function */
 
237
 
 
238
debug("alsa drop");
221
239
        snd_pcm_drop(pcm);
 
240
debug("alsa prepare");
222
241
        snd_pcm_prepare(pcm);
 
242
debug("alsa flush done");
223
243
}
224
244
 
225
245
static int close_alsa(audio_output_t *ao)