HANDLE_TRANSPORTDEC transportDec_Open( const TRANSPORT_TYPE transportFmt, const UINT flags) { HANDLE_TRANSPORTDEC hInput; hInput = GetRam_TransportDecoder(0); if ( hInput == NULL ) { return NULL; } /* Init transportDec struct. */ hInput->transportFmt = transportFmt; switch (transportFmt) { case TT_MP4_ADIF: break; case TT_MP4_ADTS: if (flags & TP_FLAG_MPEG4) hInput->parser.adts.decoderCanDoMpeg4 = 1; else hInput->parser.adts.decoderCanDoMpeg4 = 0; adtsRead_CrcInit(&hInput->parser.adts); hInput->parser.adts.BufferFullnesStartFlag = 1; hInput->numberOfRawDataBlocks = 0; break; case TT_MP4_LATM_MCP0: case TT_MP4_LATM_MCP1: case TT_MP4_LOAS: case TT_MP4_RAW: break; default: FreeRam_TransportDecoder(&hInput); hInput = NULL; break; } if (hInput != NULL) { /* Create bitstream */ if ( (transportFmt == TT_MP4_RAW) || (transportFmt == TT_DRM) ){ hInput->bsBuffer = NULL; } else { hInput->bsBuffer = GetRam_TransportDecoderBuffer(0); if (hInput->bsBuffer == NULL) { transportDec_Close( &hInput ); return NULL; } FDKinitBitStream(&hInput->bitStream[0], hInput->bsBuffer, TRANSPORTDEC_INBUF_SIZE, 0, BS_READER); } hInput->burstPeriod = 0; } return hInput; }
void transportDec_Close(HANDLE_TRANSPORTDEC *phTp) { if (phTp != NULL) { if (*phTp != NULL) { if ((*phTp)->transportFmt != TT_MP4_RAW && (*phTp)->transportFmt != TT_DRM) { FreeRam_TransportDecoderBuffer(&(*phTp)->bsBuffer); } if (*phTp != NULL) { FreeRam_TransportDecoder(phTp); } } } }
void transportDec_Close(HANDLE_TRANSPORTDEC *phTp) { if (phTp != NULL) { if (*phTp != NULL) { if ( ! TT_IS_PACKET((*phTp)->transportFmt) ) { FreeRam_TransportDecoderBuffer(&(*phTp)->bsBuffer); } if (*phTp != NULL) { FreeRam_TransportDecoder(phTp); } } } }