\doxysection{include/osmocom/codec/ecu.h File Reference} \label{ecu_8h}\index{include/osmocom/codec/ecu.h@{include/osmocom/codec/ecu.h}} {\ttfamily \#include $<$stdint.\+h$>$}\newline {\ttfamily \#include $<$stdbool.\+h$>$}\newline {\ttfamily \#include $<$osmocom/core/defs.\+h$>$}\newline {\ttfamily \#include $<$osmocom/codec/codec.\+h$>$}\newline \doxysubsection*{Data Structures} \begin{DoxyCompactItemize} \item struct \textbf{ osmo\+\_\+ecu\+\_\+fr\+\_\+state} \item struct \textbf{ osmo\+\_\+ecu\+\_\+state} \item struct \textbf{ osmo\+\_\+ecu\+\_\+ops} \end{DoxyCompactItemize} \doxysubsection*{Enumerations} \begin{DoxyCompactItemize} \item enum \textbf{ osmo\+\_\+ecu\+\_\+codec} \{ \newline \textbf{ OSMO\+\_\+\+ECU\+\_\+\+CODEC\+\_\+\+HR} , \newline \textbf{ OSMO\+\_\+\+ECU\+\_\+\+CODEC\+\_\+\+FR} , \newline \textbf{ OSMO\+\_\+\+ECU\+\_\+\+CODEC\+\_\+\+EFR} , \newline \textbf{ OSMO\+\_\+\+ECU\+\_\+\+CODEC\+\_\+\+AMR} , \newline \textbf{ \+\_\+\+NUM\+\_\+\+OSMO\+\_\+\+ECU\+\_\+\+CODECS} \} \end{DoxyCompactItemize} \doxysubsection*{Functions} \begin{DoxyCompactItemize} \item void \textbf{ osmo\+\_\+ecu\+\_\+fr\+\_\+reset} (struct \textbf{ osmo\+\_\+ecu\+\_\+fr\+\_\+state} $\ast$state, const uint8\+\_\+t $\ast$frame) \textbf{ OSMO\+\_\+\+DEPRECATED\+\_\+\+OUTSIDE}(\char`\"{}Use generic ECU override ion layer \textbf{ instead}\char`\"{}) \begin{DoxyCompactList}\small\item\em To be called when a good frame is received. \end{DoxyCompactList}\item int \textbf{ osmo\+\_\+ecu\+\_\+fr\+\_\+conceal} (struct \textbf{ osmo\+\_\+ecu\+\_\+fr\+\_\+state} $\ast$state, uint8\+\_\+t $\ast$frame) \textbf{ OSMO\+\_\+\+DEPRECATED\+\_\+\+OUTSIDE}(\char`\"{}Use generic ECU override ion layer \textbf{ instead}\char`\"{}) \begin{DoxyCompactList}\small\item\em To be called when a bad frame is received. \end{DoxyCompactList}\item struct \textbf{ osmo\+\_\+ecu\+\_\+state} $\ast$ \textbf{ osmo\+\_\+ecu\+\_\+init} (void $\ast$ctx, enum \textbf{ osmo\+\_\+ecu\+\_\+codec} codec) \begin{DoxyCompactList}\small\item\em initialize an ECU instance for given codec. \end{DoxyCompactList}\item void \textbf{ osmo\+\_\+ecu\+\_\+destroy} (struct \textbf{ osmo\+\_\+ecu\+\_\+state} $\ast$st) \begin{DoxyCompactList}\small\item\em destroy an ECU instance \end{DoxyCompactList}\item int \textbf{ osmo\+\_\+ecu\+\_\+frame\+\_\+in} (struct \textbf{ osmo\+\_\+ecu\+\_\+state} $\ast$st, bool bfi, const uint8\+\_\+t $\ast$frame, unsigned int frame\+\_\+bytes) \begin{DoxyCompactList}\small\item\em process a received frame a substitute/erroneous frame. \end{DoxyCompactList}\item int \textbf{ osmo\+\_\+ecu\+\_\+frame\+\_\+out} (struct \textbf{ osmo\+\_\+ecu\+\_\+state} $\ast$st, uint8\+\_\+t $\ast$frame\+\_\+out) \begin{DoxyCompactList}\small\item\em generate output data for a substitute/erroneous frame. \end{DoxyCompactList}\item bool \textbf{ osmo\+\_\+ecu\+\_\+is\+\_\+dtx\+\_\+pause} (struct \textbf{ osmo\+\_\+ecu\+\_\+state} $\ast$st) \begin{DoxyCompactList}\small\item\em check if the current state of this ECU is a DTX pause. \end{DoxyCompactList}\item int \textbf{ osmo\+\_\+ecu\+\_\+register} (const struct \textbf{ osmo\+\_\+ecu\+\_\+ops} $\ast$ops, enum \textbf{ osmo\+\_\+ecu\+\_\+codec} codec) \begin{DoxyCompactList}\small\item\em register an ECU implementation for a given codec \end{DoxyCompactList}\end{DoxyCompactItemize} \doxysubsection{Enumeration Type Documentation} \mbox{\label{ecu_8h_abebbc186f0f363b217b82411ea0e60eb}} \index{ecu.h@{ecu.h}!osmo\_ecu\_codec@{osmo\_ecu\_codec}} \index{osmo\_ecu\_codec@{osmo\_ecu\_codec}!ecu.h@{ecu.h}} \doxysubsubsection{osmo\_ecu\_codec} {\footnotesize\ttfamily enum \textbf{ osmo\+\_\+ecu\+\_\+codec}} \begin{DoxyEnumFields}{Enumerator} \raisebox{\heightof{T}}[0pt][0pt]{\index{OSMO\_ECU\_CODEC\_HR@{OSMO\_ECU\_CODEC\_HR}!ecu.h@{ecu.h}}\index{ecu.h@{ecu.h}!OSMO\_ECU\_CODEC\_HR@{OSMO\_ECU\_CODEC\_HR}}}\mbox{\label{ecu_8h_abebbc186f0f363b217b82411ea0e60eba56a7a473bd4700e2aefe828867163656}} OSMO\+\_\+\+ECU\+\_\+\+CODEC\+\_\+\+HR&\\ \hline \raisebox{\heightof{T}}[0pt][0pt]{\index{OSMO\_ECU\_CODEC\_FR@{OSMO\_ECU\_CODEC\_FR}!ecu.h@{ecu.h}}\index{ecu.h@{ecu.h}!OSMO\_ECU\_CODEC\_FR@{OSMO\_ECU\_CODEC\_FR}}}\mbox{\label{ecu_8h_abebbc186f0f363b217b82411ea0e60eba51cc17e4d4a236d5ff9311a1c18b545a}} OSMO\+\_\+\+ECU\+\_\+\+CODEC\+\_\+\+FR&\\ \hline \raisebox{\heightof{T}}[0pt][0pt]{\index{OSMO\_ECU\_CODEC\_EFR@{OSMO\_ECU\_CODEC\_EFR}!ecu.h@{ecu.h}}\index{ecu.h@{ecu.h}!OSMO\_ECU\_CODEC\_EFR@{OSMO\_ECU\_CODEC\_EFR}}}\mbox{\label{ecu_8h_abebbc186f0f363b217b82411ea0e60ebaa9916d57fab398ee04552168fd94d228}} OSMO\+\_\+\+ECU\+\_\+\+CODEC\+\_\+\+EFR&\\ \hline \raisebox{\heightof{T}}[0pt][0pt]{\index{OSMO\_ECU\_CODEC\_AMR@{OSMO\_ECU\_CODEC\_AMR}!ecu.h@{ecu.h}}\index{ecu.h@{ecu.h}!OSMO\_ECU\_CODEC\_AMR@{OSMO\_ECU\_CODEC\_AMR}}}\mbox{\label{ecu_8h_abebbc186f0f363b217b82411ea0e60ebafd16d3c0c800bd7838ce2903b6d9d98d}} OSMO\+\_\+\+ECU\+\_\+\+CODEC\+\_\+\+AMR&\\ \hline \raisebox{\heightof{T}}[0pt][0pt]{\index{\_NUM\_OSMO\_ECU\_CODECS@{\_NUM\_OSMO\_ECU\_CODECS}!ecu.h@{ecu.h}}\index{ecu.h@{ecu.h}!\_NUM\_OSMO\_ECU\_CODECS@{\_NUM\_OSMO\_ECU\_CODECS}}}\mbox{\label{ecu_8h_abebbc186f0f363b217b82411ea0e60ebaa006a88f0eaad31948dd95c11c998de9}} \+\_\+\+NUM\+\_\+\+OSMO\+\_\+\+ECU\+\_\+\+CODECS&\\ \hline \end{DoxyEnumFields} \doxysubsection{Function Documentation} \mbox{\label{ecu_8h_aee251e8219d7922452d261a3c7d5329a}} \index{ecu.h@{ecu.h}!osmo\_ecu\_destroy@{osmo\_ecu\_destroy}} \index{osmo\_ecu\_destroy@{osmo\_ecu\_destroy}!ecu.h@{ecu.h}} \doxysubsubsection{osmo\_ecu\_destroy()} {\footnotesize\ttfamily void osmo\+\_\+ecu\+\_\+destroy (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+ecu\+\_\+state} $\ast$}]{st }\end{DoxyParamCaption})} destroy an ECU instance References \textbf{ ARRAY\+\_\+\+SIZE}, \textbf{ osmo\+\_\+ecu\+\_\+state\+::codec}, \textbf{ osmo\+\_\+ecu\+\_\+ops\+::destroy}, and \textbf{ g\+\_\+ecu\+\_\+ops}. \mbox{\label{ecu_8h_adadd2749e99870a1dc55c5a612dc7bd1}} \index{ecu.h@{ecu.h}!osmo\_ecu\_fr\_conceal@{osmo\_ecu\_fr\_conceal}} \index{osmo\_ecu\_fr\_conceal@{osmo\_ecu\_fr\_conceal}!ecu.h@{ecu.h}} \doxysubsubsection{osmo\_ecu\_fr\_conceal()} {\footnotesize\ttfamily int osmo\+\_\+ecu\+\_\+fr\+\_\+conceal (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+ecu\+\_\+fr\+\_\+state} $\ast$}]{state, }\item[{uint8\+\_\+t $\ast$}]{frame }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [pure virtual]}} To be called when a bad frame is received. This function will then generate a replacement frame that can be used to conceal the dropout. \begin{DoxyParams}[1]{Parameters} \mbox{\texttt{ in}} & {\em state} & The state object for the ECU \\ \hline \mbox{\texttt{ out}} & {\em frame} & The buffer to fill with GSM\+\_\+\+FR\+\_\+\+BYTES of replacement frame \\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} 0 if the frame was successfully filled \end{DoxyReturn} References \textbf{ conceal\+\_\+frame()}, \textbf{ osmo\+\_\+ecu\+\_\+fr\+\_\+state\+::frame\+\_\+backup}, \textbf{ GSM\+\_\+\+FR\+\_\+\+BYTES}, and \textbf{ osmo\+\_\+ecu\+\_\+fr\+\_\+state\+::subsequent\+\_\+lost\+\_\+frame}. \mbox{\label{ecu_8h_aad51dc9a3775141c5e55273cf832a93f}} \index{ecu.h@{ecu.h}!osmo\_ecu\_fr\_reset@{osmo\_ecu\_fr\_reset}} \index{osmo\_ecu\_fr\_reset@{osmo\_ecu\_fr\_reset}!ecu.h@{ecu.h}} \doxysubsubsection{osmo\_ecu\_fr\_reset()} {\footnotesize\ttfamily void osmo\+\_\+ecu\+\_\+fr\+\_\+reset (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+ecu\+\_\+fr\+\_\+state} $\ast$}]{state, }\item[{const uint8\+\_\+t $\ast$}]{frame }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [pure virtual]}} To be called when a good frame is received. This function will then create a backup of the frame and reset the internal state. \begin{DoxyParams}[1]{Parameters} \mbox{\texttt{ in}} & {\em state} & The state object for the ECU \\ \hline \mbox{\texttt{ out}} & {\em frame} & The valid frame (GSM\+\_\+\+FR\+\_\+\+BYTES bytes in RTP payload format) \\ \hline \end{DoxyParams} References \textbf{ osmo\+\_\+ecu\+\_\+fr\+\_\+state\+::frame\+\_\+backup}, \textbf{ GSM\+\_\+\+FR\+\_\+\+BYTES}, and \textbf{ osmo\+\_\+ecu\+\_\+fr\+\_\+state\+::subsequent\+\_\+lost\+\_\+frame}. \mbox{\label{ecu_8h_a111ce1d991c8bc5f175521cb9d16ea1b}} \index{ecu.h@{ecu.h}!osmo\_ecu\_frame\_in@{osmo\_ecu\_frame\_in}} \index{osmo\_ecu\_frame\_in@{osmo\_ecu\_frame\_in}!ecu.h@{ecu.h}} \doxysubsubsection{osmo\_ecu\_frame\_in()} {\footnotesize\ttfamily int osmo\+\_\+ecu\+\_\+frame\+\_\+in (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+ecu\+\_\+state} $\ast$}]{st, }\item[{bool}]{bfi, }\item[{const uint8\+\_\+t $\ast$}]{frame, }\item[{unsigned int}]{frame\+\_\+bytes }\end{DoxyParamCaption})} process a received frame a substitute/erroneous frame. \begin{DoxyParams}[1]{Parameters} \mbox{\texttt{ in}} & {\em st} & ECU state/instance on which to operate \\ \hline \mbox{\texttt{ in}} & {\em bfi} & Bad Frame Indication \\ \hline \mbox{\texttt{ in}} & {\em frame} & received codec frame to be processed \\ \hline \mbox{\texttt{ in}} & {\em frame\+\_\+bytes} & number of bytes available in frame \\ \hline \end{DoxyParams} References \textbf{ ARRAY\+\_\+\+SIZE}, \textbf{ osmo\+\_\+ecu\+\_\+state\+::codec}, \textbf{ osmo\+\_\+ecu\+\_\+ops\+::frame\+\_\+in}, and \textbf{ g\+\_\+ecu\+\_\+ops}. \mbox{\label{ecu_8h_a7ca732e6dd9ed449697ba24847609d79}} \index{ecu.h@{ecu.h}!osmo\_ecu\_frame\_out@{osmo\_ecu\_frame\_out}} \index{osmo\_ecu\_frame\_out@{osmo\_ecu\_frame\_out}!ecu.h@{ecu.h}} \doxysubsubsection{osmo\_ecu\_frame\_out()} {\footnotesize\ttfamily int osmo\+\_\+ecu\+\_\+frame\+\_\+out (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+ecu\+\_\+state} $\ast$}]{st, }\item[{uint8\+\_\+t $\ast$}]{frame\+\_\+out }\end{DoxyParamCaption})} generate output data for a substitute/erroneous frame. \begin{DoxyParams}[1]{Parameters} \mbox{\texttt{ in}} & {\em st} & ECU state/instance on which to operate \\ \hline \mbox{\texttt{ out}} & {\em frame\+\_\+out} & buffer for generated output frame \\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} number of bytes written to frame\+\_\+out; negative on error \end{DoxyReturn} References \textbf{ ARRAY\+\_\+\+SIZE}, \textbf{ osmo\+\_\+ecu\+\_\+state\+::codec}, \textbf{ osmo\+\_\+ecu\+\_\+ops\+::frame\+\_\+out}, and \textbf{ g\+\_\+ecu\+\_\+ops}. \mbox{\label{ecu_8h_a9b62d65c3a20761dd0430df7fc090adf}} \index{ecu.h@{ecu.h}!osmo\_ecu\_init@{osmo\_ecu\_init}} \index{osmo\_ecu\_init@{osmo\_ecu\_init}!ecu.h@{ecu.h}} \doxysubsubsection{osmo\_ecu\_init()} {\footnotesize\ttfamily struct \textbf{ osmo\+\_\+ecu\+\_\+state} $\ast$ osmo\+\_\+ecu\+\_\+init (\begin{DoxyParamCaption}\item[{void $\ast$}]{ctx, }\item[{enum \textbf{ osmo\+\_\+ecu\+\_\+codec}}]{codec }\end{DoxyParamCaption})} initialize an ECU instance for given codec. \begin{DoxyParams}[1]{Parameters} \mbox{\texttt{ in}} & {\em ctx} & talloc context from which to allocate \\ \hline \mbox{\texttt{ in}} & {\em codec} & codec for which to initialize/create ECU \\ \hline \end{DoxyParams} References \textbf{ ARRAY\+\_\+\+SIZE}, \textbf{ osmo\+\_\+ecu\+\_\+state\+::codec}, \textbf{ g\+\_\+ecu\+\_\+ops}, and \textbf{ osmo\+\_\+ecu\+\_\+ops\+::init}. \mbox{\label{ecu_8h_a8edd060507313dcfd4293c51ef270691}} \index{ecu.h@{ecu.h}!osmo\_ecu\_is\_dtx\_pause@{osmo\_ecu\_is\_dtx\_pause}} \index{osmo\_ecu\_is\_dtx\_pause@{osmo\_ecu\_is\_dtx\_pause}!ecu.h@{ecu.h}} \doxysubsubsection{osmo\_ecu\_is\_dtx\_pause()} {\footnotesize\ttfamily bool osmo\+\_\+ecu\+\_\+is\+\_\+dtx\+\_\+pause (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+ecu\+\_\+state} $\ast$}]{st }\end{DoxyParamCaption})} check if the current state of this ECU is a DTX pause. \begin{DoxyParams}[1]{Parameters} \mbox{\texttt{ in}} & {\em st} & ECU state/instance on which to operate \\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} true if DTX pause, false otherwise \end{DoxyReturn} References \textbf{ ARRAY\+\_\+\+SIZE}, \textbf{ osmo\+\_\+ecu\+\_\+state\+::codec}, \textbf{ g\+\_\+ecu\+\_\+ops}, and \textbf{ osmo\+\_\+ecu\+\_\+ops\+::is\+\_\+dtx\+\_\+pause}. \mbox{\label{ecu_8h_adae3370086c32ba775ce711bf5a5162c}} \index{ecu.h@{ecu.h}!osmo\_ecu\_register@{osmo\_ecu\_register}} \index{osmo\_ecu\_register@{osmo\_ecu\_register}!ecu.h@{ecu.h}} \doxysubsubsection{osmo\_ecu\_register()} {\footnotesize\ttfamily int osmo\+\_\+ecu\+\_\+register (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+ecu\+\_\+ops} $\ast$}]{ops, }\item[{enum \textbf{ osmo\+\_\+ecu\+\_\+codec}}]{codec }\end{DoxyParamCaption})} register an ECU implementation for a given codec References \textbf{ ARRAY\+\_\+\+SIZE}, \textbf{ osmo\+\_\+ecu\+\_\+state\+::codec}, and \textbf{ g\+\_\+ecu\+\_\+ops}. Referenced by \textbf{ \+\_\+\+\_\+attribute\+\_\+\+\_\+()}.