]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/rtpdec_g726.c
Replace lena.pnm
[ffmpeg] / libavformat / rtpdec_g726.c
index 5735c2cba6535df2e7bffe82b17c9945838d6d0b..7b3f6cbb89da9ce9562421f2e716a7614b9dff08 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/attributes.h"
 #include "avformat.h"
 #include "rtpdec_formats.h"
 
 #define RTP_G726_HANDLER(bitrate) \
-static int g726_ ## bitrate ##_init(AVFormatContext *s, int st_index, PayloadContext *data) \
+static av_cold int g726_ ## bitrate ##_init(AVFormatContext *s, int st_index, \
+                                            PayloadContext *data) \
 { \
     AVStream *stream = s->streams[st_index]; \
     AVCodecContext *codec = stream->codec; \
 \
-    codec->bit_rate = bitrate*1000; \
-    if (codec->sample_rate) \
-        codec->bits_per_coded_sample = \
-            av_clip((codec->bit_rate + codec->sample_rate/2) / codec->sample_rate, 2, 5); \
+    codec->bits_per_coded_sample = bitrate/8; \
+    codec->bit_rate = codec->bits_per_coded_sample * codec->sample_rate; \
 \
     return 0; \
 } \
@@ -38,7 +38,7 @@ static int g726_ ## bitrate ##_init(AVFormatContext *s, int st_index, PayloadCon
 RTPDynamicProtocolHandler ff_g726_ ## bitrate ## _dynamic_handler = { \
     .enc_name   = "G726-" #bitrate, \
     .codec_type = AVMEDIA_TYPE_AUDIO, \
-    .codec_id   = CODEC_ID_ADPCM_G726, \
+    .codec_id   = AV_CODEC_ID_ADPCM_G726, \
     .init       = g726_ ## bitrate ## _init, \
 }