Merge "format: Reintroduce smoother flags" into 13

This commit is contained in:
Jenkins2
2017-06-06 08:49:35 -05:00
committed by Gerrit Code Review
7 changed files with 125 additions and 51 deletions

View File

@@ -37,6 +37,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/format.h"
#include "asterisk/format_cache.h"
#include "asterisk/frame.h"
#include "asterisk/smoother.h"
int __ast_codec_register_with_format(struct ast_codec *codec, const char *format_name,
struct ast_module *mod);
@@ -264,7 +265,7 @@ static struct ast_codec slin8 = {
.minimum_bytes = 160,
.samples_count = slin_samples,
.get_length = slin_length,
.smooth = 1,
.smooth = AST_SMOOTHER_FLAGS_PACK(AST_SMOOTHER_FLAG_BE | AST_SMOOTHER_FLAG_FORCED),
};
static struct ast_codec slin12 = {
@@ -278,7 +279,7 @@ static struct ast_codec slin12 = {
.minimum_bytes = 240,
.samples_count = slin_samples,
.get_length = slin_length,
.smooth = 1,
.smooth = AST_SMOOTHER_FLAGS_PACK(AST_SMOOTHER_FLAG_BE | AST_SMOOTHER_FLAG_FORCED),
};
static struct ast_codec slin16 = {
@@ -292,7 +293,7 @@ static struct ast_codec slin16 = {
.minimum_bytes = 320,
.samples_count = slin_samples,
.get_length = slin_length,
.smooth = 1,
.smooth = AST_SMOOTHER_FLAGS_PACK(AST_SMOOTHER_FLAG_BE | AST_SMOOTHER_FLAG_FORCED),
};
static struct ast_codec slin24 = {
@@ -306,7 +307,7 @@ static struct ast_codec slin24 = {
.minimum_bytes = 480,
.samples_count = slin_samples,
.get_length = slin_length,
.smooth = 1,
.smooth = AST_SMOOTHER_FLAGS_PACK(AST_SMOOTHER_FLAG_BE | AST_SMOOTHER_FLAG_FORCED),
};
static struct ast_codec slin32 = {
@@ -320,7 +321,7 @@ static struct ast_codec slin32 = {
.minimum_bytes = 640,
.samples_count = slin_samples,
.get_length = slin_length,
.smooth = 1,
.smooth = AST_SMOOTHER_FLAGS_PACK(AST_SMOOTHER_FLAG_BE | AST_SMOOTHER_FLAG_FORCED),
};
static struct ast_codec slin44 = {
@@ -334,7 +335,7 @@ static struct ast_codec slin44 = {
.minimum_bytes = 882,
.samples_count = slin_samples,
.get_length = slin_length,
.smooth = 1,
.smooth = AST_SMOOTHER_FLAGS_PACK(AST_SMOOTHER_FLAG_BE | AST_SMOOTHER_FLAG_FORCED),
};
static struct ast_codec slin48 = {
@@ -348,7 +349,7 @@ static struct ast_codec slin48 = {
.minimum_bytes = 960,
.samples_count = slin_samples,
.get_length = slin_length,
.smooth = 1,
.smooth = AST_SMOOTHER_FLAGS_PACK(AST_SMOOTHER_FLAG_BE | AST_SMOOTHER_FLAG_FORCED),
};
static struct ast_codec slin96 = {
@@ -362,7 +363,7 @@ static struct ast_codec slin96 = {
.minimum_bytes = 1920,
.samples_count = slin_samples,
.get_length = slin_length,
.smooth = 1,
.smooth = AST_SMOOTHER_FLAGS_PACK(AST_SMOOTHER_FLAG_BE | AST_SMOOTHER_FLAG_FORCED),
};
static struct ast_codec slin192 = {
@@ -376,7 +377,7 @@ static struct ast_codec slin192 = {
.minimum_bytes = 3840,
.samples_count = slin_samples,
.get_length = slin_length,
.smooth = 1,
.smooth = AST_SMOOTHER_FLAGS_PACK(AST_SMOOTHER_FLAG_BE | AST_SMOOTHER_FLAG_FORCED),
};
static int lpc10_samples(struct ast_frame *frame)

View File

@@ -377,7 +377,13 @@ const char *ast_format_get_codec_name(const struct ast_format *format)
int ast_format_can_be_smoothed(const struct ast_format *format)
{
return format->codec->smooth;
/* Coalesce to 1 if non-zero */
return format->codec->smooth ? 1 : 0;
}
int ast_format_get_smoother_flags(const struct ast_format *format)
{
return AST_SMOOTHER_FLAGS_UNPACK(format->codec->smooth);
}
enum ast_media_type ast_format_get_type(const struct ast_format *format)