#include <string.h>#include "avformat.h"Go to the source code of this file.
Defines | |
| #define | MAX_READ_SIZE 4096 |
Functions | |
| static int | apc_probe (AVProbeData *p) |
| static int | apc_read_header (AVFormatContext *s, AVFormatParameters *ap) |
| static int | apc_read_packet (AVFormatContext *s, AVPacket *pkt) |
Variables | |
| AVInputFormat | apc_demuxer |
| #define MAX_READ_SIZE 4096 |
| static int apc_probe | ( | AVProbeData * | p | ) | [static] |
Definition at line 25 of file apc.c.
References AVPROBE_SCORE_MAX, and AVProbeData::buf.
00026 { 00027 if (!strncmp(p->buf, "CRYO_APC", 8)) 00028 return AVPROBE_SCORE_MAX; 00029 00030 return 0; 00031 }
| static int apc_read_header | ( | AVFormatContext * | s, | |
| AVFormatParameters * | ap | |||
| ) | [static] |
Definition at line 33 of file apc.c.
References av_malloc(), av_new_stream(), AVERROR, AVCodecContext::bit_rate, AVCodecContext::bits_per_sample, AVCodecContext::block_align, AVCodecContext::channels, AVStream::codec, AVCodecContext::codec_id, CODEC_ID_ADPCM_IMA_WS, AVCodecContext::codec_type, CODEC_TYPE_AUDIO, AVCodecContext::extradata, AVCodecContext::extradata_size, FF_INPUT_BUFFER_PADDING_SIZE, get_buffer(), get_le32(), AVFormatContext::pb, and AVCodecContext::sample_rate.
00034 { 00035 ByteIOContext *pb = s->pb; 00036 AVStream *st; 00037 00038 get_le32(pb); /* CRYO */ 00039 get_le32(pb); /* _APC */ 00040 get_le32(pb); /* 1.20 */ 00041 00042 st = av_new_stream(s, 0); 00043 if (!st) 00044 return AVERROR(ENOMEM); 00045 00046 st->codec->codec_type = CODEC_TYPE_AUDIO; 00047 st->codec->codec_id = CODEC_ID_ADPCM_IMA_WS; 00048 00049 get_le32(pb); /* number of samples */ 00050 st->codec->sample_rate = get_le32(pb); 00051 00052 st->codec->extradata_size = 2 * 4; 00053 st->codec->extradata = av_malloc(st->codec->extradata_size + 00054 FF_INPUT_BUFFER_PADDING_SIZE); 00055 if (!st->codec->extradata) 00056 return AVERROR(ENOMEM); 00057 00058 /* initial predictor values for adpcm decoder */ 00059 get_buffer(pb, st->codec->extradata, 2 * 4); 00060 00061 st->codec->channels = 1; 00062 if (get_le32(pb)) 00063 st->codec->channels = 2; 00064 00065 st->codec->bits_per_sample = 4; 00066 st->codec->bit_rate = st->codec->bits_per_sample * st->codec->channels 00067 * st->codec->sample_rate; 00068 st->codec->block_align = 1; 00069 00070 return 0; 00071 }
| static int apc_read_packet | ( | AVFormatContext * | s, | |
| AVPacket * | pkt | |||
| ) | [static] |
Definition at line 75 of file apc.c.
References av_get_packet(), AVERROR, MAX_READ_SIZE, AVFormatContext::pb, and AVPacket::stream_index.
00076 { 00077 if (av_get_packet(s->pb, pkt, MAX_READ_SIZE) <= 0) 00078 return AVERROR(EIO); 00079 pkt->stream_index = 0; 00080 return 0; 00081 }
Initial value:
{
"apc",
NULL_IF_CONFIG_SMALL("CRYO APC format"),
0,
apc_probe,
apc_read_header,
apc_read_packet,
}
1.5.1