~medibuntu-maintainers/mplayer/medibuntu.precise

« back to all changes in this revision

Viewing changes to ffmpeg/libavdevice/alsa-audio-dec.c

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2012-01-12 22:23:28 UTC
  • mfrom: (0.4.7 sid)
  • mto: This revision was merged to the branch mainline in revision 76.
  • Revision ID: package-import@ubuntu.com-20120112222328-8jqdyodym3p84ygu
Tags: 2:1.0~rc4.dfsg1+svn34540-1
* New upstream snapshot
* upload to unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
 
48
48
#include <alsa/asoundlib.h>
49
49
#include "libavformat/avformat.h"
 
50
#include "libavformat/internal.h"
50
51
#include "libavutil/opt.h"
51
52
 
52
53
#include "alsa-audio.h"
60
61
    enum CodecID codec_id;
61
62
    snd_pcm_sw_params_t *sw_params;
62
63
 
63
 
#if FF_API_FORMAT_PARAMETERS
64
 
    if (ap->sample_rate > 0)
65
 
        s->sample_rate = ap->sample_rate;
66
 
 
67
 
    if (ap->channels > 0)
68
 
        s->channels = ap->channels;
69
 
#endif
70
 
 
71
 
    st = av_new_stream(s1, 0);
 
64
    st = avformat_new_stream(s1, NULL);
72
65
    if (!st) {
73
66
        av_log(s1, AV_LOG_ERROR, "Cannot add stream\n");
74
67
 
110
103
    st->codec->codec_id    = codec_id;
111
104
    st->codec->sample_rate = s->sample_rate;
112
105
    st->codec->channels    = s->channels;
113
 
    av_set_pts_info(st, 64, 1, 1000000);  /* 64 bits pts in us */
 
106
    avpriv_set_pts_info(st, 64, 1, 1000000);  /* 64 bits pts in us */
114
107
 
115
108
    return 0;
116
109
 
159
152
}
160
153
 
161
154
static const AVOption options[] = {
162
 
    { "sample_rate", "", offsetof(AlsaData, sample_rate), FF_OPT_TYPE_INT, {.dbl = 48000}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
163
 
    { "channels",    "", offsetof(AlsaData, channels),    FF_OPT_TYPE_INT, {.dbl = 2},     1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
 
155
    { "sample_rate", "", offsetof(AlsaData, sample_rate), AV_OPT_TYPE_INT, {.dbl = 48000}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
 
156
    { "channels",    "", offsetof(AlsaData, channels),    AV_OPT_TYPE_INT, {.dbl = 2},     1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
164
157
    { NULL },
165
158
};
166
159
 
172
165
};
173
166
 
174
167
AVInputFormat ff_alsa_demuxer = {
175
 
    "alsa",
176
 
    NULL_IF_CONFIG_SMALL("ALSA audio input"),
177
 
    sizeof(AlsaData),
178
 
    NULL,
179
 
    audio_read_header,
180
 
    audio_read_packet,
181
 
    ff_alsa_close,
182
 
    .flags = AVFMT_NOFILE,
183
 
    .priv_class = &alsa_demuxer_class,
 
168
    .name           = "alsa",
 
169
    .long_name      = NULL_IF_CONFIG_SMALL("ALSA audio input"),
 
170
    .priv_data_size = sizeof(AlsaData),
 
171
    .read_header    = audio_read_header,
 
172
    .read_packet    = audio_read_packet,
 
173
    .read_close     = ff_alsa_close,
 
174
    .flags          = AVFMT_NOFILE,
 
175
    .priv_class     = &alsa_demuxer_class,
184
176
};