27 #define LXF_PACKET_HEADER_SIZE 60
28 #define LXF_HEADER_DATA_SIZE 120
29 #define LXF_IDENT "LEITCH\0"
30 #define LXF_IDENT_LENGTH 8
31 #define LXF_SAMPLERATE 48000
32 #define LXF_MAX_AUDIO_PACKET (8008*15*4)
120 if ((ret =
sync(s, header)) < 0)
133 *format =
AV_RL32(&header[32]);
137 switch (
AV_RL32(&header[16])) {
142 (int64_t)(uint32_t)
AV_RL32(&header[52]));
153 *format =
AV_RL32(&header[40]);
168 "only 16-, 20-, 24- and 32-bit PCM currently supported\n");
172 track_size =
AV_RL32(&header[48]);
183 "video doesn't seem to be PAL or NTSC. guessing PAL\n");
189 ret = av_popcount(
AV_RL32(&header[44])) * track_size;
206 uint32_t format, video_params, disk_params;
207 uint16_t record_date, expiration_date;
225 video_params =
AV_RL32(&header_data[40]);
226 record_date =
AV_RL16(&header_data[56]);
227 expiration_date =
AV_RL16(&header_data[58]);
228 disk_params =
AV_RL32(&header_data[116]);
231 st->
codec->
bit_rate = 1000000 * ((video_params >> 14) & 0xFF);
236 record_date, 1900 + (record_date & 0x7F), (record_date >> 7) & 0xF,
237 (record_date >> 11) & 0x1F);
240 expiration_date, 1900 + (expiration_date & 0x7F), (expiration_date >> 7) & 0xF,
241 (expiration_date >> 11) & 0x1F);
243 if ((video_params >> 22) & 1)
246 if ((lxf->
channels = (disk_params >> 2) & 0xF)) {
276 for (z = i = 0; z < lxf->
channels; z++)
277 for (y = 0; y < bytes / bytes_per_sample / lxf->
channels; y++)
278 for (x = 0; x < bytes_per_sample; x++, i++)
279 out[x + bytes_per_sample*(z + y*lxf->
channels)] = lxf->
temp[i];
288 uint32_t stream, format;
301 if (stream == 1 && !(ast = s->
streams[1])) {
319 if ((ret2 =
avio_read(pb, buf, ret)) != ret) {
331 if (((format >> 22) & 0x3) < 2)
static int check_checksum(const uint8_t *header)
Verify the checksum of an LXF packet header.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int frame_number
current video frame
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
#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 void deplanarize(LXFDemuxContext *lxf, AVStream *ast, uint8_t *out, int bytes)
De-planerize the PCM data in lxf->temp FIXME: remove this once support for planar audio is added to l...
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
AVInputFormat ff_lxf_demuxer
int channels
number of audio channels. zero means no audio
#define LXF_MAX_AUDIO_PACKET
15-channel 32-bit NTSC audio frame
static int read_header(FFV1Context *f)
void av_free_packet(AVPacket *pkt)
Free a packet.
#define AVERROR_EOF
End of file.
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
enum CodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag)
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
preferred ID for MPEG-1/2 video decoding
static int lxf_probe(AVProbeData *p)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
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.
static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
int flags
A combination of AV_PKT_FLAG values.
int avio_r8(AVIOContext *s)
AVCodecContext * codec
codec context
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
int bit_rate
the average bitrate
#define LXF_PACKET_HEADER_SIZE
static av_always_inline int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
internal header for RIFF based (de)muxers do NOT include this in end user applications ...
static int read_probe(AVProbeData *p)
uint8_t temp[LXF_MAX_AUDIO_PACKET]
temp buffer for de-planarizing the audio data
#define AVERROR_PATCHWELCOME
Not yet implemented in Libav, patches welcome.
#define LXF_HEADER_DATA_SIZE
enum AVMediaType codec_type
int sample_rate
samples per second
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
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)
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.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
int eof_reached
true if eof reached
int channels
number of audio channels
void * priv_data
Format private data.
static int get_packet_header(AVFormatContext *s, uint8_t *header, uint32_t *format)
Read and checksum the next packet header.
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...