27 #define LXF_MAX_PACKET_HEADER_SIZE 256
28 #define LXF_HEADER_DATA_SIZE 120
29 #define LXF_IDENT "LEITCH\0"
30 #define LXF_IDENT_LENGTH 8
31 #define LXF_SAMPLERATE 48000
72 for (x = 0; x <
size; x += 4)
115 uint32_t
version, audio_format, header_size, channels, tmp;
121 if ((ret =
sync(s, header)) < 0)
124 ret =
avio_read(pb, header + LXF_IDENT_LENGTH, 8);
128 version = bytestream_get_le32(&p);
129 header_size = bytestream_get_le32(&p);
133 if (header_size < (version ? 72 : 60) ||
141 ret =
avio_read(pb, header + (p - header), header_size - (p - header));
142 if (ret != header_size - (p - header))
149 p += version ? 20 : 12;
156 ret = bytestream_get_le32(&p);
159 (int64_t)(uint32_t)
AV_RL32(p + 12));
170 audio_format = bytestream_get_le32(&p);
171 channels = bytestream_get_le32(&p);
172 track_size = bytestream_get_le32(&p);
192 "only 16-, 20-, 24- and 32-bit PCM currently supported\n");
206 "video doesn't seem to be PAL or NTSC. guessing PAL\n");
212 ret = av_popcount(channels) * track_size;
216 tmp = bytestream_get_le32(&p);
217 ret = bytestream_get_le32(&p);
233 uint32_t video_params, disk_params;
234 uint16_t record_date, expiration_date;
252 video_params =
AV_RL32(&header_data[40]);
253 record_date =
AV_RL16(&header_data[56]);
254 expiration_date =
AV_RL16(&header_data[58]);
255 disk_params =
AV_RL32(&header_data[116]);
258 st->
codec->
bit_rate = 1000000 * ((video_params >> 14) & 0xFF);
263 record_date, 1900 + (record_date & 0x7F), (record_date >> 7) & 0xF,
264 (record_date >> 11) & 0x1F);
267 expiration_date, 1900 + (expiration_date & 0x7F), (expiration_date >> 7) & 0xF,
268 (expiration_date >> 11) & 0x1F);
270 if ((video_params >> 22) & 1)
273 if ((lxf->
channels = 1 << (disk_params >> 4 & 3) + 1)) {
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
void av_free_packet(AVPacket *pkt)
Free a packet.
int frame_number
current video frame
#define AV_LOG_WARNING
Something somehow does not look correct.
static int sync(AVFormatContext *s, uint8_t *header)
Read input until we find the next ident.
static int check_checksum(const uint8_t *header, int size)
Verify the checksum of an LXF packet header.
AVInputFormat ff_lxf_demuxer
int channels
number of audio channels. zero means no audio
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
static int lxf_read_header(AVFormatContext *s)
AVStream ** streams
A list of all streams in the file.
#define AVERROR_EOF
End of file.
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
static int lxf_probe(AVProbeData *p)
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.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
void av_log(void *avcl, int level, const char *fmt,...)
AVStream * avformat_new_stream(AVFormatContext *s, AVCodec *c)
Add a new stream to a media file.
int flags
A combination of AV_PKT_FLAG values.
int avio_r8(AVIOContext *s)
AVCodecContext * codec
Codec context associated with this stream.
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
int bit_rate
the average bitrate
static av_always_inline int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
preferred ID for MPEG-1/2 video decoding
#define LXF_MAX_PACKET_HEADER_SIZE
static int read_header(FFV1Context *f)
#define AVERROR_PATCHWELCOME
Not yet implemented in Libav, patches welcome.
#define LXF_HEADER_DATA_SIZE
#define AV_LOG_INFO
Standard information.
enum AVMediaType codec_type
int sample_rate
samples per second
AVIOContext * pb
I/O context.
static int lxf_read_packet(AVFormatContext *s, AVPacket *pkt)
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
static int read_packet(AVFormatContext *ctx, AVPacket *pkt)
static int get_packet_header(AVFormatContext *s)
Read and checksum the next packet header.
This structure contains the data a format has to probe a file.
static const AVCodecTag lxf_tags[]
int64_t duration
Decoding: duration of the stream, in stream time base.
int eof_reached
true if eof reached
int channels
number of audio channels
void * priv_data
Format private data.
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
This structure stores compressed data.