~ppsspp/ppsspp/ffmpeg

« back to all changes in this revision

Viewing changes to libavdevice/alsa-audio-enc.c

  • Committer: Henrik Rydgård
  • Date: 2014-01-03 10:44:32 UTC
  • Revision ID: git-v1:87c6c126784b1718bfa448ecf2e6a9fef781eb4e
Update our ffmpeg snapshot to a clone of the official repository.

This is because Maxim's at3plus support has been officially merged!

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
static av_cold int audio_write_header(AVFormatContext *s1)
48
48
{
49
49
    AlsaData *s = s1->priv_data;
50
 
    AVStream *st;
 
50
    AVStream *st = NULL;
51
51
    unsigned int sample_rate;
52
52
    enum AVCodecID codec_id;
53
53
    int res;
54
54
 
 
55
    if (s1->nb_streams != 1 || s1->streams[0]->codec->codec_type != AVMEDIA_TYPE_AUDIO) {
 
56
        av_log(s1, AV_LOG_ERROR, "Only a single audio stream is supported.\n");
 
57
        return AVERROR(EINVAL);
 
58
    }
55
59
    st = s1->streams[0];
 
60
 
56
61
    sample_rate = st->codec->sample_rate;
57
62
    codec_id    = st->codec->codec_id;
58
63
    res = ff_alsa_open(s1, SND_PCM_STREAM_PLAYBACK, &sample_rate,
80
85
    uint8_t *buf = pkt->data;
81
86
 
82
87
    size /= s->frame_size;
 
88
    if (pkt->dts != AV_NOPTS_VALUE)
 
89
        s->timestamp = pkt->dts;
 
90
    s->timestamp += pkt->duration ? pkt->duration : size;
 
91
 
83
92
    if (s->reorder_func) {
84
93
        if (size > s->reorder_buf_size)
85
94
            if (ff_alsa_extend_reorder_buf(s, size))
112
121
    snd_pcm_sframes_t delay = 0;
113
122
    *wall = av_gettime();
114
123
    snd_pcm_delay(s->h, &delay);
115
 
    *dts = s1->streams[0]->cur_dts - delay;
 
124
    *dts = s->timestamp - delay;
116
125
}
117
126
 
118
127
AVOutputFormat ff_alsa_muxer = {