32 #include "libavutil/channel_layout.h"
34 #include "libavutil/intreadwrite.h"
38 #define RIFF_TAG MKTAG('R', 'I', 'F', 'F')
39 #define CDXA_TAG MKTAG('C', 'D', 'X', 'A')
41 #define RAW_CD_SECTOR_SIZE 2352
42 #define RAW_CD_SECTOR_DATA_SIZE 2304
43 #define VIDEO_DATA_CHUNK_SIZE 0x7E0
44 #define VIDEO_DATA_HEADER_SIZE 0x38
45 #define RIFF_HEADER_SIZE 0x2C
47 #define CDXA_TYPE_MASK 0x0E
48 #define CDXA_TYPE_DATA 0x08
49 #define CDXA_TYPE_AUDIO 0x04
50 #define CDXA_TYPE_VIDEO 0x02
52 #define STR_MAGIC (0x80010160)
69 static const uint8_t sync_header[12] = {0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00};
92 if (sector[0x11] >= 32)
98 int current_sector =
AV_RL16(§or[0x1C]);
99 int sector_count =
AV_RL16(§or[0x1E]);
103 && current_sector < sector_count
118 if(sector[0x13]&0x2A)
123 if(sector[0x12] & CDXA_TYPE_MASK)
131 else if(vid+aud)
return 1;
178 channel = sector[0x11];
188 int current_sector =
AV_RL16(§or[0x1C]);
189 int sector_count =
AV_RL16(§or[0x1E]);
193 && current_sector < sector_count
195 av_log(s,
AV_LOG_ERROR,
"Invalid parameters %d %d %d\n", current_sector, sector_count, frame_size);
230 memcpy(pkt->
data + current_sector*VIDEO_DATA_CHUNK_SIZE,
232 VIDEO_DATA_CHUNK_SIZE);
234 if (current_sector == sector_count-1) {
240 #if FF_API_DESTRUCT_PACKET
253 int fmt = sector[0x13];
282 memcpy(pkt->
data,sector+24,2304);
void av_free_packet(AVPacket *pkt)
Free a packet.
#define AV_LOG_WARNING
Something somehow does not look correct.
int64_t pos
byte position in stream, -1 if unknown
AVCodecContext * codec
Codec context associated with this stream.
int index
stream index in AVFormatContext
static int str_read_header(AVFormatContext *s)
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
#define AV_CH_LAYOUT_STEREO
int ctx_flags
Format-specific flags, see AVFMTCTX_xx.
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs...
AVBufferRef * buf
A reference to the reference-counted buffer where the packet data is stored.
attribute_deprecated void(* destruct)(struct AVPacket *)
static av_cold int end(AVCodecContext *avctx)
AVInputFormat ff_str_demuxer
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
#define VIDEO_DATA_HEADER_SIZE
static av_cold int read_close(AVFormatContext *ctx)
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
int duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
static const uint8_t frame_size[4]
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void * priv_data
Format private data.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
#define RAW_CD_SECTOR_SIZE
uint64_t channel_layout
Audio channel layout.
int buf_size
Size of buf except extra allocated bytes.
common internal API header
#define VIDEO_DATA_CHUNK_SIZE
int width
picture width / height.
static int read_header(FFV1Context *f)
static int str_read_packet(AVFormatContext *s, AVPacket *ret_pkt)
static int str_probe(AVProbeData *p)
enum AVMediaType codec_type
int sample_rate
samples per second
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
AVIOContext * pb
I/O context.
static int read_packet(AVFormatContext *ctx, AVPacket *pkt)
static const uint8_t sync_header[12]
This structure contains the data a format has to probe a file.
#define FF_DISABLE_DEPRECATION_WARNINGS
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base...
static int str_read_close(AVFormatContext *s)
#define AVERROR_INVALIDDATA
#define FF_ENABLE_DEPRECATION_WARNINGS
int channels
number of audio channels
#define AV_CH_LAYOUT_MONO
This structure stores compressed data.