00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "libavutil/avassert.h"
00023 #include "avformat.h"
00024 #include "internal.h"
00025 #include "rawdec.h"
00026
00027 static int g722_read_header(AVFormatContext *s)
00028 {
00029 AVStream *st;
00030
00031 st = avformat_new_stream(s, NULL);
00032 if (!st)
00033 return AVERROR(ENOMEM);
00034
00035 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
00036 st->codec->codec_id = AV_CODEC_ID_ADPCM_G722;
00037 st->codec->sample_rate = 16000;
00038 st->codec->channels = 1;
00039
00040 st->codec->bits_per_coded_sample =
00041 av_get_bits_per_sample(st->codec->codec_id);
00042
00043 av_assert0(st->codec->bits_per_coded_sample > 0);
00044
00045 avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
00046 return 0;
00047 }
00048
00049 AVInputFormat ff_g722_demuxer = {
00050 .name = "g722",
00051 .long_name = NULL_IF_CONFIG_SMALL("raw G.722"),
00052 .read_header = g722_read_header,
00053 .read_packet = ff_raw_read_partial_packet,
00054 .flags = AVFMT_GENERIC_INDEX,
00055 .extensions = "g722,722",
00056 .raw_codec_id = AV_CODEC_ID_ADPCM_G722,
00057 };