X-Git-Url: http://git.ffmpeg.org/gitweb/ffmpeg.git/blobdiff_plain/c3f9ebf74371b63fba0e7491e61904bbd165cd0f..e90a6846c2c006fbebd00e1f2789f4a86fafacef:/libavdevice/libcdio.c?ds=sidebyside diff --git a/libavdevice/libcdio.c b/libavdevice/libcdio.c index e00272c..06ddb4a 100644 --- a/libavdevice/libcdio.c +++ b/libavdevice/libcdio.c @@ -23,8 +23,15 @@ * libcdio CD grabbing */ +#include "config.h" + +#if HAVE_CDIO_PARANOIA_H #include #include +#elif HAVE_CDIO_PARANOIA_PARANOIA_H +#include +#include +#endif #include "libavutil/log.h" #include "libavutil/mem.h" @@ -33,10 +40,8 @@ #include "libavformat/avformat.h" #include "libavformat/internal.h" -/* cdio returns some malloced strings that need to be free()d */ -#undef free - typedef struct CDIOContext { + AVClass *class; cdrom_drive_t *drive; cdrom_paranoia_t *paranoia; int32_t last_sector; @@ -46,7 +51,7 @@ typedef struct CDIOContext { int paranoia_mode; } CDIOContext; -static av_cold int read_header(AVFormatContext *ctx, AVFormatParameters *ap) +static av_cold int read_header(AVFormatContext *ctx) { CDIOContext *s = ctx->priv_data; AVStream *st; @@ -82,9 +87,9 @@ static av_cold int read_header(AVFormatContext *ctx, AVFormatParameters *ap) st->codec->codec_type = AVMEDIA_TYPE_AUDIO; if (s->drive->bigendianp) - st->codec->codec_id = CODEC_ID_PCM_S16BE; + st->codec->codec_id = AV_CODEC_ID_PCM_S16BE; else - st->codec->codec_id = CODEC_ID_PCM_S16LE; + st->codec->codec_id = AV_CODEC_ID_PCM_S16LE; st->codec->sample_rate = 44100; st->codec->channels = 2; if (s->drive->audio_last_sector != CDIO_INVALID_LSN && @@ -159,11 +164,11 @@ static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, #define OFFSET(x) offsetof(CDIOContext, x) #define DEC AV_OPT_FLAG_DECODING_PARAM static const AVOption options[] = { - { "speed", "Drive reading speed.", OFFSET(speed), AV_OPT_TYPE_INT, { 0 }, 0, INT_MAX, DEC }, - { "paranoia_mode", "Error recovery mode.", OFFSET(paranoia_mode), AV_OPT_TYPE_FLAGS, { 0 }, INT_MIN, INT_MAX, DEC, "paranoia_mode" }, - { "verify", "Verify data integrity in overlap area", 0, AV_OPT_TYPE_CONST, { PARANOIA_MODE_VERIFY }, 0, 0, DEC, "paranoia_mode" }, - { "overlap", "Perform overlapped reads.", 0, AV_OPT_TYPE_CONST, { PARANOIA_MODE_OVERLAP }, 0, 0, DEC, "paranoia_mode" }, - { "neverskip", "Do not skip failed reads.", 0, AV_OPT_TYPE_CONST, { PARANOIA_MODE_NEVERSKIP }, 0, 0, DEC, "paranoia_mode" }, + { "speed", "Drive reading speed.", OFFSET(speed), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, DEC }, + { "paranoia_mode", "Error recovery mode.", OFFSET(paranoia_mode), AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT_MIN, INT_MAX, DEC, "paranoia_mode" }, + { "verify", "Verify data integrity in overlap area", 0, AV_OPT_TYPE_CONST, { .i64 = PARANOIA_MODE_VERIFY }, 0, 0, DEC, "paranoia_mode" }, + { "overlap", "Perform overlapped reads.", 0, AV_OPT_TYPE_CONST, { .i64 = PARANOIA_MODE_OVERLAP }, 0, 0, DEC, "paranoia_mode" }, + { "neverskip", "Do not skip failed reads.", 0, AV_OPT_TYPE_CONST, { .i64 = PARANOIA_MODE_NEVERSKIP }, 0, 0, DEC, "paranoia_mode" }, { NULL }, };