]> git.sesse.net Git - ffmpeg/blob - libavformat/rtpdec_g726.c
Merge remote-tracking branch 'qatar/master'
[ffmpeg] / libavformat / rtpdec_g726.c
1 /*
2  * Copyright (c) 2011 Miroslav Slugeň <Thunder.m@seznam.cz>
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20
21 #include "avformat.h"
22 #include "rtpdec_formats.h"
23
24 static int g726_16_parse_sdp_line(AVFormatContext *s, int st_index,
25                               PayloadContext *data, const char *line)
26 {
27     AVStream *stream = s->streams[st_index];
28     AVCodecContext *codec = stream->codec;
29
30     codec->bit_rate = 16000;
31
32     return 0;
33 }
34
35 static int g726_24_parse_sdp_line(AVFormatContext *s, int st_index,
36                               PayloadContext *data, const char *line)
37 {
38     AVStream *stream = s->streams[st_index];
39     AVCodecContext *codec = stream->codec;
40
41     codec->bit_rate = 24000;
42
43     return 0;
44 }
45
46 static int g726_32_parse_sdp_line(AVFormatContext *s, int st_index,
47                               PayloadContext *data, const char *line)
48 {
49     AVStream *stream = s->streams[st_index];
50     AVCodecContext *codec = stream->codec;
51
52     codec->bit_rate = 32000;
53
54     return 0;
55 }
56
57 static int g726_40_parse_sdp_line(AVFormatContext *s, int st_index,
58                               PayloadContext *data, const char *line)
59 {
60     AVStream *stream = s->streams[st_index];
61     AVCodecContext *codec = stream->codec;
62
63     codec->bit_rate = 40000;
64
65     return 0;
66 }
67
68 RTPDynamicProtocolHandler ff_g726_16_dynamic_handler = {
69     .enc_name         = "G726-16",
70     .codec_type       = AVMEDIA_TYPE_AUDIO,
71     .codec_id         = CODEC_ID_ADPCM_G726,
72     .parse_sdp_a_line = g726_16_parse_sdp_line,
73 };
74
75 RTPDynamicProtocolHandler ff_g726_24_dynamic_handler = {
76     .enc_name         = "G726-24",
77     .codec_type       = AVMEDIA_TYPE_AUDIO,
78     .codec_id         = CODEC_ID_ADPCM_G726,
79     .parse_sdp_a_line = g726_24_parse_sdp_line,
80 };
81
82 RTPDynamicProtocolHandler ff_g726_32_dynamic_handler = {
83     .enc_name         = "G726-32",
84     .codec_type       = AVMEDIA_TYPE_AUDIO,
85     .codec_id         = CODEC_ID_ADPCM_G726,
86     .parse_sdp_a_line = g726_32_parse_sdp_line,
87 };
88
89 RTPDynamicProtocolHandler ff_g726_40_dynamic_handler = {
90     .enc_name         = "G726-40",
91     .codec_type       = AVMEDIA_TYPE_AUDIO,
92     .codec_id         = CODEC_ID_ADPCM_G726,
93     .parse_sdp_a_line = g726_40_parse_sdp_line,
94 };