rtpdec_g726.c 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. #include "avformat.h"
  21. #include "rtpdec_formats.h"
  22. static int g726_16_parse_sdp_line(AVFormatContext *s, int st_index,
  23. PayloadContext *data, const char *line)
  24. {
  25. AVStream *stream = s->streams[st_index];
  26. AVCodecContext *codec = stream->codec;
  27. codec->bit_rate = 16000;
  28. return 0;
  29. }
  30. static int g726_24_parse_sdp_line(AVFormatContext *s, int st_index,
  31. PayloadContext *data, const char *line)
  32. {
  33. AVStream *stream = s->streams[st_index];
  34. AVCodecContext *codec = stream->codec;
  35. codec->bit_rate = 24000;
  36. return 0;
  37. }
  38. static int g726_32_parse_sdp_line(AVFormatContext *s, int st_index,
  39. PayloadContext *data, const char *line)
  40. {
  41. AVStream *stream = s->streams[st_index];
  42. AVCodecContext *codec = stream->codec;
  43. codec->bit_rate = 32000;
  44. return 0;
  45. }
  46. static int g726_40_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. codec->bit_rate = 40000;
  52. return 0;
  53. }
  54. RTPDynamicProtocolHandler ff_g726_16_dynamic_handler = {
  55. .enc_name = "G726-16",
  56. .codec_type = AVMEDIA_TYPE_AUDIO,
  57. .codec_id = CODEC_ID_ADPCM_G726,
  58. .parse_sdp_a_line = g726_16_parse_sdp_line,
  59. };
  60. RTPDynamicProtocolHandler ff_g726_24_dynamic_handler = {
  61. .enc_name = "G726-24",
  62. .codec_type = AVMEDIA_TYPE_AUDIO,
  63. .codec_id = CODEC_ID_ADPCM_G726,
  64. .parse_sdp_a_line = g726_24_parse_sdp_line,
  65. };
  66. RTPDynamicProtocolHandler ff_g726_32_dynamic_handler = {
  67. .enc_name = "G726-32",
  68. .codec_type = AVMEDIA_TYPE_AUDIO,
  69. .codec_id = CODEC_ID_ADPCM_G726,
  70. .parse_sdp_a_line = g726_32_parse_sdp_line,
  71. };
  72. RTPDynamicProtocolHandler ff_g726_40_dynamic_handler = {
  73. .enc_name = "G726-40",
  74. .codec_type = AVMEDIA_TYPE_AUDIO,
  75. .codec_id = CODEC_ID_ADPCM_G726,
  76. .parse_sdp_a_line = g726_40_parse_sdp_line,
  77. };