/*---------------------------------------------------------------------- | SilenceRemover_Destroy +---------------------------------------------------------------------*/ static BLT_Result SilenceRemover_Destroy(SilenceRemover* self) { ATX_ListItem* item; ATX_LOG_FINE("SilenceRemover::Destroy"); /* release any input packet we may hold */ if (self->input.pending) { BLT_MediaPacket_Release(self->input.pending); } /* release any output packet we may hold */ item = ATX_List_GetFirstItem(self->output.packets); while (item) { BLT_MediaPacket* packet = ATX_ListItem_GetData(item); if (packet) { BLT_MediaPacket_Release(packet); } item = ATX_ListItem_GetNext(item); } ATX_List_Destroy(self->output.packets); /* destruct the inherited object */ BLT_BaseMediaNode_Destruct(&ATX_BASE(self, BLT_BaseMediaNode)); /* free the object memory */ ATX_FreeMemory(self); return BLT_SUCCESS; }
/*---------------------------------------------------------------------- | BLT_Decoder_PumpPacketWithOptions +---------------------------------------------------------------------*/ BLT_Result BLT_Decoder_PumpPacketWithOptions(BLT_Decoder* decoder, BLT_Flags options) { BLT_Result result; /* check if we're in non-blocking mode */ if (options & BLT_DECODER_PUMP_OPTION_NON_BLOCKING) { if (decoder->output) { BLT_OutputNodeStatus status; result = BLT_OutputNode_GetStatus(decoder->output, &status); if (BLT_SUCCEEDED(result) && (status.flags & BLT_OUTPUT_NODE_STATUS_QUEUE_FULL)) { ATX_LOG_FINE("output queue full, would block"); /* ensure that the stream is not paused */ BLT_Stream_Start(decoder->stream); return BLT_ERROR_WOULD_BLOCK; } } } /* pump a packet */ result = BLT_Stream_PumpPacket(decoder->stream); if (BLT_FAILED(result)) return result; return BLT_SUCCESS; }
/*---------------------------------------------------------------------- | CrossFader_Destroy +---------------------------------------------------------------------*/ static BLT_Result CrossFader_Destroy(CrossFader* fader) { ATX_ListItem* item; ATX_LOG_FINE("CrossFader::Destroy"); /* release any packet we may hold */ item = ATX_List_GetFirstItem(fader->output.packets); while (item) { BLT_MediaPacket* packet = ATX_ListItem_GetData(item); if (packet) { BLT_MediaPacket_Release(packet); } item = ATX_ListItem_GetNext(item); } ATX_List_Destroy(fader->output.packets); /* destroy the input buffer */ if (fader->input.buffer) { ATX_RingBuffer_Destroy(fader->input.buffer); } /* destruct the inherited object */ BLT_BaseMediaNode_Destruct(&fader->base); /* free the object memory */ ATX_FreeMemory(fader); return BLT_SUCCESS; }
virtual void OnDecoderEventNotification(BLT_DecoderServer::DecoderEvent& event) { ATX_LOG_FINE("DECODER-EVENT"); if (!m_JniEnv || !m_Delegate || !m_DelegateMethod) return; jintArray array = NULL; switch (event.m_Type) { case BLT_DecoderServer::DecoderEvent::EVENT_TYPE_INIT_ERROR: { BLT_DecoderServer::DecoderEvent::ErrorDetails* details = (BLT_DecoderServer::DecoderEvent::ErrorDetails*)event.m_Details; array = (jintArray)m_JniEnv->NewIntArray(2); jint values[2] = { com_bluetune_player_Player_DECODER_EVENT_TYPE_INIT_ERROR, details->m_ResultCode }; m_JniEnv->SetIntArrayRegion(array, 0, 2, values); break; } case BLT_DecoderServer::DecoderEvent::EVENT_TYPE_DECODING_ERROR: { BLT_DecoderServer::DecoderEvent::ErrorDetails* details = (BLT_DecoderServer::DecoderEvent::ErrorDetails*)event.m_Details; array = (jintArray)m_JniEnv->NewIntArray(2); jint values[2] = { com_bluetune_player_Player_DECODER_EVENT_TYPE_DECODER_ERROR, details->m_ResultCode }; m_JniEnv->SetIntArrayRegion(array, 0, 2, values); break; } } m_JniEnv->CallVoidMethod(m_Delegate, m_DelegateMethod, com_bluetune_player_Player_MESSAGE_TYPE_DECODER_EVENT, NULL, array); }
/*---------------------------------------------------------------------- | BLT_Decoder_Create +---------------------------------------------------------------------*/ BLT_Result BLT_Decoder_Create(BLT_Decoder** decoder) { BLT_Result result; ATX_LOG_FINE("BLT_Decoder::Create"); /* allocate a new decoder object */ *decoder = (BLT_Decoder*)ATX_AllocateZeroMemory(sizeof(BLT_Decoder)); if (*decoder == NULL) { return BLT_ERROR_OUT_OF_MEMORY; } /* get the core object */ result = BLT_Core_Create(&(*decoder)->core); if (BLT_FAILED(result)) goto failed; /* create a stream */ result = BLT_Core_CreateStream((*decoder)->core, &(*decoder)->stream); if (BLT_FAILED(result)) goto failed; /* done */ return BLT_SUCCESS; failed: BLT_Decoder_Destroy(*decoder); return result; }
/*---------------------------------------------------------------------- | DcfParser_Create +---------------------------------------------------------------------*/ static BLT_Result DcfParser_Create(BLT_Module* module, BLT_Core* core, BLT_ModuleParametersType parameters_type, BLT_AnyConst parameters, BLT_MediaNode** object) { DcfParser* self; ATX_LOG_FINE("DcfParser::Create"); /* check parameters */ if (parameters == NULL || parameters_type != BLT_MODULE_PARAMETERS_TYPE_MEDIA_NODE_CONSTRUCTOR) { return BLT_ERROR_INVALID_PARAMETERS; } /* allocate the object */ self = new DcfParser(); DcfParser_Construct(self, module, core); /* return the object */ *object = &ATX_BASE_EX(self, BLT_BaseMediaNode, BLT_MediaNode); return BLT_SUCCESS; }
/*---------------------------------------------------------------------- | BLT_DecoderServer::OnPauseCommand +---------------------------------------------------------------------*/ void BLT_DecoderServer::OnPauseCommand() { ATX_LOG_FINE("enter"); BLT_Decoder_Pause(m_Decoder); SetState(STATE_PAUSED); SendReply(BLT_DecoderServer_Message::COMMAND_ID_PAUSE, BLT_SUCCESS); }
/*---------------------------------------------------------------------- | BLT_DecoderServer::OnStopCommand +---------------------------------------------------------------------*/ void BLT_DecoderServer::OnStopCommand() { ATX_LOG_FINE("enter"); BLT_Decoder_Stop(m_Decoder); SetState(STATE_STOPPED); SendReply(BLT_DecoderServer_Message::COMMAND_ID_STOP, BLT_SUCCESS); }
/*---------------------------------------------------------------------- | BLT_DecoderServer::OnPlayCommand +---------------------------------------------------------------------*/ void BLT_DecoderServer::OnPlayCommand() { ATX_LOG_FINE("enter"); SetState(STATE_PLAYING); SendReply(BLT_DecoderServer_Message::COMMAND_ID_PLAY, BLT_SUCCESS); }
/*---------------------------------------------------------------------- | BLT_DecoderServer::OnPingCommand +---------------------------------------------------------------------*/ void BLT_DecoderServer::OnPingCommand(const void* cookie) { ATX_LOG_FINE("enter"); BLT_DecoderClient_Message* pong; pong = new BLT_DecoderClient_PongNotificationMessage(cookie); m_Client->PostMessage(pong); SendReply(BLT_DecoderServer_Message::COMMAND_ID_PING, BLT_SUCCESS); }
/*---------------------------------------------------------------------- | BLT_DecoderServer::OnRegisterModuleCommnand +---------------------------------------------------------------------*/ void BLT_DecoderServer::OnRegisterModuleCommand(BLT_Module* module) { BLT_Result result; ATX_LOG_FINE("enter"); result = BLT_Decoder_RegisterModule(m_Decoder, module); ATX_RELEASE_OBJECT(module); SendReply(BLT_DecoderServer_Message::COMMAND_ID_REGISTER_MODULE, result); }
/*---------------------------------------------------------------------- | DcfParser_Construct +---------------------------------------------------------------------*/ static void DcfParser_Construct(DcfParser* self, BLT_Module* module, BLT_Core* core) { /* construct the inherited object */ BLT_BaseMediaNode_Construct(&ATX_BASE(self, BLT_BaseMediaNode), module, core); /* construct the members */ DcfParserInput_Construct(&self->input, module); DcfParserOutput_Construct(&self->output); /* look for a key manager */ ATX_Properties* properties = NULL; if (BLT_SUCCEEDED(BLT_Core_GetProperties(core, &properties))) { ATX_PropertyValue value; if (ATX_SUCCEEDED(ATX_Properties_GetProperty(properties, BLT_KEY_MANAGER_PROPERTY, &value))) { if (value.type == ATX_PROPERTY_VALUE_TYPE_POINTER) { self->key_manager = (BLT_KeyManager*)value.data.pointer; } } else { ATX_LOG_FINE("no key manager"); } /* check if we need to use a cipher factory */ if (ATX_SUCCEEDED(ATX_Properties_GetProperty(properties, BLT_CIPHER_FACTORY_PROPERTY, &value))) { if (value.type == ATX_PROPERTY_VALUE_TYPE_POINTER) { self->cipher_factory = new BLT_Ap4CipherFactoryAdapter((BLT_CipherFactory*)value.data.pointer); } } else { ATX_LOG_FINE("no cipher factory"); } } /* setup interfaces */ ATX_SET_INTERFACE_EX(self, DcfParser, BLT_BaseMediaNode, BLT_MediaNode); ATX_SET_INTERFACE_EX(self, DcfParser, BLT_BaseMediaNode, ATX_Referenceable); ATX_SET_INTERFACE(&self->input, DcfParserInput, BLT_MediaPort); ATX_SET_INTERFACE(&self->input, DcfParserInput, BLT_InputStreamUser); ATX_SET_INTERFACE(&self->output, DcfParserOutput, BLT_MediaPort); ATX_SET_INTERFACE(&self->output, DcfParserOutput, BLT_InputStreamProvider); }
/*---------------------------------------------------------------------- | AlsaOutput_Create +---------------------------------------------------------------------*/ static BLT_Result AlsaOutput_Create(BLT_Module* module, BLT_Core* core, BLT_ModuleParametersType parameters_type, BLT_AnyConst parameters, BLT_MediaNode** object) { AlsaOutput* output; BLT_MediaNodeConstructor* constructor = (BLT_MediaNodeConstructor*)parameters; ATX_LOG_FINE("creating output"); /* check parameters */ if (parameters == NULL || parameters_type != BLT_MODULE_PARAMETERS_TYPE_MEDIA_NODE_CONSTRUCTOR) { return BLT_ERROR_INVALID_PARAMETERS; } /* allocate memory for the object */ output = ATX_AllocateZeroMemory(sizeof(AlsaOutput)); if (output == NULL) { *object = NULL; return BLT_ERROR_OUT_OF_MEMORY; } /* construct the inherited object */ BLT_BaseMediaNode_Construct(&ATX_BASE(output, BLT_BaseMediaNode), module, core); /* construct the object */ output->state = BLT_ALSA_OUTPUT_STATE_CLOSED; output->device_handle = NULL; output->media_type.sample_rate = 0; output->media_type.channel_count = 0; output->media_type.bits_per_sample = 0; /* parse the name */ if (constructor->name && ATX_StringLength(constructor->name) > 5) { output->device_name = ATX_String_Create(constructor->name+5); } else { output->device_name = ATX_String_Create("default"); } /* setup the expected media type */ BLT_PcmMediaType_Init(&output->expected_media_type); /* setup interfaces */ ATX_SET_INTERFACE_EX(output, AlsaOutput, BLT_BaseMediaNode, BLT_MediaNode); ATX_SET_INTERFACE_EX(output, AlsaOutput, BLT_BaseMediaNode, ATX_Referenceable); ATX_SET_INTERFACE(output, AlsaOutput, BLT_PacketConsumer); ATX_SET_INTERFACE(output, AlsaOutput, BLT_OutputNode); ATX_SET_INTERFACE(output, AlsaOutput, BLT_MediaPort); *object = &ATX_BASE_EX(output, BLT_BaseMediaNode, BLT_MediaNode); return BLT_SUCCESS; }
PcmAdapterOutput_GetPacket ATX_END_INTERFACE_MAP /*---------------------------------------------------------------------- | PcmAdapter_Create +---------------------------------------------------------------------*/ static BLT_Result PcmAdapter_Create(BLT_Module* module, BLT_Core* core, BLT_ModuleParametersType parameters_type, BLT_AnyConst parameters, BLT_MediaNode** object) { BLT_MediaNodeConstructor* constructor = (BLT_MediaNodeConstructor*)parameters; PcmAdapter* self; ATX_LOG_FINE("PcmAdapter::Create"); /* check parameters */ if (parameters == NULL || parameters_type != BLT_MODULE_PARAMETERS_TYPE_MEDIA_NODE_CONSTRUCTOR) { return BLT_ERROR_INVALID_PARAMETERS; } /* allocate memory for the object */ self = ATX_AllocateZeroMemory(sizeof(PcmAdapter)); if (self == NULL) { *object = NULL; return BLT_ERROR_OUT_OF_MEMORY; } /* construct the inherited object */ BLT_BaseMediaNode_Construct(&ATX_BASE(self, BLT_BaseMediaNode), module, core); /* check the media type */ if (constructor->spec.output.media_type->id != BLT_MEDIA_TYPE_ID_AUDIO_PCM) { return BLT_ERROR_INVALID_MEDIA_TYPE; } /* construct the object */ self->output.pcm_type = *(BLT_PcmMediaType*)constructor->spec.output.media_type; /* setup interfaces */ ATX_SET_INTERFACE_EX(self, PcmAdapter, BLT_BaseMediaNode, BLT_MediaNode); ATX_SET_INTERFACE_EX(self, PcmAdapter, BLT_BaseMediaNode, ATX_Referenceable); ATX_SET_INTERFACE(&self->input, PcmAdapterInput, BLT_MediaPort); ATX_SET_INTERFACE(&self->input, PcmAdapterInput, BLT_PacketConsumer); ATX_SET_INTERFACE(&self->output, PcmAdapterOutput, BLT_MediaPort); ATX_SET_INTERFACE(&self->output, PcmAdapterOutput, BLT_PacketProducer); *object = &ATX_BASE_EX(self, BLT_BaseMediaNode, BLT_MediaNode); return BLT_SUCCESS; }
/*---------------------------------------------------------------------- | BLT_Decoder_Destroy +---------------------------------------------------------------------*/ BLT_Result BLT_Decoder_Destroy(BLT_Decoder* decoder) { ATX_LOG_FINE("BLT_Decoder::Destroy"); ATX_RELEASE_OBJECT(decoder->stream); if (decoder->core) BLT_Core_Destroy(decoder->core); ATX_FreeMemory(decoder); return BLT_SUCCESS; }
WaveFormatterOutput_SetStream ATX_END_INTERFACE_MAP /*---------------------------------------------------------------------- | WaveFormatter_Create +---------------------------------------------------------------------*/ static BLT_Result WaveFormatter_Create(BLT_Module* module, BLT_Core* core, BLT_ModuleParametersType parameters_type, BLT_CString parameters, BLT_MediaNode** object) { WaveFormatter* self; ATX_LOG_FINE("WaveFormatter::Create"); /* check parameters */ if (parameters == NULL || parameters_type != BLT_MODULE_PARAMETERS_TYPE_MEDIA_NODE_CONSTRUCTOR) { return BLT_ERROR_INVALID_PARAMETERS; } /* allocate memory for the object */ self = ATX_AllocateZeroMemory(sizeof(WaveFormatter)); if (self == NULL) { *object = NULL; return BLT_ERROR_OUT_OF_MEMORY; } /* construct the inherited object */ BLT_BaseMediaNode_Construct(&ATX_BASE(self, BLT_BaseMediaNode), module, core); /* setup the input media type */ BLT_PcmMediaType_Init(&self->input.media_type); self->input.media_type.sample_format = BLT_PCM_SAMPLE_FORMAT_SIGNED_INT_LE; /* setup the output media type */ BLT_MediaType_Init(&self->output.media_type, ((WaveFormatterModule*)module)->wav_type_id); /* setup interfaces */ ATX_SET_INTERFACE_EX(self, WaveFormatter, BLT_BaseMediaNode, BLT_MediaNode); ATX_SET_INTERFACE_EX(self, WaveFormatter, BLT_BaseMediaNode, ATX_Referenceable); ATX_SET_INTERFACE(&self->input, WaveFormatterInput, BLT_MediaPort); ATX_SET_INTERFACE(&self->input, WaveFormatterInput, BLT_OutputStreamProvider); ATX_SET_INTERFACE(&self->output, WaveFormatterOutput, BLT_MediaPort); ATX_SET_INTERFACE(&self->output, WaveFormatterOutput, BLT_OutputStreamUser); *object = &ATX_BASE_EX(self, BLT_BaseMediaNode, BLT_MediaNode); return BLT_SUCCESS; }
/*---------------------------------------------------------------------- | WaveFormatter_Destroy +---------------------------------------------------------------------*/ static BLT_Result WaveFormatter_Destroy(WaveFormatter* self) { ATX_LOG_FINE("WaveFormatter::Destroy"); /* destruct the inherited object */ BLT_BaseMediaNode_Destruct(&ATX_BASE(self, BLT_BaseMediaNode)); /* free the object memory */ ATX_FreeMemory(self); return BLT_SUCCESS; }
/*---------------------------------------------------------------------- | BLT_DecoderServer::~BLT_DecoderServer +---------------------------------------------------------------------*/ BLT_DecoderServer::~BLT_DecoderServer() { ATX_LOG_FINE("enter"); // send a message to our thread to make it terminate PostMessage(new NPT_TerminateMessage); // wait for the thread to terminate Wait(); // delete the message queue delete m_MessageQueue; }
/*---------------------------------------------------------------------- | Mp4Parser_SetupVideoOutput +---------------------------------------------------------------------*/ static BLT_Result Mp4Parser_SetupVideoOutput(Mp4Parser* self, AP4_Movie* movie) { // get the video track AP4_Track* track = movie->GetTrack(AP4_Track::TYPE_VIDEO); self->video_output.track = track; if (track == NULL) return BLT_SUCCESS; ATX_LOG_FINE("found video track"); // use the first sample description by default return Mp4ParserOutput_SetSampleDescription(&self->video_output, 0); }
/*---------------------------------------------------------------------- | SilenceRemover_Create +---------------------------------------------------------------------*/ static BLT_Result SilenceRemover_Create(BLT_Module* module, BLT_Core* core, BLT_ModuleParametersType parameters_type, BLT_AnyConst parameters, BLT_MediaNode** object) { SilenceRemover* self; BLT_Result result; ATX_LOG_FINE("SilenceRemover::Create"); /* check parameters */ if (parameters == NULL || parameters_type != BLT_MODULE_PARAMETERS_TYPE_MEDIA_NODE_CONSTRUCTOR) { return BLT_ERROR_INVALID_PARAMETERS; } /* allocate memory for the object */ self = ATX_AllocateZeroMemory(sizeof(SilenceRemover)); if (self == NULL) { *object = NULL; return BLT_ERROR_OUT_OF_MEMORY; } /* construct the inherited object */ BLT_BaseMediaNode_Construct(&ATX_BASE(self, BLT_BaseMediaNode), module, core); /* construct the object */ self->state = SILENCE_REMOVER_STATE_START_OF_STREAM; /* setup the input and output ports */ result = SilenceRemover_SetupPorts(self); if (BLT_FAILED(result)) { BLT_BaseMediaNode_Destruct(&ATX_BASE(self, BLT_BaseMediaNode)); ATX_FreeMemory(self); *object = NULL; return result; } /* setup interfaces */ ATX_SET_INTERFACE_EX(self, SilenceRemover, BLT_BaseMediaNode, BLT_MediaNode); ATX_SET_INTERFACE_EX(self, SilenceRemover, BLT_BaseMediaNode, ATX_Referenceable); ATX_SET_INTERFACE(&self->input, SilenceRemoverInput, BLT_MediaPort); ATX_SET_INTERFACE(&self->input, SilenceRemoverInput, BLT_PacketConsumer); ATX_SET_INTERFACE(&self->output, SilenceRemoverOutput, BLT_MediaPort); ATX_SET_INTERFACE(&self->output, SilenceRemoverOutput, BLT_PacketProducer); *object = &ATX_BASE_EX(self, BLT_BaseMediaNode, BLT_MediaNode); return BLT_SUCCESS; }
/*---------------------------------------------------------------------- | BLT_TcpNetworkStream_Create +---------------------------------------------------------------------*/ BLT_Result BLT_TcpNetworkStream_Create(const char* name, ATX_InputStream** stream) { ATX_Socket* sock; ATX_String hostname = ATX_String_Create(name); ATX_UInt16 port = BLT_TCP_NETWORK_STREAM_DEFAULT_PORT; int sep; ATX_Result result = ATX_SUCCESS; /* default */ *stream = NULL; /* parse the hostname/port */ sep = ATX_String_FindCharFrom(&hostname, ':', 6); if (sep > 0) { /* we have a port number */ int port_long = 0; result = ATX_ParseInteger(name+sep+1, &port_long, ATX_FALSE); if (ATX_FAILED(result)) { ATX_LOG_WARNING("BLT_TcpNetworkStream_Create - invalid port spec"); goto end; } port = (ATX_UInt16)port_long; ATX_String_SetLength(&hostname, sep); } /* create a socket */ result = ATX_TcpClientSocket_Create(&sock); if (ATX_FAILED(result)) goto end; /* connect */ ATX_LOG_FINE_2("BLT_TcpNetworkStream_Create - connecting to %s:%d", ATX_CSTR(hostname), port); result = ATX_Socket_ConnectToHost(sock, ATX_CSTR(hostname), port, BLT_TCP_NETWORK_STREAM_DEFAULT_TIMEOUT); if (ATX_FAILED(result)) { ATX_LOG_WARNING_1("BLT_TcpNetworkStream_Create - failed to connect (%d)", result); goto end; } ATX_LOG_FINE("BLT_TcpNetworkStream_Create - connected"); /* return the input stream */ result = ATX_Socket_GetInputStream(sock, stream); /* release the socket */ ATX_DESTROY_OBJECT(sock); end: ATX_String_Destruct(&hostname); return result; }
/*---------------------------------------------------------------------- | AacDecoder_Create +---------------------------------------------------------------------*/ static BLT_Result AacDecoder_Create(BLT_Module* module, BLT_Core* core, BLT_ModuleParametersType parameters_type, BLT_CString parameters, BLT_MediaNode** object) { AacDecoder* self; AacDecoderModule* aac_decoder_module = (AacDecoderModule*)module; BLT_Result result; ATX_LOG_FINE("AacDecoder::Create"); /* check parameters */ if (parameters == NULL || parameters_type != BLT_MODULE_PARAMETERS_TYPE_MEDIA_NODE_CONSTRUCTOR) { return BLT_ERROR_INVALID_PARAMETERS; } /* allocate memory for the object */ self = ATX_AllocateZeroMemory(sizeof(AacDecoder)); if (self == NULL) { *object = NULL; return BLT_ERROR_OUT_OF_MEMORY; } /* construct the inherited object */ BLT_BaseMediaNode_Construct(&ATX_BASE(self, BLT_BaseMediaNode), module, core); /* setup the input and output ports */ result = AacDecoder_SetupPorts(self, aac_decoder_module->mp4es_type_id); if (BLT_FAILED(result)) { ATX_FreeMemory(self); *object = NULL; return result; } /* setup interfaces */ ATX_SET_INTERFACE_EX(self, AacDecoder, BLT_BaseMediaNode, BLT_MediaNode); ATX_SET_INTERFACE_EX(self, AacDecoder, BLT_BaseMediaNode, ATX_Referenceable); ATX_SET_INTERFACE(&self->input, AacDecoderInput, BLT_MediaPort); ATX_SET_INTERFACE(&self->input, AacDecoderInput, BLT_PacketConsumer); ATX_SET_INTERFACE(&self->output, AacDecoderOutput, BLT_MediaPort); ATX_SET_INTERFACE(&self->output, AacDecoderOutput, BLT_PacketProducer); *object = &ATX_BASE_EX(self, BLT_BaseMediaNode, BLT_MediaNode); return BLT_SUCCESS; }
/*---------------------------------------------------------------------- | OsxAudioUnitsOutput_Resume +---------------------------------------------------------------------*/ BLT_METHOD OsxAudioUnitsOutput_Resume(BLT_MediaNode* _self) { OsxAudioUnitsOutput* self = ATX_SELF_EX(OsxAudioUnitsOutput, BLT_BaseMediaNode, BLT_MediaNode); ComponentResult result; if (self->paused) { ATX_LOG_FINE("resuming output"); self->paused = BLT_FALSE; result = AudioOutputUnitStart(self->audio_unit); if (result != noErr) { ATX_LOG_WARNING_1("AudioUnitOutputStart failed (%d)", (int)result); } } return BLT_SUCCESS; }
/*---------------------------------------------------------------------- | DebugOutput_Destroy +---------------------------------------------------------------------*/ static BLT_Result DebugOutput_Destroy(DebugOutput* self) { ATX_LOG_FINE("DebugOutput::Destroy"); /* free the media type extensions */ BLT_MediaType_Free(self->expected_media_type); /* destruct the inherited object */ BLT_BaseMediaNode_Destruct(&ATX_BASE(self, BLT_BaseMediaNode)); /* free the object memory */ ATX_FreeMemory(self); return BLT_SUCCESS; }
/*---------------------------------------------------------------------- | CrossFader_Create +---------------------------------------------------------------------*/ static BLT_Result CrossFader_Create(BLT_Module* module, BLT_Core* core, BLT_ModuleParametersType parameters_type, BLT_CString parameters, ATX_Object* object) { CrossFader* fader; BLT_Result result; ATX_LOG_FINE("CrossFader::Create"); /* check parameters */ if (parameters == NULL || parameters_type != BLT_MODULE_PARAMETERS_TYPE_MEDIA_NODE_CONSTRUCTOR) { return BLT_ERROR_INVALID_PARAMETERS; } /* allocate memory for the object */ fader = ATX_AllocateZeroMemory(sizeof(CrossFader)); if (fader == NULL) { ATX_CLEAR_OBJECT(object); return BLT_ERROR_OUT_OF_MEMORY; } /* construct the inherited object */ BLT_BaseMediaNode_Construct(&fader->base, module, core); /* construct the object */ fader->state = CROSS_FADER_STATE_IN_START; /* setup the input and output ports */ result = CrossFader_SetupPorts(fader); if (BLT_FAILED(result)) { BLT_BaseMediaNode_Destruct(&fader->base); ATX_FreeMemory(fader); ATX_CLEAR_OBJECT(object); return result; } /* construct reference */ ATX_INSTANCE(object) = (ATX_Instance*)fader; ATX_INTERFACE(object) = (ATX_Interface*)&CrossFader_BLT_MediaNodeInterface; return BLT_SUCCESS; }
/*---------------------------------------------------------------------- | PcmAdapter_Destroy +---------------------------------------------------------------------*/ static BLT_Result PcmAdapter_Destroy(PcmAdapter* self) { ATX_LOG_FINE("PcmAdapter::Destroy"); /* release any input packet we may hold */ if (self->output.packet) { BLT_MediaPacket_Release(self->output.packet); } /* destruct the inherited object */ BLT_BaseMediaNode_Destruct(&ATX_BASE(self, BLT_BaseMediaNode)); /* free the object memory */ ATX_FreeMemory((void*)self); return BLT_SUCCESS; }
/*---------------------------------------------------------------------- | WaveParser_Destroy +---------------------------------------------------------------------*/ static BLT_Result WaveParser_Destroy(WaveParser* self) { ATX_LOG_FINE("WaveParser::Destroy"); /* release the byte stream */ ATX_RELEASE_OBJECT(self->output.stream); /* free the media type extensions */ BLT_MediaType_Free(self->output.media_type); /* destruct the inherited object */ BLT_BaseMediaNode_Destruct(&ATX_BASE(self, BLT_BaseMediaNode)); /* free the object memory */ ATX_FreeMemory(self); return BLT_SUCCESS; }
/*---------------------------------------------------------------------- | AlsaOutput_Destroy +---------------------------------------------------------------------*/ static BLT_Result AlsaOutput_Destroy(AlsaOutput* self) { ATX_LOG_FINE("destroying output"); /* close the device */ AlsaOutput_Close(self); /* free the name */ ATX_String_Destruct(&self->device_name); /* destruct the inherited object */ BLT_BaseMediaNode_Destruct(&ATX_BASE(self, BLT_BaseMediaNode)); /* free the object memory */ ATX_FreeMemory(self); return BLT_SUCCESS; }
/*---------------------------------------------------------------------- | DebugOutput_Create +---------------------------------------------------------------------*/ static BLT_Result DebugOutput_Create(BLT_Module* module, BLT_Core* core, BLT_ModuleParametersType parameters_type, BLT_CString parameters, BLT_MediaNode** object) { DebugOutput* self; BLT_MediaNodeConstructor* constructor = (BLT_MediaNodeConstructor*)parameters; ATX_LOG_FINE("DebugOutput::Create"); /* check parameters */ if (parameters == NULL || parameters_type != BLT_MODULE_PARAMETERS_TYPE_MEDIA_NODE_CONSTRUCTOR) { return BLT_ERROR_INVALID_PARAMETERS; } /* allocate memory for the object */ self = ATX_AllocateZeroMemory(sizeof(DebugOutput)); if (self == NULL) { *object = NULL; return BLT_ERROR_OUT_OF_MEMORY; } /* construct the inherited object */ BLT_BaseMediaNode_Construct(&ATX_BASE(self, BLT_BaseMediaNode), module, core); /* keep the media type info */ BLT_MediaType_Clone(constructor->spec.input.media_type, &self->expected_media_type); /* setup interfaces */ ATX_SET_INTERFACE_EX(self, DebugOutput, BLT_BaseMediaNode, BLT_MediaNode); ATX_SET_INTERFACE_EX(self, DebugOutput, BLT_BaseMediaNode, ATX_Referenceable); ATX_SET_INTERFACE(self, DebugOutput, BLT_PacketConsumer); ATX_SET_INTERFACE(self, DebugOutput, BLT_MediaPort); *object = &ATX_BASE_EX(self, BLT_BaseMediaNode, BLT_MediaNode); return BLT_SUCCESS; }
/*---------------------------------------------------------------------- | AacDecoder_Destroy +---------------------------------------------------------------------*/ static BLT_Result AacDecoder_Destroy(AacDecoder* self) { ATX_LOG_FINE("AacDecoder::Destroy"); /* release any packet we may hold */ AacDecoderOutput_Flush(self); ATX_List_Destroy(self->output.packets); /* destroy the Melo decoder */ if (self->helix_decoder) AACFreeDecoder(self->helix_decoder); /* destruct the inherited object */ BLT_BaseMediaNode_Destruct(&ATX_BASE(self, BLT_BaseMediaNode)); /* free the object memory */ ATX_FreeMemory(self); return BLT_SUCCESS; }