static void * create_decoder(const struct PluginCodec_Definition * codec) { #ifdef _WIN32_WCE void * context = malloc(D_IF_g729ab_queryBlockSize()); if (context == NULL) return NULL; if (D_IF_g729ab_init(context) == 0) return context; free(context); return NULL; #else if (decoderInUse) return NULL; decoderInUse = 1; va_g729a_init_decoder(); return (void *)1; #endif }
static void * create_decoder(const struct PluginCodec_Definition * codec) { //if (decoderInUse) // return NULL; decoderInUse = 1; va_g729a_init_decoder(); return (void *)1; }
//---------------------------------------------------------------------------------------------------- bool EEWaveCoder::InitializeWaveCoder() { if (!s_isWaveCoderInitialized) { va_g729a_init_encoder(); va_g729a_init_decoder(); s_isWaveCoderInitialized = true; } return true; }
HRESULT CG729Codec::StartStreaming() { CMediaType* pMediaType = &m_pInput->CurrentMediaType(); if ( pMediaType->subtype == MEDIASUBTYPE_G729AAudio ) { va_g729a_init_decoder(); } else // MEDIASUBTYPE_PCM { va_g729a_init_encoder(); } return S_OK; }
CAudioCode::CAudioCode() { va_g729a_init_encoder(); va_g729a_init_decoder(); }
void main(int argc, char *argv[]) { int nb_frame; clock_t start, finish; double duration; FILE* fp_in; FILE* fp_out; unsigned char serial[L_FRAME_COMPRESSED]; short synth[L_FRAME]; int bfi; printf("\n************** VoiceAge Corporation **************"); printf("\n"); printf("\n------------- G729 floating-point Decoder ------------"); printf("\n"); /*-----------------------------------------------------------------------* * Open all files. * *-----------------------------------------------------------------------*/ if (argc != 3) { printf("Usage: %s infile outfile\n", argv[0]); return; } if ( (fp_in = fopen(argv[1], "rb")) == NULL) { printf("\nError opening input file %s!", argv[1]); return; } if ( (fp_out = fopen(argv[2], "wb")) == NULL) { printf("\nError opening output file %s!", argv[2]); return; } /*-----------------------------------------------------------------------* * Decode * *-----------------------------------------------------------------------*/ va_g729a_init_decoder(); nb_frame = 0; start = clock(); while (fread(serial, sizeof(char), L_FRAME_COMPRESSED, fp_in) == L_FRAME_COMPRESSED) { printf("Decode frame %d\r", ++nb_frame); /*--------------------------------------------------------------* * Bad frame * * * * bfi = 0 to indicate that we have a correct frame * * bfi = 1 to indicate that we lost the current frame * *--------------------------------------------------------------*/ bfi = 0; /*--------------------------------------------------------------* * Call the decoder. * *--------------------------------------------------------------*/ va_g729a_decoder(serial, synth, bfi); /*--------------------------------------------------------------* * Output synthesis to disk * *--------------------------------------------------------------*/ fwrite(synth, sizeof(short), L_FRAME, fp_out); } finish = clock(); duration = (double)(finish - start) / CLOCKS_PER_SEC; printf( "\n%2.1f seconds\n", duration ); fclose(fp_out); fclose(fp_in); } /* end of main() */
void Init729() { va_g729a_init_encoder(); va_g729a_init_decoder(); }