28#if HAVE_CDIO_PARANOIA_H
30#include <cdio/paranoia.h>
31#elif HAVE_CDIO_PARANOIA_PARANOIA_H
32#include <cdio/paranoia/cdda.h>
33#include <cdio/paranoia/paranoia.h>
63 s->drive = cdio_cddap_identify(
ctx->url, CDDA_MESSAGE_LOGIT, &err);
72 if ((ret = cdio_cddap_open(
s->drive)) < 0 || !
s->drive->opened) {
77 cdio_cddap_verbose_set(
s->drive, CDDA_MESSAGE_LOGIT, CDDA_MESSAGE_LOGIT);
79 cdio_cddap_speed_set(
s->drive,
s->speed);
81 s->paranoia = cdio_paranoia_init(
s->drive);
86 cdio_paranoia_modeset(
s->paranoia,
s->paranoia_mode);
89 if (
s->drive->bigendianp)
95 if (
s->drive->audio_last_sector != CDIO_INVALID_LSN &&
96 s->drive->audio_first_sector != CDIO_INVALID_LSN)
97 st->
duration =
s->drive->audio_last_sector -
s->drive->audio_first_sector;
98 else if (
s->drive->tracks)
99 st->
duration =
s->drive->disc_toc[
s->drive->tracks].dwStartSector;
103 for (
i = 0;
i <
s->drive->tracks;
i++) {
105 snprintf(title,
sizeof(title),
"track %02d",
s->drive->disc_toc[
i].bTrack);
107 s->drive->disc_toc[
i+1].dwStartSector, title);
110 s->last_sector = cdio_cddap_disc_lastsector(
s->drive);
122 buf = cdio_paranoia_read(
s->paranoia,
NULL);
126 if (err = cdio_cddap_errors(
s->drive)) {
131 if (err = cdio_cddap_messages(
s->drive)) {
139 memcpy(
pkt->data, buf, CDIO_CD_FRAMESIZE_RAW);
146 cdio_paranoia_free(
s->paranoia);
147 cdio_cddap_close(
s->drive);
157 cdio_paranoia_seek(
s->paranoia, timestamp, SEEK_SET);
162#define OFFSET(x) offsetof(CDIOContext, x)
163#define DEC AV_OPT_FLAG_DECODING_PARAM
166 {
"paranoia_mode",
"set error recovery mode",
OFFSET(paranoia_mode),
AV_OPT_TYPE_FLAGS, { .i64 = PARANOIA_MODE_DISABLE }, INT_MIN, INT_MAX,
DEC, .unit =
"paranoia_mode" },
167 {
"disable",
"apply no fixups", 0,
AV_OPT_TYPE_CONST, { .i64 = PARANOIA_MODE_DISABLE }, 0, 0,
DEC, .unit =
"paranoia_mode" },
168 {
"verify",
"verify data integrity in overlap area", 0,
AV_OPT_TYPE_CONST, { .i64 = PARANOIA_MODE_VERIFY }, 0, 0,
DEC, .unit =
"paranoia_mode" },
169 {
"overlap",
"perform overlapped reads", 0,
AV_OPT_TYPE_CONST, { .i64 = PARANOIA_MODE_OVERLAP }, 0, 0,
DEC, .unit =
"paranoia_mode" },
170 {
"neverskip",
"do not skip failed reads", 0,
AV_OPT_TYPE_CONST, { .i64 = PARANOIA_MODE_NEVERSKIP }, 0, 0,
DEC, .unit =
"paranoia_mode" },
171 {
"full",
"apply all recovery modes", 0,
AV_OPT_TYPE_CONST, { .i64 = PARANOIA_MODE_FULL }, 0, 0,
DEC, .unit =
"paranoia_mode" },
176 .class_name =
"libcdio indev",
const FFInputFormat ff_libcdio_demuxer
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
#define flags(name, subs,...)
#define i(width, name, range_min, range_max)
AVChapter * avpriv_new_chapter(AVFormatContext *s, int64_t id, AVRational time_base, int64_t start, int64_t end, const char *title)
Add a new chapter.
void avpriv_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp)
Update cur_dts of all streams based on the given timestamp and AVStream.
static int read_header(FFV1Context *f, RangeCoder *c)
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
@ AV_OPT_TYPE_FLAGS
Underlying C type is unsigned int.
@ AV_OPT_TYPE_INT
Underlying C type is int.
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
#define AV_CHANNEL_LAYOUT_STEREO
#define AVERROR_EOF
End of file.
#define AV_LOG_VERBOSE
Detailed information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * av_default_item_name(void *ptr)
Return the context name.
#define LIBAVUTIL_VERSION_INT
static av_cold int read_close(AVFormatContext *ctx)
static int read_packet(AVFormatContext *ctx, AVPacket *pkt)
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
static const AVClass libcdio_class
static av_cold int read_header(AVFormatContext *ctx)
@ AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT
An AVChannelLayout holds information about the channel layout of audio data.
int nb_channels
Number of channels in this layout.
Describe the class of an AVClass context structure.
AVChannelLayout ch_layout
The channel layout and number of channels.
enum AVMediaType codec_type
General type of the encoded data.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
int sample_rate
The number of audio samples per second.
This structure stores compressed data.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
int64_t duration
Decoding: duration of the stream, in stream time base.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
cdrom_paranoia_t * paranoia
static AVFormatContext * ctx