~ubuntu-branches/ubuntu/saucy/gst-libav1.0/saucy-proposed

« back to all changes in this revision

Viewing changes to gst-libs/ext/libav/libavdevice/libcdio.c

  • Committer: Package Import Robot
  • Author(s): Sebastian Dröge
  • Date: 2013-07-30 09:00:15 UTC
  • mfrom: (1.1.16) (7.1.7 experimental)
  • Revision ID: package-import@ubuntu.com-20130730090015-sc1ou2yssu7q5w4e
Tags: 1.1.3-1
* New upstream development snapshot:
  + debian/control:
    - Build depend on GStreamer and gst-plugins-base >= 1.1.3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 * libcdio CD grabbing
24
24
 */
25
25
 
 
26
#include "config.h"
 
27
 
 
28
#if HAVE_CDIO_PARANOIA_H
26
29
#include <cdio/cdda.h>
27
30
#include <cdio/paranoia.h>
 
31
#elif HAVE_CDIO_PARANOIA_PARANOIA_H
 
32
#include <cdio/paranoia/cdda.h>
 
33
#include <cdio/paranoia/paranoia.h>
 
34
#endif
28
35
 
29
36
#include "libavutil/log.h"
30
37
#include "libavutil/mem.h"
33
40
#include "libavformat/avformat.h"
34
41
#include "libavformat/internal.h"
35
42
 
36
 
/* cdio returns some malloced strings that need to be free()d */
37
 
#undef free
38
 
 
39
43
typedef struct CDIOContext {
 
44
    AVClass             *class;
40
45
    cdrom_drive_t       *drive;
41
46
    cdrom_paranoia_t *paranoia;
42
47
    int32_t last_sector;
46
51
    int paranoia_mode;
47
52
} CDIOContext;
48
53
 
49
 
static av_cold int read_header(AVFormatContext *ctx, AVFormatParameters *ap)
 
54
static av_cold int read_header(AVFormatContext *ctx)
50
55
{
51
56
    CDIOContext *s = ctx->priv_data;
52
57
    AVStream *st;
82
87
 
83
88
    st->codec->codec_type      = AVMEDIA_TYPE_AUDIO;
84
89
    if (s->drive->bigendianp)
85
 
        st->codec->codec_id    = CODEC_ID_PCM_S16BE;
 
90
        st->codec->codec_id    = AV_CODEC_ID_PCM_S16BE;
86
91
    else
87
 
        st->codec->codec_id    = CODEC_ID_PCM_S16LE;
 
92
        st->codec->codec_id    = AV_CODEC_ID_PCM_S16LE;
88
93
    st->codec->sample_rate     = 44100;
89
94
    st->codec->channels        = 2;
90
95
    if (s->drive->audio_last_sector != CDIO_INVALID_LSN &&
159
164
#define OFFSET(x) offsetof(CDIOContext, x)
160
165
#define DEC AV_OPT_FLAG_DECODING_PARAM
161
166
static const AVOption options[] = {
162
 
    { "speed",              "Drive reading speed.", OFFSET(speed),         AV_OPT_TYPE_INT,   { 0 }, 0,       INT_MAX, DEC },
163
 
    { "paranoia_mode",      "Error recovery mode.", OFFSET(paranoia_mode), AV_OPT_TYPE_FLAGS, { 0 }, INT_MIN, INT_MAX, DEC, "paranoia_mode" },
164
 
        { "verify",         "Verify data integrity in overlap area", 0,    AV_OPT_TYPE_CONST, { PARANOIA_MODE_VERIFY },    0, 0, DEC, "paranoia_mode" },
165
 
        { "overlap",        "Perform overlapped reads.",             0,    AV_OPT_TYPE_CONST, { PARANOIA_MODE_OVERLAP },   0, 0, DEC, "paranoia_mode" },
166
 
        { "neverskip",      "Do not skip failed reads.",             0,    AV_OPT_TYPE_CONST, { PARANOIA_MODE_NEVERSKIP }, 0, 0, DEC, "paranoia_mode" },
 
167
    { "speed",              "Drive reading speed.", OFFSET(speed),         AV_OPT_TYPE_INT,   { .i64 = 0 }, 0,       INT_MAX, DEC },
 
168
    { "paranoia_mode",      "Error recovery mode.", OFFSET(paranoia_mode), AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT_MIN, INT_MAX, DEC, "paranoia_mode" },
 
169
        { "verify",         "Verify data integrity in overlap area", 0,    AV_OPT_TYPE_CONST, { .i64 = PARANOIA_MODE_VERIFY },    0, 0, DEC, "paranoia_mode" },
 
170
        { "overlap",        "Perform overlapped reads.",             0,    AV_OPT_TYPE_CONST, { .i64 = PARANOIA_MODE_OVERLAP },   0, 0, DEC, "paranoia_mode" },
 
171
        { "neverskip",      "Do not skip failed reads.",             0,    AV_OPT_TYPE_CONST, { .i64 = PARANOIA_MODE_NEVERSKIP }, 0, 0, DEC, "paranoia_mode" },
167
172
    { NULL },
168
173
};
169
174