mirror of
https://github.com/arut/nginx-rtmp-module.git
synced 2025-08-06 15:00:18 +08:00
added more audio codec params to codec module
This commit is contained in:
@ -145,6 +145,8 @@ ngx_rtmp_codec_av(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
|
|||||||
uint8_t fmt;
|
uint8_t fmt;
|
||||||
ngx_rtmp_header_t ch, lh;
|
ngx_rtmp_header_t ch, lh;
|
||||||
ngx_uint_t *version;
|
ngx_uint_t *version;
|
||||||
|
static ngx_uint_t sample_rates[] =
|
||||||
|
{ 5512, 11025, 22050, 44100 };
|
||||||
|
|
||||||
|
|
||||||
if (h->type != NGX_RTMP_MSG_AUDIO && h->type != NGX_RTMP_MSG_VIDEO) {
|
if (h->type != NGX_RTMP_MSG_AUDIO && h->type != NGX_RTMP_MSG_VIDEO) {
|
||||||
@ -165,6 +167,9 @@ ngx_rtmp_codec_av(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
|
|||||||
fmt = in->buf->pos[0];
|
fmt = in->buf->pos[0];
|
||||||
if (h->type == NGX_RTMP_MSG_AUDIO) {
|
if (h->type == NGX_RTMP_MSG_AUDIO) {
|
||||||
ctx->audio_codec_id = (fmt & 0xf0) >> 4;
|
ctx->audio_codec_id = (fmt & 0xf0) >> 4;
|
||||||
|
ctx->audio_channels = (fmt & 0x01) + 1;
|
||||||
|
ctx->sample_size = (fmt & 0x02) ? 2 : 1;
|
||||||
|
ctx->sample_rate = sample_rates[(fmt & 0x0c) >> 2];
|
||||||
} else {
|
} else {
|
||||||
ctx->video_codec_id = (fmt & 0x0f);
|
ctx->video_codec_id = (fmt & 0x0f);
|
||||||
}
|
}
|
||||||
|
@ -55,6 +55,9 @@ typedef struct {
|
|||||||
ngx_uint_t video_codec_id;
|
ngx_uint_t video_codec_id;
|
||||||
ngx_uint_t audio_data_rate;
|
ngx_uint_t audio_data_rate;
|
||||||
ngx_uint_t audio_codec_id;
|
ngx_uint_t audio_codec_id;
|
||||||
|
ngx_uint_t sample_rate; /* 5512, 11025, 22050, 44100 */
|
||||||
|
ngx_uint_t sample_size; /* 1=8bit, 2=16bit */
|
||||||
|
ngx_uint_t audio_channels; /* 1, 2 */
|
||||||
u_char profile[32];
|
u_char profile[32];
|
||||||
u_char level[32];
|
u_char level[32];
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user