• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • Examples
  • File List
  • Globals

libavformat/rtpdec_g726.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2011 Miroslav Slugeň <Thunder.m@seznam.cz>
00003  *
00004  * This file is part of Libav.
00005  *
00006  * Libav is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * Libav is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with Libav; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00019  */
00020 
00021 #include "avformat.h"
00022 #include "rtpdec_formats.h"
00023 
00024 #define RTP_G726_HANDLER(bitrate) \
00025 static int g726_ ## bitrate ##_init(AVFormatContext *s, int st_index, PayloadContext *data) \
00026 { \
00027     AVStream *stream = s->streams[st_index]; \
00028     AVCodecContext *codec = stream->codec; \
00029 \
00030     codec->bits_per_coded_sample = bitrate/8; \
00031     codec->bit_rate = codec->bits_per_coded_sample * codec->sample_rate; \
00032 \
00033     return 0; \
00034 } \
00035 \
00036 RTPDynamicProtocolHandler ff_g726_ ## bitrate ## _dynamic_handler = { \
00037     .enc_name   = "G726-" #bitrate, \
00038     .codec_type = AVMEDIA_TYPE_AUDIO, \
00039     .codec_id   = CODEC_ID_ADPCM_G726, \
00040     .init       = g726_ ## bitrate ## _init, \
00041 }
00042 
00043 RTP_G726_HANDLER(16);
00044 RTP_G726_HANDLER(24);
00045 RTP_G726_HANDLER(32);
00046 RTP_G726_HANDLER(40);
Generated on Thu Jul 11 2013 15:38:24 for Libav by doxygen 1.7.1