Asterisk - The Open Source Telephony Project  21.4.1
Data Structures | Macros | Functions
smoother.c File Reference

Frame smoother manipulation routines. More...

#include "asterisk.h"
#include "asterisk/_private.h"
#include "asterisk/frame.h"
#include "asterisk/astobj2.h"
#include "asterisk/time.h"
#include "asterisk/utils.h"
#include "asterisk/format.h"
#include "asterisk/codec.h"
#include "asterisk/smoother.h"

Go to the source code of this file.

Data Structures

struct  ast_smoother
 

Macros

#define SMOOTHER_SIZE   8000
 

Functions

int __ast_smoother_feed (struct ast_smoother *s, struct ast_frame *f, int swap)
 
void ast_smoother_free (struct ast_smoother *s)
 
int ast_smoother_get_flags (struct ast_smoother *s)
 
struct ast_smootherast_smoother_new (int size)
 
struct ast_frameast_smoother_read (struct ast_smoother *s)
 
void ast_smoother_reconfigure (struct ast_smoother *s, int bytes)
 Reconfigure an existing smoother to output a different number of bytes per frame. More...
 
void ast_smoother_reset (struct ast_smoother *s, int bytes)
 
void ast_smoother_set_flags (struct ast_smoother *s, int flags)
 
int ast_smoother_test_flag (struct ast_smoother *s, int flag)
 
static int smoother_frame_feed (struct ast_smoother *s, struct ast_frame *f, int swap)
 

Detailed Description

Frame smoother manipulation routines.

Author
Mark Spencer marks.nosp@m.ter@.nosp@m.digiu.nosp@m.m.co.nosp@m.m

Definition in file smoother.c.

Function Documentation

void ast_smoother_reconfigure ( struct ast_smoother s,
int  bytes 
)

Reconfigure an existing smoother to output a different number of bytes per frame.

Parameters
sthe smoother to reconfigure
bytesthe desired number of bytes per output frame

Definition at line 86 of file smoother.c.

87 {
88  /* if there is no change, then nothing to do */
89  if (s->size == bytes) {
90  return;
91  }
92  /* set the new desired output size */
93  s->size = bytes;
94  /* if there is no 'optimized' frame in the smoother,
95  * then there is nothing left to do
96  */
97  if (!s->opt) {
98  return;
99  }
100  /* there is an 'optimized' frame here at the old size,
101  * but it must now be put into the buffer so the data
102  * can be extracted at the new size
103  */
104  smoother_frame_feed(s, s->opt, s->opt_needs_swap);
105  s->opt = NULL;
106 }