Indentation changes.
Moved one comment around in pv_2way_proxy_adapter.cpp
Untabified the buffers.
diff --git a/android/playerdriver.cpp b/android/playerdriver.cpp
index 3ebfb95..b817bb0 100644
--- a/android/playerdriver.cpp
+++ b/android/playerdriver.cpp
@@ -196,12 +196,12 @@
} // anonymous namespace
class PlayerDriver :
- public OsclActiveObject,
- public PVCommandStatusObserver,
- public PVInformationalEventObserver,
- public PVErrorEventObserver
+ public OsclActiveObject,
+ public PVCommandStatusObserver,
+ public PVInformationalEventObserver,
+ public PVErrorEventObserver
{
-public:
+ public:
PlayerDriver(PVPlayer* pvPlayer);
~PlayerDriver();
@@ -237,7 +237,7 @@
void HandleErrorEvent(const PVAsyncErrorEvent& aEvent);
void HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent);
-private:
+ private:
// Finish up a non-async code in such a way that
// the event loop will keep running.
void FinishSyncCommand(PlayerCommand* command);
@@ -300,17 +300,17 @@
};
PlayerDriver::PlayerDriver(PVPlayer* pvPlayer) :
- OsclActiveObject(OsclActiveObject::EPriorityNominal, "PVPlayerPlayer"),
- mPvPlayer(pvPlayer),
- mIsLooping(false),
- mDoLoop(false),
- mDataReadyReceived(false),
- mPrepareDone(false),
- mEndOfData(false),
- mRecentSeek(0),
- mSeekComp(true),
- mSeekPending(false),
- mEmulation(false)
+ OsclActiveObject(OsclActiveObject::EPriorityNominal, "PVPlayerPlayer"),
+ mPvPlayer(pvPlayer),
+ mIsLooping(false),
+ mDoLoop(false),
+ mDataReadyReceived(false),
+ mPrepareDone(false),
+ mEndOfData(false),
+ mRecentSeek(0),
+ mSeekComp(true),
+ mSeekPending(false),
+ mEmulation(false)
{
LOGV("constructor");
mSyncSem = new OsclSemaphore();
@@ -472,84 +472,84 @@
LOGV("Send player code: %d", command->code());
switch (command->code()) {
- case PlayerCommand::PLAYER_SETUP:
- handleSetup(static_cast<PlayerSetup*>(command));
- break;
+ case PlayerCommand::PLAYER_SETUP:
+ handleSetup(static_cast<PlayerSetup*>(command));
+ break;
- case PlayerCommand::PLAYER_SET_DATA_SOURCE:
- handleSetDataSource(static_cast<PlayerSetDataSource*>(command));
- break;
+ case PlayerCommand::PLAYER_SET_DATA_SOURCE:
+ handleSetDataSource(static_cast<PlayerSetDataSource*>(command));
+ break;
- case PlayerCommand::PLAYER_SET_VIDEO_SURFACE:
- handleSetVideoSurface(static_cast<PlayerSetVideoSurface*>(command));
- break;
+ case PlayerCommand::PLAYER_SET_VIDEO_SURFACE:
+ handleSetVideoSurface(static_cast<PlayerSetVideoSurface*>(command));
+ break;
- case PlayerCommand::PLAYER_SET_AUDIO_SINK:
- handleSetAudioSink(static_cast<PlayerSetAudioSink*>(command));
- break;
+ case PlayerCommand::PLAYER_SET_AUDIO_SINK:
+ handleSetAudioSink(static_cast<PlayerSetAudioSink*>(command));
+ break;
- case PlayerCommand::PLAYER_INIT:
- handleInit(static_cast<PlayerInit*>(command));
- break;
+ case PlayerCommand::PLAYER_INIT:
+ handleInit(static_cast<PlayerInit*>(command));
+ break;
- case PlayerCommand::PLAYER_PREPARE:
- handlePrepare(static_cast<PlayerPrepare*>(command));
- break;
+ case PlayerCommand::PLAYER_PREPARE:
+ handlePrepare(static_cast<PlayerPrepare*>(command));
+ break;
- case PlayerCommand::PLAYER_START:
- handleStart(static_cast<PlayerStart*>(command));
- break;
+ case PlayerCommand::PLAYER_START:
+ handleStart(static_cast<PlayerStart*>(command));
+ break;
- case PlayerCommand::PLAYER_STOP:
- handleStop(static_cast<PlayerStop*>(command));
- break;
+ case PlayerCommand::PLAYER_STOP:
+ handleStop(static_cast<PlayerStop*>(command));
+ break;
- case PlayerCommand::PLAYER_PAUSE:
- handlePause(static_cast<PlayerPause*>(command));
- break;
+ case PlayerCommand::PLAYER_PAUSE:
+ handlePause(static_cast<PlayerPause*>(command));
+ break;
- case PlayerCommand::PLAYER_SEEK:
- handleSeek(static_cast<PlayerSeek*>(command));
- break;
+ case PlayerCommand::PLAYER_SEEK:
+ handleSeek(static_cast<PlayerSeek*>(command));
+ break;
- case PlayerCommand::PLAYER_GET_POSITION:
- handleGetPosition(static_cast<PlayerGetPosition*>(command));
- FinishSyncCommand(command);
- return;
+ case PlayerCommand::PLAYER_GET_POSITION:
+ handleGetPosition(static_cast<PlayerGetPosition*>(command));
+ FinishSyncCommand(command);
+ return;
- case PlayerCommand::PLAYER_GET_STATUS:
- handleGetStatus(static_cast<PlayerGetStatus*>(command));
- FinishSyncCommand(command);
- return;
+ case PlayerCommand::PLAYER_GET_STATUS:
+ handleGetStatus(static_cast<PlayerGetStatus*>(command));
+ FinishSyncCommand(command);
+ return;
- case PlayerCommand::PLAYER_GET_DURATION:
- handleGetDuration(static_cast<PlayerGetDuration*>(command));
- break;
+ case PlayerCommand::PLAYER_GET_DURATION:
+ handleGetDuration(static_cast<PlayerGetDuration*>(command));
+ break;
- case PlayerCommand::PLAYER_REMOVE_DATA_SOURCE:
- handleRemoveDataSource(static_cast<PlayerRemoveDataSource*>(command));
- break;
+ case PlayerCommand::PLAYER_REMOVE_DATA_SOURCE:
+ handleRemoveDataSource(static_cast<PlayerRemoveDataSource*>(command));
+ break;
- case PlayerCommand::PLAYER_CANCEL_ALL_COMMANDS:
- handleCancelAllCommands(static_cast<PlayerCancelAllCommands*>(command));
- break;
+ case PlayerCommand::PLAYER_CANCEL_ALL_COMMANDS:
+ handleCancelAllCommands(static_cast<PlayerCancelAllCommands*>(command));
+ break;
- case PlayerCommand::PLAYER_RESET:
- handleReset(static_cast<PlayerReset*>(command));
- break;
+ case PlayerCommand::PLAYER_RESET:
+ handleReset(static_cast<PlayerReset*>(command));
+ break;
- case PlayerCommand::PLAYER_QUIT:
- handleQuit(static_cast<PlayerQuit*>(command));
- return;
+ case PlayerCommand::PLAYER_QUIT:
+ handleQuit(static_cast<PlayerQuit*>(command));
+ return;
- case PlayerCommand::PLAYER_SET_LOOP:
- mIsLooping = static_cast<PlayerSetLoop*>(command)->loop();
- FinishSyncCommand(command);
- return;
+ case PlayerCommand::PLAYER_SET_LOOP:
+ mIsLooping = static_cast<PlayerSetLoop*>(command)->loop();
+ FinishSyncCommand(command);
+ return;
- default:
- LOGE("Unexpected code %d", command->code());
- break;
+ default:
+ LOGE("Unexpected code %d", command->code());
+ break;
}
}
@@ -806,7 +806,7 @@
// if we are paused, just resume
PVPlayerState state;
if (mPlayer->GetPVPlayerStateSync(state) == PVMFSuccess
- && (state == PVP_STATE_PAUSED)) {
+ && (state == PVP_STATE_PAUSED)) {
if (mEndOfData) {
// if we are at the end, seek to the beginning first
mEndOfData = false;
@@ -836,7 +836,7 @@
// Seeking in the pause state
PVPlayerState state;
if (mPlayer->GetPVPlayerStateSync(state) == PVMFSuccess
- && (state == PVP_STATE_PAUSED)) {
+ && (state == PVP_STATE_PAUSED)) {
mSeekComp = false;
}
PVPPlaybackPosition begin, end;
@@ -860,8 +860,8 @@
// In the pause state, get the progress bar position from the recent seek value
// instead of GetCurrentPosition() from PVPlayer Engine.
if (mPlayer->GetPVPlayerStateSync(state) == PVMFSuccess
- && (state == PVP_STATE_PAUSED)
- && (mSeekComp == false)) {
+ && (state == PVP_STATE_PAUSED)
+ && (mSeekComp == false)) {
command->set(mRecentSeek);
}
else {
@@ -905,11 +905,9 @@
mDoLoop = false;
PVPlayerState state;
if ((mPlayer->GetPVPlayerStateSync(state) == PVMFSuccess)
- && ( (state == PVP_STATE_PAUSED) ||
- (state == PVP_STATE_PREPARED) ||
- (state == PVP_STATE_STARTED)
- )
- )
+ && ( (state == PVP_STATE_PAUSED) ||
+ (state == PVP_STATE_PREPARED) ||
+ (state == PVP_STATE_STARTED) ))
{
OSCL_TRY(error, mPlayer->Stop(command));
OSCL_FIRST_CATCH_ANY(error, commandFailed(command));
@@ -1115,33 +1113,33 @@
if (status == PVMFSuccess) {
switch (command->code()) {
- case PlayerCommand::PLAYER_PREPARE:
- LOGV("PLAYER_PREPARE complete mDownloadContextData=%p, mDataReadyReceived=%d", mDownloadContextData, mDataReadyReceived);
- mPrepareDone = true;
- // If we are streaming from the network, we
- // have to wait until the first PVMFInfoDataReady
- // is sent to notify the user that it is okay to
- // begin playback. If it is a local file, just
- // send it now at the completion of Prepare().
- if ((mDownloadContextData == NULL) || mDataReadyReceived) {
- mPvPlayer->sendEvent(MEDIA_PREPARED);
- }
- break;
+ case PlayerCommand::PLAYER_PREPARE:
+ LOGV("PLAYER_PREPARE complete mDownloadContextData=%p, mDataReadyReceived=%d", mDownloadContextData, mDataReadyReceived);
+ mPrepareDone = true;
+ // If we are streaming from the network, we
+ // have to wait until the first PVMFInfoDataReady
+ // is sent to notify the user that it is okay to
+ // begin playback. If it is a local file, just
+ // send it now at the completion of Prepare().
+ if ((mDownloadContextData == NULL) || mDataReadyReceived) {
+ mPvPlayer->sendEvent(MEDIA_PREPARED);
+ }
+ break;
- case PlayerCommand::PLAYER_GET_DURATION:
- handleGetDurationComplete(static_cast<PlayerGetDuration*>(command));
- break;
+ case PlayerCommand::PLAYER_GET_DURATION:
+ handleGetDurationComplete(static_cast<PlayerGetDuration*>(command));
+ break;
- case PlayerCommand::PLAYER_PAUSE:
- LOGV("pause complete");
- break;
+ case PlayerCommand::PLAYER_PAUSE:
+ LOGV("pause complete");
+ break;
- case PlayerCommand::PLAYER_SEEK:
- mPvPlayer->sendEvent(MEDIA_SEEK_COMPLETE);
- break;
+ case PlayerCommand::PLAYER_SEEK:
+ mPvPlayer->sendEvent(MEDIA_SEEK_COMPLETE);
+ break;
- default: /* shut up gcc */
- break;
+ default: /* shut up gcc */
+ break;
}
// Call the user's requested completion function
@@ -1151,7 +1149,7 @@
LOGE("Command (%d) was cancelled", command->code());
status = PVMFSuccess;
command->complete(NO_ERROR, true);
- } else {
+ } else {
// Try to map the PV error code to an Android one.
LOGE("Command %s completed with an error or info %s", command->toString(), PVMFStatusToString(status));
const media_event_type event_type = MapStatusToEventType(status);
@@ -1194,102 +1192,102 @@
LOGV("HandleInformationalEvent: %s", PVMFStatusToString(status));
switch (status) {
- case PVMFInfoEndOfData:
- mEndOfData = true;
- if (mIsLooping) {
- mDoLoop = true;
- Cancel();
- RunIfNotReady();
- } else {
- mPvPlayer->sendEvent(MEDIA_PLAYBACK_COMPLETE);
- }
- break;
-
- case PVMFInfoErrorHandlingComplete:
- LOGW("PVMFInfoErrorHandlingComplete");
- RunIfNotReady();
- break;
-
- case PVMFInfoBufferingStart:
- mPvPlayer->sendEvent(MEDIA_BUFFERING_UPDATE, 0);
- break;
-
- case PVMFInfoBufferingStatus:
- {
- const void *buffer = aEvent.GetLocalBuffer();
- const size_t size = aEvent.GetLocalBufferSize();
- int percentage;
-
- if (GetBufferingPercentage(buffer, size, &percentage))
- {
- LOGD("buffering (%d)", percentage);
- mPvPlayer->sendEvent(MEDIA_BUFFERING_UPDATE, percentage);
+ case PVMFInfoEndOfData:
+ mEndOfData = true;
+ if (mIsLooping) {
+ mDoLoop = true;
+ Cancel();
+ RunIfNotReady();
+ } else {
+ mPvPlayer->sendEvent(MEDIA_PLAYBACK_COMPLETE);
}
- }
- break;
+ break;
- case PVMFInfoDurationAvailable:
- {
- PVUuid infomsguuid = PVMFDurationInfoMessageInterfaceUUID;
- PVMFDurationInfoMessageInterface* eventMsg = NULL;
- PVInterface* infoExtInterface = aEvent.GetEventExtensionInterface();
- if (infoExtInterface &&
- infoExtInterface->queryInterface(infomsguuid, (PVInterface*&)eventMsg))
+ case PVMFInfoErrorHandlingComplete:
+ LOGW("PVMFInfoErrorHandlingComplete");
+ RunIfNotReady();
+ break;
+
+ case PVMFInfoBufferingStart:
+ mPvPlayer->sendEvent(MEDIA_BUFFERING_UPDATE, 0);
+ break;
+
+ case PVMFInfoBufferingStatus:
{
- PVUuid eventuuid;
- int32 infoCode;
- eventMsg->GetCodeUUID(infoCode, eventuuid);
- if (eventuuid == infomsguuid)
+ const void *buffer = aEvent.GetLocalBuffer();
+ const size_t size = aEvent.GetLocalBufferSize();
+ int percentage;
+
+ if (GetBufferingPercentage(buffer, size, &percentage))
{
- uint32 SourceDurationInMS = eventMsg->GetDuration();
- LOGV(".... with duration = %u ms",SourceDurationInMS);
+ LOGD("buffering (%d)", percentage);
+ mPvPlayer->sendEvent(MEDIA_BUFFERING_UPDATE, percentage);
}
}
- }
- break;
-
- case PVMFInfoDataReady:
- if (mDataReadyReceived)
break;
- mDataReadyReceived = true;
- // If this is a network stream, we are now ready to play.
- if (mDownloadContextData && mPrepareDone) {
- mPvPlayer->sendEvent(MEDIA_PREPARED);
- }
- break;
- case PVMFInfoVideoTrackFallingBehind:
- // TODO: This event should not be passed to the user in the ERROR channel.
- LOGW("Video track fell behind");
- mPvPlayer->sendEvent(MEDIA_INFO, ::android::MEDIA_INFO_VIDEO_TRACK_LAGGING,
- PVMFInfoVideoTrackFallingBehind);
- break;
+ case PVMFInfoDurationAvailable:
+ {
+ PVUuid infomsguuid = PVMFDurationInfoMessageInterfaceUUID;
+ PVMFDurationInfoMessageInterface* eventMsg = NULL;
+ PVInterface* infoExtInterface = aEvent.GetEventExtensionInterface();
+ if (infoExtInterface &&
+ infoExtInterface->queryInterface(infomsguuid, (PVInterface*&)eventMsg))
+ {
+ PVUuid eventuuid;
+ int32 infoCode;
+ eventMsg->GetCodeUUID(infoCode, eventuuid);
+ if (eventuuid == infomsguuid)
+ {
+ uint32 SourceDurationInMS = eventMsg->GetDuration();
+ LOGV(".... with duration = %u ms",SourceDurationInMS);
+ }
+ }
+ }
+ break;
- case PVMFInfoPoorlyInterleavedContent:
- // TODO: This event should not be passed to the user in the ERROR channel.
- LOGW("Poorly interleaved content.");
- mPvPlayer->sendEvent(MEDIA_INFO, ::android::MEDIA_INFO_BAD_INTERLEAVING,
- PVMFInfoPoorlyInterleavedContent);
- break;
+ case PVMFInfoDataReady:
+ if (mDataReadyReceived)
+ break;
+ mDataReadyReceived = true;
+ // If this is a network stream, we are now ready to play.
+ if (mDownloadContextData && mPrepareDone) {
+ mPvPlayer->sendEvent(MEDIA_PREPARED);
+ }
+ break;
- case PVMFInfoContentTruncated:
- LOGE("Content is truncated.");
- break;
+ case PVMFInfoVideoTrackFallingBehind:
+ // TODO: This event should not be passed to the user in the ERROR channel.
+ LOGW("Video track fell behind");
+ mPvPlayer->sendEvent(MEDIA_INFO, ::android::MEDIA_INFO_VIDEO_TRACK_LAGGING,
+ PVMFInfoVideoTrackFallingBehind);
+ break;
+
+ case PVMFInfoPoorlyInterleavedContent:
+ // TODO: This event should not be passed to the user in the ERROR channel.
+ LOGW("Poorly interleaved content.");
+ mPvPlayer->sendEvent(MEDIA_INFO, ::android::MEDIA_INFO_BAD_INTERLEAVING,
+ PVMFInfoPoorlyInterleavedContent);
+ break;
+
+ case PVMFInfoContentTruncated:
+ LOGE("Content is truncated.");
+ break;
/* Certain events we don't really care about, but don't
* want log spewage, so just no-op them here.
*/
- case PVMFInfoPositionStatus:
- case PVMFInfoBufferingComplete:
- case PVMFInfoContentLength:
- case PVMFInfoContentType:
- case PVMFInfoUnderflow:
- case PVMFInfoDataDiscarded:
- break;
+ case PVMFInfoPositionStatus:
+ case PVMFInfoBufferingComplete:
+ case PVMFInfoContentLength:
+ case PVMFInfoContentType:
+ case PVMFInfoUnderflow:
+ case PVMFInfoDataDiscarded:
+ break;
- default:
- LOGV("HandleInformationalEvent: type=%d UNHANDLED", status);
- break;
+ default:
+ LOGV("HandleInformationalEvent: type=%d UNHANDLED", status);
+ break;
}
}
diff --git a/engines/2way/src/pv_2way_proxy_adapter.cpp b/engines/2way/src/pv_2way_proxy_adapter.cpp
index 767a1df..df36e9e 100644
--- a/engines/2way/src/pv_2way_proxy_adapter.cpp
+++ b/engines/2way/src/pv_2way_proxy_adapter.cpp
@@ -84,10 +84,10 @@
}
CPV2WayProxyAdapter *CPV2WayProxyAdapter::New(TPVTerminalType aTerminalType,
- PVCommandStatusObserver* aCmdStatusObserver,
- PVInformationalEventObserver *aInfoEventObserver,
- PVErrorEventObserver *aErrorEventObserver)
-//called by the factory to create a new proxied 2way interface.
+ PVCommandStatusObserver* aCmdStatusObserver,
+ PVInformationalEventObserver *aInfoEventObserver,
+ PVErrorEventObserver *aErrorEventObserver)
+ //called by the factory to create a new proxied 2way interface.
{
int32 error;
CPV2WayProxyAdapter* aRet = OSCL_NEW(CPV2WayProxyAdapter, ());
@@ -160,8 +160,8 @@
}
+// Called by the factory to delete 2way interface.
CPV2WayProxyAdapter::~CPV2WayProxyAdapter()
-//called by the factory to delete 2way interface.
{
PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "CPV2WayProxyAdapter::~CPV2WayProxyAdapter iterminalEngine(%x)", iterminalEngine));
if (iPVProxy)
@@ -177,7 +177,7 @@
//
OSCL_EXPORT_REF void CPV2WayProxyAdapter::DeleteTerminal(PVLogger *aLogger)
-//called by proxy base class to delete terminal under the PV thread.
+ //called by proxy base class to delete terminal under the PV thread.
{
PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, aLogger, PVLOGMSG_STACK_TRACE, (0, "CPV2WayProxyAdapter::DeleteTerminal-in"));
if (iterminalEngine)
@@ -187,13 +187,13 @@
}
OSCL_EXPORT_REF void CPV2WayProxyAdapter::CreateTerminal(PVLogger *aLogger)
-//called by proxy base class to create terminal under the PV thread.
+ //called by proxy base class to create terminal under the PV thread.
{
OSCL_UNUSED_ARG(aLogger);
iterminalEngine = CPV2WayEngineFactory::CreateTerminal(PV_324M,
- this,//observers
- this,
- this);
+ this,//observers
+ this,
+ this);
}
OSCL_EXPORT_REF void CPV2WayProxyAdapter::CreateLoggerAppenders()
@@ -213,7 +213,7 @@
}
OSCL_EXPORT_REF void CPV2WayProxyAdapter::CleanupMessage(CPVCmnInterfaceCmdMessage *cmdMsg, PVLogger *aLogger)
-//Cleanup an un-processed command message that was passed to SendAPI.
+ //Cleanup an un-processed command message that was passed to SendAPI.
{
OSCL_UNUSED_ARG(aLogger);
if (cmdMsg)
@@ -221,14 +221,14 @@
}
OSCL_EXPORT_REF void CPV2WayProxyAdapter::CleanupNotification(CPVCmnInterfaceObserverMessage *obsMsg, PVLogger *aLogger)
-//Cleanup an un-processed notifier message that was passed to NotifyCaller
+ //Cleanup an un-processed notifier message that was passed to NotifyCaller
{
OSCL_UNUSED_ARG(aLogger);
OSCL_UNUSED_ARG(obsMsg);
}
OSCL_EXPORT_REF void CPV2WayProxyAdapter::ProcessMessage(CPVCmnInterfaceCmdMessage *aMsg, PVLogger *aLogger)
-//called in the PV thread to field a command.
+ //called in the PV thread to field a command.
{
OSCL_UNUSED_ARG(aLogger);
if (!aMsg)
@@ -270,7 +270,7 @@
}
OSCL_EXPORT_REF void CPV2WayProxyAdapter::CleanupNotification(TPVProxyMsgId aId,
- OsclAny* aMsg)
+ OsclAny* aMsg)
{
OSCL_UNUSED_ARG(aId);
OSCL_UNUSED_ARG(aMsg);
@@ -278,7 +278,7 @@
}
OSCL_EXPORT_REF void CPV2WayProxyAdapter::ProcessNotification(CPVCmnInterfaceObserverMessage *aMsg, PVLogger *aLogger)
-//called in the app thread to notify observer.
+ //called in the app thread to notify observer.
{
int32 err = 0;
OSCL_TRY(err, ProcessNotificationL(aMsg););
@@ -347,8 +347,8 @@
}
PVCommandId CPV2WayProxyAdapter::AddDataSource(PVTrackId aTrackId,
- PVMFNodeInterface& aDataSource,
- OsclAny* aContextData)
+ PVMFNodeInterface& aDataSource,
+ OsclAny* aContextData)
{
PV2WayMessageAddDataSource *msg = OSCL_NEW(PV2WayMessageAddDataSource, (aTrackId, aDataSource, aContextData));
if (msg == NULL)
@@ -369,8 +369,8 @@
}
PVCommandId CPV2WayProxyAdapter::AddDataSink(PVTrackId aTrackId,
- PVMFNodeInterface& aDataSink,
- OsclAny* aContextData)
+ PVMFNodeInterface& aDataSink,
+ OsclAny* aContextData)
{
PV2WayMessageAddDataSink *msg = OSCL_NEW(PV2WayMessageAddDataSink, (aTrackId, aDataSink, aContextData));
if (msg == NULL)
@@ -391,8 +391,8 @@
}
PVCommandId CPV2WayProxyAdapter::Connect(const PV2WayConnectOptions& aOptions,
- PVMFNodeInterface* aCommServer,
- OsclAny* aContextData)
+ PVMFNodeInterface* aCommServer,
+ OsclAny* aContextData)
{
PV2WayMessageConnect *msg = OSCL_NEW(PV2WayMessageConnect, (aOptions, aCommServer, aContextData));
if (msg == NULL)
@@ -568,7 +568,7 @@
PVCommandId CPV2WayProxyAdapter::QueryUUID(const PvmfMimeString& aMimeType, Oscl_Vector<PVUuid, BasicAlloc>& aUuids,
- bool aExactUuidsOnly, OsclAny* aContextData)
+ bool aExactUuidsOnly, OsclAny* aContextData)
{
PV2WayMessageQueryUUID *msg = OSCL_NEW(PV2WayMessageQueryUUID, (aMimeType, aUuids, aExactUuidsOnly, aContextData));
if (msg == NULL)
@@ -690,7 +690,7 @@
//
void CPV2WayProxyAdapter::ProcessMessageL(CPVCmnInterfaceCmdMessage *aMsg)
-//called in the PV thread to field a command.
+ //called in the PV thread to field a command.
{
int32 error = 0;
//Call the engine, passing the command message pointer as the context data.
@@ -701,35 +701,35 @@
switch (aMsg->GetType())
{
case PVT_COMMAND_INIT:
- {
- OSCL_TRY(error, iterminalEngine->Init(
- OSCL_STATIC_CAST(PV2WayMessageInit *, aMsg)->iInitInfo,
- aMsg));
- }
- break;
+ {
+ OSCL_TRY(error, iterminalEngine->Init(
+ OSCL_STATIC_CAST(PV2WayMessageInit *, aMsg)->iInitInfo,
+ aMsg));
+ }
+ break;
case PVT_COMMAND_GET_SDK_INFO:
- {
- OSCL_TRY(error, iterminalEngine->GetSDKInfo(
- OSCL_STATIC_CAST(PV2WayMessageGetSDKInfo *, aMsg)->iSDKInfo,
- aMsg));
- }
- break;
+ {
+ OSCL_TRY(error, iterminalEngine->GetSDKInfo(
+ OSCL_STATIC_CAST(PV2WayMessageGetSDKInfo *, aMsg)->iSDKInfo,
+ aMsg));
+ }
+ break;
case PVT_COMMAND_GET_SDK_MODULE_INFO:
- {
- OSCL_TRY(error, iterminalEngine->GetSDKModuleInfo(
- OSCL_STATIC_CAST(PV2WayMessageGetSDKModuleInfo* , aMsg)->iSDKModuleInfo,
- aMsg));
- }
- break;
+ {
+ OSCL_TRY(error, iterminalEngine->GetSDKModuleInfo(
+ OSCL_STATIC_CAST(PV2WayMessageGetSDKModuleInfo* , aMsg)->iSDKModuleInfo,
+ aMsg));
+ }
+ break;
case PVT_COMMAND_GET_PV2WAY_STATE:
- {
- OSCL_TRY(error, iterminalEngine->GetState(
- OSCL_STATIC_CAST(PV2WayMessageGetPV2WayState*, aMsg)->iState,
- aMsg));
- }
- break;
+ {
+ OSCL_TRY(error, iterminalEngine->GetState(
+ OSCL_STATIC_CAST(PV2WayMessageGetPV2WayState*, aMsg)->iState,
+ aMsg));
+ }
+ break;
case PVT_COMMAND_RESET:
OSCL_TRY(error, iterminalEngine->Reset(aMsg));
@@ -737,35 +737,35 @@
case PVT_COMMAND_ADD_DATA_SOURCE:
OSCL_TRY(error, iterminalEngine->AddDataSource(
- OSCL_STATIC_CAST(PV2WayMessageAddDataSource *, aMsg)->iTrackId,
- OSCL_STATIC_CAST(PV2WayMessageAddDataSource *, aMsg)->iDataSource,
- aMsg));
+ OSCL_STATIC_CAST(PV2WayMessageAddDataSource *, aMsg)->iTrackId,
+ OSCL_STATIC_CAST(PV2WayMessageAddDataSource *, aMsg)->iDataSource,
+ aMsg));
break;
case PVT_COMMAND_REMOVE_DATA_SOURCE:
OSCL_TRY(error, iterminalEngine->RemoveDataSource(
- OSCL_STATIC_CAST(PV2WayMessageRemoveDataSource*, aMsg)->iDataSource,
- aMsg));
+ OSCL_STATIC_CAST(PV2WayMessageRemoveDataSource*, aMsg)->iDataSource,
+ aMsg));
break;
case PVT_COMMAND_ADD_DATA_SINK:
OSCL_TRY(error, iterminalEngine->AddDataSink(
- OSCL_STATIC_CAST(PV2WayMessageAddDataSink *, aMsg)->iTrackId,
- OSCL_STATIC_CAST(PV2WayMessageAddDataSink *, aMsg)->iDataSink,
- aMsg));
+ OSCL_STATIC_CAST(PV2WayMessageAddDataSink *, aMsg)->iTrackId,
+ OSCL_STATIC_CAST(PV2WayMessageAddDataSink *, aMsg)->iDataSink,
+ aMsg));
break;
case PVT_COMMAND_REMOVE_DATA_SINK:
OSCL_TRY(error, iterminalEngine->RemoveDataSink(
- OSCL_STATIC_CAST(PV2WayMessageRemoveDataSink* , aMsg)->iDataSink,
- aMsg));
+ OSCL_STATIC_CAST(PV2WayMessageRemoveDataSink* , aMsg)->iDataSink,
+ aMsg));
break;
case PVT_COMMAND_CONNECT:
OSCL_TRY(error, iterminalEngine->Connect(
- OSCL_STATIC_CAST(PV2WayMessageConnect *, aMsg)->iConnectOptions,
- OSCL_STATIC_CAST(PV2WayMessageConnect *, aMsg)->iCommServer,
- aMsg));
+ OSCL_STATIC_CAST(PV2WayMessageConnect *, aMsg)->iConnectOptions,
+ OSCL_STATIC_CAST(PV2WayMessageConnect *, aMsg)->iCommServer,
+ aMsg));
break;
case PVT_COMMAND_DISCONNECT:
@@ -774,69 +774,69 @@
case PVT_COMMAND_PAUSE:
OSCL_TRY(error, iterminalEngine->Pause(
- OSCL_STATIC_CAST(PV2WayMessagePause* , aMsg)->iDirection,
- OSCL_STATIC_CAST(PV2WayMessagePause* , aMsg)->iTrackId,
- aMsg));
+ OSCL_STATIC_CAST(PV2WayMessagePause* , aMsg)->iDirection,
+ OSCL_STATIC_CAST(PV2WayMessagePause* , aMsg)->iTrackId,
+ aMsg));
break;
case PVT_COMMAND_RESUME:
OSCL_TRY(error, iterminalEngine->Resume(
- OSCL_STATIC_CAST(PV2WayMessagePause* , aMsg)->iDirection,
- OSCL_STATIC_CAST(PV2WayMessagePause* , aMsg)->iTrackId,
- aMsg));
+ OSCL_STATIC_CAST(PV2WayMessagePause* , aMsg)->iDirection,
+ OSCL_STATIC_CAST(PV2WayMessagePause* , aMsg)->iTrackId,
+ aMsg));
break;
case PVT_COMMAND_SET_LOG_APPENDER:
- {
- OSCL_TRY(error, iterminalEngine->SetLogAppender(
- OSCL_STATIC_CAST(PV2WayMessageSetLogAppender*, aMsg)->iTag,
- OSCL_STATIC_CAST(PV2WayMessageSetLogAppender*, aMsg)->iAppender,
- aMsg));
- }
- break;
+ {
+ OSCL_TRY(error, iterminalEngine->SetLogAppender(
+ OSCL_STATIC_CAST(PV2WayMessageSetLogAppender*, aMsg)->iTag,
+ OSCL_STATIC_CAST(PV2WayMessageSetLogAppender*, aMsg)->iAppender,
+ aMsg));
+ }
+ break;
case PVT_COMMAND_REMOVE_LOG_APPENDER:
- {
- OSCL_TRY(error, iterminalEngine->RemoveLogAppender(
- OSCL_STATIC_CAST(PV2WayMessageRemoveLogAppender*, aMsg)->iTag,
- OSCL_STATIC_CAST(PV2WayMessageRemoveLogAppender*, aMsg)->iAppender,
- aMsg));
- }
- break;
+ {
+ OSCL_TRY(error, iterminalEngine->RemoveLogAppender(
+ OSCL_STATIC_CAST(PV2WayMessageRemoveLogAppender*, aMsg)->iTag,
+ OSCL_STATIC_CAST(PV2WayMessageRemoveLogAppender*, aMsg)->iAppender,
+ aMsg));
+ }
+ break;
case PVT_COMMAND_SET_LOG_LEVEL:
OSCL_TRY(error, iterminalEngine->SetLogLevel(
- OSCL_STATIC_CAST(PV2WayMessageSetLogLevel*, aMsg)->iTag,
- OSCL_STATIC_CAST(PV2WayMessageSetLogLevel*, aMsg)->iLevel,
- OSCL_STATIC_CAST(PV2WayMessageSetLogLevel*, aMsg)->iSetSubtree,
- aMsg));
+ OSCL_STATIC_CAST(PV2WayMessageSetLogLevel*, aMsg)->iTag,
+ OSCL_STATIC_CAST(PV2WayMessageSetLogLevel*, aMsg)->iLevel,
+ OSCL_STATIC_CAST(PV2WayMessageSetLogLevel*, aMsg)->iSetSubtree,
+ aMsg));
break;
case PVT_COMMAND_GET_LOG_LEVEL:
OSCL_TRY(error, iterminalEngine->GetLogLevel(
- OSCL_STATIC_CAST(PV2WayMessageGetLogLevel*, aMsg)->iTag,
- OSCL_STATIC_CAST(PV2WayMessageGetLogLevel*, aMsg)->iLogLevel,
- aMsg));
+ OSCL_STATIC_CAST(PV2WayMessageGetLogLevel*, aMsg)->iTag,
+ OSCL_STATIC_CAST(PV2WayMessageGetLogLevel*, aMsg)->iLogLevel,
+ aMsg));
break;
case PVT_COMMAND_QUERY_UUID:
OSCL_TRY(error, iterminalEngine->QueryUUID(
- OSCL_STATIC_CAST(PV2WayMessageQueryUUID*, aMsg)->iMimeType,
- OSCL_STATIC_CAST(PV2WayMessageQueryUUID*, aMsg)->iUuids,
- OSCL_STATIC_CAST(PV2WayMessageQueryUUID*, aMsg)->iExactUuidsOnly,
- aMsg));
+ OSCL_STATIC_CAST(PV2WayMessageQueryUUID*, aMsg)->iMimeType,
+ OSCL_STATIC_CAST(PV2WayMessageQueryUUID*, aMsg)->iUuids,
+ OSCL_STATIC_CAST(PV2WayMessageQueryUUID*, aMsg)->iExactUuidsOnly,
+ aMsg));
break;
case PVT_COMMAND_QUERY_INTERFACE:
OSCL_TRY(error, iterminalEngine->QueryInterface(
- OSCL_STATIC_CAST(PV2WayMessageQueryInterface*, aMsg)->iUuid,
- OSCL_STATIC_CAST(PV2WayMessageQueryInterface*, aMsg)->iInterfacePtr,
- aMsg));
+ OSCL_STATIC_CAST(PV2WayMessageQueryInterface*, aMsg)->iUuid,
+ OSCL_STATIC_CAST(PV2WayMessageQueryInterface*, aMsg)->iInterfacePtr,
+ aMsg));
break;
case PVT_COMMAND_CANCEL_ALL_COMMANDS:
OSCL_TRY(error, iterminalEngine->CancelAllCommands(
- aMsg));
+ aMsg));
break;
}
@@ -859,7 +859,7 @@
//
void CPV2WayProxyAdapter::ProcessNotificationL(CPVCmnInterfaceObserverMessage *aMsg)
-//called in the app thread to notify observer.
+ //called in the app thread to notify observer.
{
int32 err = 0;
@@ -869,49 +869,49 @@
switch (aMsg->GetResponseType())
{
case 0:
- {
- PVCmnCmdRespMsg *resp = (PVCmnCmdRespMsg*)aMsg;
+ {
+ PVCmnCmdRespMsg *resp = (PVCmnCmdRespMsg*)aMsg;
- //Get the command message that prompted this
- //response. The pointer is in the context data.
- CPVCmnInterfaceCmdMessage *cmd = (CPVCmnInterfaceCmdMessage*)resp->GetContext();
+ //Get the command message that prompted this
+ //response. The pointer is in the context data.
+ CPVCmnInterfaceCmdMessage *cmd = (CPVCmnInterfaceCmdMessage*)resp->GetContext();
- //Create a new response with the original command ID and
- //original context data.
- resp->SetId(cmd->GetCommandId());
- resp->SetContextData(cmd->GetContextData());
- OSCL_TRY(err, iCmdStatusObserver->CommandCompleted(*resp));
- //ignore any leave from the observer function.
+ //Create a new response with the original command ID and
+ //original context data.
+ resp->SetId(cmd->GetCommandId());
+ resp->SetContextData(cmd->GetContextData());
+ OSCL_TRY(err, iCmdStatusObserver->CommandCompleted(*resp));
+ //ignore any leave from the observer function.
- //discard command message.
- OSCL_DELETE(cmd);
+ //discard command message.
+ OSCL_DELETE(cmd);
- FreeCmdMsg(resp);
- }
- break;
+ FreeCmdMsg(resp);
+ }
+ break;
case 1:
- {
- PVCmnAsyncEventMsg *event = (PVCmnAsyncEventMsg*) aMsg;
+ {
+ PVCmnAsyncEventMsg *event = (PVCmnAsyncEventMsg*) aMsg;
- OSCL_TRY(err, iInfoEventObserver->HandleInformationalEvent(*event););
- //ignore any leave from the observer function.
+ OSCL_TRY(err, iInfoEventObserver->HandleInformationalEvent(*event););
+ //ignore any leave from the observer function.
- FreeEventMsg((PVCmnAsyncEventMsg *) aMsg);
+ FreeEventMsg((PVCmnAsyncEventMsg *) aMsg);
- }
- break;
+ }
+ break;
case 2:
- {
- PVCmnAsyncErrorEvent *event = (PVCmnAsyncErrorEvent *) aMsg;
+ {
+ PVCmnAsyncErrorEvent *event = (PVCmnAsyncErrorEvent *) aMsg;
- OSCL_TRY(err, iErrorEventObserver->HandleErrorEvent(*event););
- //ignore any leave from the observer function.
+ OSCL_TRY(err, iErrorEventObserver->HandleErrorEvent(*event););
+ //ignore any leave from the observer function.
- FreeErrorMsg((PVCmnAsyncErrorEvent *) aMsg);
- }
- break;
+ FreeErrorMsg((PVCmnAsyncErrorEvent *) aMsg);
+ }
+ break;
default:
PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "CPV2WayProxyAdapter::ProcessNotificationL unknown response (%d)", aMsg->GetResponseType()));
@@ -969,4 +969,3 @@
return NULL;
}
-
diff --git a/engines/common/include/pv_engine_observer_message.h b/engines/common/include/pv_engine_observer_message.h
index 297fdef..0cdf335 100644
--- a/engines/common/include/pv_engine_observer_message.h
+++ b/engines/common/include/pv_engine_observer_message.h
@@ -44,84 +44,85 @@
**/
class PVCmdResponse : public PVMFCmdResp
{
- public:
- /**
- * Constructor for PVCmdResponse
- */
- PVCmdResponse(PVCommandId aId,
- OsclAny* aContext,
- PVMFStatus aStatus,
- // Event data will be deprecated
- OsclAny* aEventData = NULL, int32 aEventDataSize = 0):
- PVMFCmdResp(aId, aContext, aStatus, NULL, aEventData),
- iEventDataSize(aEventDataSize)
- {
- }
+ public:
+ /**
+ * Constructor for PVCmdResponse
+ */
+ PVCmdResponse(PVCommandId aId,
+ OsclAny* aContext,
+ PVMFStatus aStatus,
+ // Event data will be deprecated
+ OsclAny* aEventData = NULL, int32 aEventDataSize = 0):
+ PVMFCmdResp(aId, aContext, aStatus, NULL, aEventData),
+ iEventDataSize(aEventDataSize)
+ {
+ }
- /**
- * Constructor with event extension interface
- */
- PVCmdResponse(PVCommandId aId,
- OsclAny* aContext,
- PVMFStatus aStatus,
- PVInterface* aEventExtInterface = NULL,
- // Event data will be deprecated
- OsclAny* aEventData = NULL, int32 aEventDataSize = 0):
- PVMFCmdResp(aId, aContext, aStatus, aEventExtInterface, aEventData),
- iEventDataSize(aEventDataSize)
- {
- }
+ /**
+ * Constructor with event extension interface
+ */
+ PVCmdResponse(PVCommandId aId,
+ OsclAny* aContext,
+ PVMFStatus aStatus,
+ PVInterface* aEventExtInterface = NULL,
+ // Event data will be deprecated
+ OsclAny* aEventData = NULL, int32 aEventDataSize = 0):
+ PVMFCmdResp(aId, aContext, aStatus, aEventExtInterface, aEventData),
+ iEventDataSize(aEventDataSize)
+ {
+ }
- /**
- * WILL BE DEPRECATED SINCE IT IS NOT BEING USED. CURRENTLY RETURNS 0
- * @return Returns the type of Response we get
- */
- PVResponseType GetResponseType()const
- {
- return 0;
- }
+ /**
+ * WILL BE DEPRECATED SINCE IT IS NOT BEING USED. CURRENTLY RETURNS 0
+ * @return Returns the type of Response we get
+ */
+ PVResponseType GetResponseType()const
+ {
+ return 0;
+ }
- /**
- * @return Returns the unique ID associated with a command of this type.
- */
- PVCommandId GetCmdId()const
- {
- return (PVCommandId)(PVMFCmdResp::GetCmdId());
- }
+ /**
+ * @return Returns the unique ID associated with a command of this type.
+ */
+ PVCommandId GetCmdId()const
+ {
+ return (PVCommandId)(PVMFCmdResp::GetCmdId());
+ }
- /**
- * @return Returns the opaque data that was passed in with the command.
- */
- OsclAny* GetContext()const
- {
- return (OsclAny*)(PVMFCmdResp::GetContext());
- }
+ /**
+ * @return Returns the opaque data that was passed in with the command.
+ */
+ OsclAny* GetContext()const
+ {
+ return (OsclAny*)(PVMFCmdResp::GetContext());
+ }
- /**
- * @return Returns the completion status of the command
- */
- PVMFStatus GetCmdStatus()const
- {
- return PVMFCmdResp::GetCmdStatus();
- }
+ /**
+ * @return Returns the completion status of the command
+ */
+ PVMFStatus GetCmdStatus()const
+ {
+ return PVMFCmdResp::GetCmdStatus();
+ }
- /**
- * WILL BE DEPRECATED WHEN PVMFCmdResp REMOVES EVENT DATA
- * @return Returns additional data asociated with the command. This is to be interpreted
- based on the command issued and the return status
- */
- OsclAny* GetResponseData()const
- {
- return PVMFCmdResp::GetEventData();
- }
+ /**
+ * WILL BE DEPRECATED WHEN PVMFCmdResp REMOVES EVENT DATA
+ * @return Returns additional data asociated with the command.
+ * This is to be interpreted based on the command issued
+ * and the return status
+ */
+ OsclAny* GetResponseData()const
+ {
+ return PVMFCmdResp::GetEventData();
+ }
- int32 GetResponseDataSize()const
- {
- return iEventDataSize;
- }
+ int32 GetResponseDataSize()const
+ {
+ return iEventDataSize;
+ }
- private:
- int32 iEventDataSize;
+ private:
+ int32 iEventDataSize;
};
@@ -133,60 +134,60 @@
**/
class PVAsyncInformationalEvent : public PVMFAsyncEvent
{
- public:
- /**
- * Constructor for PVAsyncInformationalEvent
- */
- PVAsyncInformationalEvent(PVEventType aEventType,
- PVExclusivePtr aEventData = NULL,
- uint8* aLocalBuffer = NULL,
- int32 aLocalBufferSize = 0):
- PVMFAsyncEvent(PVMFInfoEvent, aEventType, NULL, NULL, aEventData, aLocalBuffer, aLocalBufferSize)
- {
- }
+ public:
+ /**
+ * Constructor for PVAsyncInformationalEvent
+ */
+ PVAsyncInformationalEvent(PVEventType aEventType,
+ PVExclusivePtr aEventData = NULL,
+ uint8* aLocalBuffer = NULL,
+ int32 aLocalBufferSize = 0):
+ PVMFAsyncEvent(PVMFInfoEvent, aEventType, NULL, NULL, aEventData, aLocalBuffer, aLocalBufferSize)
+ {
+ }
- /**
- * Constructor with context and event extension interface
- */
- PVAsyncInformationalEvent(PVEventType aEventType,
- OsclAny* aContext,
- PVInterface* aEventExtInterface,
- PVExclusivePtr aEventData = NULL,
- uint8* aLocalBuffer = NULL,
- int32 aLocalBufferSize = 0):
- PVMFAsyncEvent(PVMFInfoEvent, aEventType, aContext, aEventExtInterface, aEventData, aLocalBuffer, aLocalBufferSize)
- {
- }
+ /**
+ * Constructor with context and event extension interface
+ */
+ PVAsyncInformationalEvent(PVEventType aEventType,
+ OsclAny* aContext,
+ PVInterface* aEventExtInterface,
+ PVExclusivePtr aEventData = NULL,
+ uint8* aLocalBuffer = NULL,
+ int32 aLocalBufferSize = 0):
+ PVMFAsyncEvent(PVMFInfoEvent, aEventType, aContext, aEventExtInterface, aEventData, aLocalBuffer, aLocalBufferSize)
+ {
+ }
- /**
- * Destructor
- */
- ~PVAsyncInformationalEvent() {}
+ /**
+ * Destructor
+ */
+ ~PVAsyncInformationalEvent() {}
- /**
- * WILL BE DEPRECATED SINCE IT IS NOT BEING USED. CURRENTLY RETURNING 0.
- * @return Returns the type of Response we get
- */
- PVResponseType GetResponseType()const
- {
- return 0;
- }
+ /**
+ * WILL BE DEPRECATED SINCE IT IS NOT BEING USED. CURRENTLY RETURNING 0.
+ * @return Returns the type of Response we get
+ */
+ PVResponseType GetResponseType()const
+ {
+ return 0;
+ }
- /**
- * @return Returns the Event type that has been received
- */
- PVEventType GetEventType()const
- {
- return PVMFAsyncEvent::GetEventType();
- }
+ /**
+ * @return Returns the Event type that has been received
+ */
+ PVEventType GetEventType()const
+ {
+ return PVMFAsyncEvent::GetEventType();
+ }
- /**
- * @return Returns the opaque data asociated with the event.
- */
- void GetEventData(PVExclusivePtr& aPtr)const
- {
- aPtr = PVMFAsyncEvent::GetEventData();
- }
+ /**
+ * @return Returns the opaque data asociated with the event.
+ */
+ void GetEventData(PVExclusivePtr& aPtr)const
+ {
+ aPtr = PVMFAsyncEvent::GetEventData();
+ }
};
/**
@@ -197,60 +198,60 @@
**/
class PVAsyncErrorEvent : public PVMFAsyncEvent
{
- public:
- /**
- * Constructor for PVAsyncErrorEvent
- */
- PVAsyncErrorEvent(PVEventType aEventType,
- PVExclusivePtr aEventData = NULL,
- uint8* aLocalBuffer = NULL,
- int32 aLocalBufferSize = 0):
- PVMFAsyncEvent(PVMFErrorEvent, aEventType, NULL, NULL, aEventData, aLocalBuffer, aLocalBufferSize)
- {
- }
+ public:
+ /**
+ * Constructor for PVAsyncErrorEvent
+ */
+ PVAsyncErrorEvent(PVEventType aEventType,
+ PVExclusivePtr aEventData = NULL,
+ uint8* aLocalBuffer = NULL,
+ int32 aLocalBufferSize = 0) :
+ PVMFAsyncEvent(PVMFErrorEvent, aEventType, NULL, NULL, aEventData, aLocalBuffer, aLocalBufferSize)
+ {
+ }
- /**
- * Constructor with context and event extension interface
- */
- PVAsyncErrorEvent(PVEventType aEventType,
- OsclAny* aContext,
- PVInterface* aEventExtInterface,
- PVExclusivePtr aEventData = NULL,
- uint8* aLocalBuffer = NULL,
- int32 aLocalBufferSize = 0):
- PVMFAsyncEvent(PVMFErrorEvent, aEventType, aContext, aEventExtInterface, aEventData, aLocalBuffer, aLocalBufferSize)
- {
- }
+ /**
+ * Constructor with context and event extension interface
+ */
+ PVAsyncErrorEvent(PVEventType aEventType,
+ OsclAny* aContext,
+ PVInterface* aEventExtInterface,
+ PVExclusivePtr aEventData = NULL,
+ uint8* aLocalBuffer = NULL,
+ int32 aLocalBufferSize = 0) :
+ PVMFAsyncEvent(PVMFErrorEvent, aEventType, aContext, aEventExtInterface, aEventData, aLocalBuffer, aLocalBufferSize)
+ {
+ }
- /**
- * Destructor
- */
- ~PVAsyncErrorEvent() {}
+ /**
+ * Destructor
+ */
+ ~PVAsyncErrorEvent() {}
- /**
- * WILL BE DEPRECATED SINCE IT IS NOT BEING USED. CURRENTLY RETURNING 0.
- * @return Returns the type of Response we get
- */
- PVResponseType GetResponseType()const
- {
- return 0;
- }
+ /**
+ * WILL BE DEPRECATED SINCE IT IS NOT BEING USED. CURRENTLY RETURNING 0.
+ * @return Returns the type of Response we get
+ */
+ PVResponseType GetResponseType()const
+ {
+ return 0;
+ }
- /**
- * @return Returns the Event type that has been received
- */
- PVEventType GetEventType()const
- {
- return PVMFAsyncEvent::GetEventType();
- }
+ /**
+ * @return Returns the Event type that has been received
+ */
+ PVEventType GetEventType()const
+ {
+ return PVMFAsyncEvent::GetEventType();
+ }
- /**
- * @return Returns the opaque data asociated with the event.
- */
- void GetEventData(PVExclusivePtr& aPtr)const
- {
- aPtr = PVMFAsyncEvent::GetEventData();
- }
+ /**
+ * @return Returns the opaque data asociated with the event.
+ */
+ void GetEventData(PVExclusivePtr& aPtr)const
+ {
+ aPtr = PVMFAsyncEvent::GetEventData();
+ }
};
diff --git a/nodes/pvomxencnode/src/pvmf_omx_enc_node.cpp b/nodes/pvomxencnode/src/pvmf_omx_enc_node.cpp
index 26b0af3..7e55cc5 100644
--- a/nodes/pvomxencnode/src/pvmf_omx_enc_node.cpp
+++ b/nodes/pvomxencnode/src/pvmf_omx_enc_node.cpp
@@ -33,19 +33,19 @@
#include "pvmf_omx_enc_callbacks.h" //used for thin AO in encoder's callbacks
#include "pv_omxcore.h"
-#define CONFIG_SIZE_AND_VERSION(param) \
- param.nSize=sizeof(param); \
- param.nVersion.s.nVersionMajor = SPECVERSIONMAJOR; \
- param.nVersion.s.nVersionMinor = SPECVERSIONMINOR; \
- param.nVersion.s.nRevision = SPECREVISION; \
- param.nVersion.s.nStep = SPECSTEP;
+#define CONFIG_SIZE_AND_VERSION(param) \
+ param.nSize=sizeof(param); \
+ param.nVersion.s.nVersionMajor = SPECVERSIONMAJOR; \
+ param.nVersion.s.nVersionMinor = SPECVERSIONMINOR; \
+ param.nVersion.s.nRevision = SPECREVISION; \
+ param.nVersion.s.nStep = SPECSTEP;
-#define CHECK_OMX_ERR_AND_RETURN(Err, str) \
- if (Err != OMX_ErrorNone) \
- { \
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, str)); \
- }
+#define CHECK_OMX_ERR_AND_RETURN(Err, str) \
+ if (Err != OMX_ErrorNone) \
+ { \
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, str)); \
+ }
#define PVOMXENC_EXTRA_YUVBUFFER_POOLNUM 3
@@ -57,7 +57,7 @@
const uint8 DEFAULT_VOL_HEADER[DEFAULT_VOL_HEADER_LENGTH] =
{
0x00, 0x00, 0x01, 0xB0, 0x08, 0x00, 0x00, 0x01,
- 0xB5, 0x09, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0xB5, 0x09, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x01, 0x20, 0x00, 0x84, 0x40, 0xFA, 0x28, 0x2C,
0x20, 0x90, 0xA2, 0x1F
};
@@ -94,19 +94,19 @@
// OMX CALLBACKS
// 1) AO OMX component running in the same thread as the OMX node
-// In this case, the callbacks can be called directly from the component
-// The callback: OMX Component->CallbackEventHandler->EventHandlerProcessing
-// The callback can perform do RunIfNotReady
+// In this case, the callbacks can be called directly from the component
+// The callback: OMX Component->CallbackEventHandler->EventHandlerProcessing
+// The callback can perform do RunIfNotReady
// 2) Multithreaded component
-// In this case, the callback is made using the threadsafe callback (TSCB) AO
-// Component thread : OMX Component->CallbackEventHandler->TSCB(ReceiveEvent) => event is queued
-// Node thread : dequeue event => TSCB(ProcessEvent)->ProcessCallbackEventHandler->EventHandlerProcessing
+// In this case, the callback is made using the threadsafe callback (TSCB) AO
+// Component thread : OMX Component->CallbackEventHandler->TSCB(ReceiveEvent) => event is queued
+// Node thread : dequeue event => TSCB(ProcessEvent)->ProcessCallbackEventHandler->EventHandlerProcessing
// callback for Event Handler - in multithreaded case, event is queued to be processed later
-// in AO case, event is processed immediately by calling EventHandlerProcessing
+// in AO case, event is processed immediately by calling EventHandlerProcessing
OMX_ERRORTYPE CallbackEventHandlerEnc(OMX_OUT OMX_HANDLETYPE aComponent,
OMX_OUT OMX_PTR aAppData,
OMX_OUT OMX_EVENTTYPE aEvent,
@@ -152,10 +152,10 @@
// callback for EmptyBufferDone - in multithreaded case, event is queued to be processed later
-// in AO case, event is processed immediately by calling EmptyBufferDoneProcessing
+// in AO case, event is processed immediately by calling EmptyBufferDoneProcessing
OMX_ERRORTYPE CallbackEmptyBufferDoneEnc(OMX_OUT OMX_HANDLETYPE aComponent,
- OMX_OUT OMX_PTR aAppData,
- OMX_OUT OMX_BUFFERHEADERTYPE* aBuffer)
+ OMX_OUT OMX_PTR aAppData,
+ OMX_OUT OMX_BUFFERHEADERTYPE* aBuffer)
{
PVMFOMXEncNode *Node = (PVMFOMXEncNode *) aAppData;
@@ -189,7 +189,7 @@
}
// callback for FillBufferDone - in multithreaded case, event is queued to be processed later
-// in AO case, event is processed immediately by calling FillBufferDoneProcessing
+// in AO case, event is processed immediately by calling FillBufferDoneProcessing
OMX_ERRORTYPE CallbackFillBufferDoneEnc(OMX_OUT OMX_HANDLETYPE aComponent,
OMX_OUT OMX_PTR aAppData,
OMX_OUT OMX_BUFFERHEADERTYPE* aBuffer)
@@ -399,10 +399,10 @@
SetState(EPVMFNodeIdle);
return PVMFSuccess;
- // break; This break statement was removed to avoid compiler warning for Unreachable Code
+ // break; This break statement was removed to avoid compiler warning for Unreachable Code
default:
return PVMFErrInvalidState;
- // break; This break statement was removed to avoid compiler warning for Unreachable Code
+ // break; This break statement was removed to avoid compiler warning for Unreachable Code
}
}
@@ -424,11 +424,11 @@
iLogger = NULL;
SetState(EPVMFNodeCreated);
return PVMFSuccess;
- // break; This break statement was removed to avoid compiler warning for Unreachable Code
+ // break; This break statement was removed to avoid compiler warning for Unreachable Code
default:
return PVMFErrInvalidState;
- // break; This break statement was removed to avoid compiler warning for Unreachable Code
+ // break; This break statement was removed to avoid compiler warning for Unreachable Code
}
}
@@ -480,8 +480,8 @@
/////////////////////////////////////////////////////////////////////////////
PVMFCommandId PVMFOMXEncNode::QueryInterface(PVMFSessionId s, const PVUuid& aUuid,
- PVInterface*& aInterfacePtr,
- const OsclAny* aContext)
+ PVInterface*& aInterfacePtr,
+ const OsclAny* aContext)
{
PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "PVMFOMXEncNode-%s::QueryInterface() called", iNodeTypeId));
PVMFOMXEncNodeCommand cmd;
@@ -603,36 +603,36 @@
// Class Constructor
/////////////////////////////////////////////////////////////////////////////
PVMFOMXEncNode::PVMFOMXEncNode(int32 aPriority) :
- OsclActiveObject(aPriority, "PVMFOMXEncNode"),
- iInPort(NULL),
- iOutPort(NULL),
- iOutBufMemoryPool(NULL),
- iMediaDataMemPool(NULL),
- iOMXComponentOutputBufferSize(0),
- iOutputAllocSize(0),
- iProcessingState(EPVMFOMXEncNodeProcessingState_Idle),
- iOMXEncoder(NULL),
- iSendBOS(false),
- iStreamID(0),
- iBOSTimestamp(0),
- iSeqNum(0),
- iSeqNum_In(0),
- iIsAdded(true),
- iLogger(NULL),
- iDataPathLogger(NULL),
- iClockLogger(NULL),
- iExtensionRefCount(0),
- iEndOfDataReached(false),
- iEndOfDataTimestamp(0),
- iDiagnosticsLogger(NULL),
- iDiagnosticsLogged(false),
- iAvgBitrateValue(0),
- iResetInProgress(false),
- iResetMsgSent(false),
- iStopInResetMsgSent(false),
- iNumOutstandingOutputBuffers(0),
- iNumOutstandingInputBuffers(0)
- ,bIsQCOMOmxComp(false)
+ OsclActiveObject(aPriority, "PVMFOMXEncNode"),
+ iInPort(NULL),
+ iOutPort(NULL),
+ iOutBufMemoryPool(NULL),
+ iMediaDataMemPool(NULL),
+ iOMXComponentOutputBufferSize(0),
+ iOutputAllocSize(0),
+ iProcessingState(EPVMFOMXEncNodeProcessingState_Idle),
+ iOMXEncoder(NULL),
+ iSendBOS(false),
+ iStreamID(0),
+ iBOSTimestamp(0),
+ iSeqNum(0),
+ iSeqNum_In(0),
+ iIsAdded(true),
+ iLogger(NULL),
+ iDataPathLogger(NULL),
+ iClockLogger(NULL),
+ iExtensionRefCount(0),
+ iEndOfDataReached(false),
+ iEndOfDataTimestamp(0),
+ iDiagnosticsLogger(NULL),
+ iDiagnosticsLogged(false),
+ iAvgBitrateValue(0),
+ iResetInProgress(false),
+ iResetMsgSent(false),
+ iStopInResetMsgSent(false),
+ iNumOutstandingOutputBuffers(0),
+ iNumOutstandingInputBuffers(0)
+ ,bIsQCOMOmxComp(false)
{
iInterfaceState = EPVMFNodeCreated;
@@ -697,23 +697,23 @@
// for VOL header
memBufferVOLHeader = (uint8*)iAlloc.allocate(VolHdrSize);
if (!memBufferVOLHeader)
-{
- OSCL_LEAVE(PVMFErrNoMemory);
- }
+ {
+ OSCL_LEAVE(PVMFErrNoMemory);
+ }
- memBufferParamSet = (uint8*) iAlloc.allocate(ParamSetSize);
- if (!memBufferParamSet)
-{
- OSCL_LEAVE(PVMFErrNoMemory);
- }
+ memBufferParamSet = (uint8*) iAlloc.allocate(ParamSetSize);
+ if (!memBufferParamSet)
+ {
+ OSCL_LEAVE(PVMFErrNoMemory);
+ }
- );
+ );
// Save default VOL header
oscl_memset(memBufferVOLHeader, 0, DEFAULT_VOL_HEADER_LENGTH);
OsclMemoryFragment volHeader;
OsclRefCounter* refCounterVOLHeader = new(memBufferVOLHeader) OsclRefCounterDA(memBufferVOLHeader,
- (OsclDestructDealloc*)&iAlloc);
+ (OsclDestructDealloc*)&iAlloc);
memBufferVOLHeader += refCounterSize;
volHeader.ptr = memBufferVOLHeader;
oscl_memcpy(volHeader.ptr, (OsclAny*)DEFAULT_VOL_HEADER, DEFAULT_VOL_HEADER_LENGTH);
@@ -725,7 +725,7 @@
oscl_memset(memBufferParamSet, 0, DEFAULT_PARAMS_SET_LENGTH);
OsclMemoryFragment paramSet;
OsclRefCounter* refCounterParamSet = new(memBufferParamSet) OsclRefCounterDA(memBufferParamSet,
- (OsclDestructDealloc*)&iAlloc);
+ (OsclDestructDealloc*)&iAlloc);
memBufferParamSet += refCounterSize;
paramSet.ptr = memBufferParamSet;
paramSet.len = DEFAULT_PARAMS_SET_LENGTH;
@@ -883,10 +883,10 @@
// if reset is in progress, call DoReset again until Reset Msg is sent
if ((iResetInProgress == true) &&
- (iResetMsgSent == false) &&
- (iCurrentCommand.size() > 0) &&
- (iCurrentCommand.front().iCmd == PVMFOMXEncNodeCommand::PVOMXENC_NODE_CMD_RESET)
- )
+ (iResetMsgSent == false) &&
+ (iCurrentCommand.size() > 0) &&
+ (iCurrentCommand.front().iCmd == PVMFOMXEncNodeCommand::PVOMXENC_NODE_CMD_RESET)
+ )
{
DoReset(iCurrentCommand.front());
PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "PVMFOMXEncNode-%s::Run() - Calling DoReset", iNodeTypeId));
@@ -898,8 +898,8 @@
if (ProcessCommand(iInputCommands.front()))
{
if (iInterfaceState != EPVMFNodeCreated
- && (!iInputCommands.empty() || (iInPort && (iInPort->IncomingMsgQueueSize() > 0)) ||
- (iDataIn.GetRep() != NULL)))
+ && (!iInputCommands.empty() || (iInPort && (iInPort->IncomingMsgQueueSize() > 0)) ||
+ (iDataIn.GetRep() != NULL)))
{
PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "PVMFOMXEncNode-%s::Run() - rescheduling after process command", iNodeTypeId));
RunIfNotReady();
@@ -919,7 +919,7 @@
}
if (((iCurrentCommand.size() == 0) && (iInterfaceState != EPVMFNodeStarted)) ||
- ((iCurrentCommand.size() > 0) && (iCurrentCommand.front().iCmd == PVMFOMXEncNodeCommand::PVOMXENC_NODE_CMD_START) && (iInterfaceState != EPVMFNodeStarted)))
+ ((iCurrentCommand.size() > 0) && (iCurrentCommand.front().iCmd == PVMFOMXEncNodeCommand::PVOMXENC_NODE_CMD_START) && (iInterfaceState != EPVMFNodeStarted)))
{
// rescheduling because of input data will be handled in Command Processing Part
PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "PVMFOMXEncNode-%s::Run() - Node not in Started state yet", iNodeTypeId));
@@ -968,11 +968,11 @@
// If in init or ready to encode state, process data in the input port if there is input available and input buffers are present
// (note: at EOS, iDataIn will not be available)
if ((iDataIn.GetRep() != NULL) ||
- ((iNumOutstandingOutputBuffers < iNumOutputBuffers) &&
- (iProcessingState == EPVMFOMXEncNodeProcessingState_ReadyToEncode) &&
- (iResetMsgSent == false)) ||
- ((iDynamicReconfigInProgress == true) && (iResetMsgSent == false))
- )
+ ((iNumOutstandingOutputBuffers < iNumOutputBuffers) &&
+ (iProcessingState == EPVMFOMXEncNodeProcessingState_ReadyToEncode) &&
+ (iResetMsgSent == false)) ||
+ ((iDynamicReconfigInProgress == true) && (iResetMsgSent == false))
+ )
{
PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG,
(0, "PVMFOMXEncNode-%s::Run() - Calling HandleProcessingState", iNodeTypeId));
@@ -990,10 +990,10 @@
loopCount++;
}
while (iInPort &&
- (((iInPort->IncomingMsgQueueSize() > 0) || (iDataIn.GetRep() != NULL)) && (iNumOutstandingInputBuffers < iNumInputBuffers))
- && (!iEndOfDataReached)
- && (iResetMsgSent == false)
- );
+ (((iInPort->IncomingMsgQueueSize() > 0) || (iDataIn.GetRep() != NULL)) && (iNumOutstandingInputBuffers < iNumInputBuffers))
+ && (!iEndOfDataReached)
+ && (iResetMsgSent == false)
+ );
#if (PVLOGGER_INST_LEVEL >= PVLOGMSG_INST_REL)
uint32 endticks = OsclTickCount::TickCount();
uint32 endtime = OsclTickCount::TicksToMsec(endticks);
@@ -1077,7 +1077,7 @@
else
{
// keep sending output buffers, it's possible that the component needs to flush output
- // data at the end
+ // data at the end
while (iNumOutstandingOutputBuffers < iNumOutputBuffers)
{
if (!SendOutputBufferToOMXComponent())
@@ -1090,13 +1090,13 @@
//Check for flash command complition...
if (iInPort && iOutPort && (iCurrentCommand.size() > 0) &&
- (iCurrentCommand.front().iCmd == PVMFOMXEncNodeCommand::PVOMXENC_NODE_CMD_FLUSH) &&
- (iInPort->IncomingMsgQueueSize() == 0) &&
- (iOutPort->OutgoingMsgQueueSize() == 0) &&
- (iDataIn.GetRep() == NULL) &&
- (iNumOutstandingOutputBuffers == iNumOutputBuffers) && // all output buffers are with the component or outstanding
- (iNumOutstandingInputBuffers == 0) // all input buffers were processed and returned. These 2 conditions mean the component is idle
- )
+ (iCurrentCommand.front().iCmd == PVMFOMXEncNodeCommand::PVOMXENC_NODE_CMD_FLUSH) &&
+ (iInPort->IncomingMsgQueueSize() == 0) &&
+ (iOutPort->OutgoingMsgQueueSize() == 0) &&
+ (iDataIn.GetRep() == NULL) &&
+ (iNumOutstandingOutputBuffers == iNumOutputBuffers) && // all output buffers are with the component or outstanding
+ (iNumOutstandingInputBuffers == 0) // all input buffers were processed and returned. These 2 conditions mean the component is idle
+ )
{
//flush command is almost completed
//Debug check-- all the port queues should be empty at this point.
@@ -1158,7 +1158,7 @@
// prevent the node from sending more buffers etc.
// if port reconfiguration is in process, let the state remain one of the port config states
- // if there is a start command, we can do it seemlessly (by continuing the port reconfig)
+ // if there is a start command, we can do it seemlessly (by continuing the port reconfig)
if (iProcessingState == EPVMFOMXEncNodeProcessingState_ReadyToEncode)
iProcessingState = EPVMFOMXEncNodeProcessingState_Stopping;
@@ -1246,18 +1246,18 @@
break;
case PVMFOMXEncNodeCommand::PVOMXENC_NODE_CMD_GETNODEMETADATAKEY:
- {
- PVMFStatus retval = DoGetNodeMetadataKey(aCmd);
- CommandComplete(iInputCommands, aCmd, retval);
- }
- break;
+ {
+ PVMFStatus retval = DoGetNodeMetadataKey(aCmd);
+ CommandComplete(iInputCommands, aCmd, retval);
+ }
+ break;
case PVMFOMXEncNodeCommand::PVOMXENC_NODE_CMD_GETNODEMETADATAVALUE:
- {
- PVMFStatus retval = DoGetNodeMetadataValue(aCmd);
- CommandComplete(iInputCommands, aCmd, retval);
- }
- break;
+ {
+ PVMFStatus retval = DoGetNodeMetadataValue(aCmd);
+ CommandComplete(iInputCommands, aCmd, retval);
+ }
+ break;
default://unknown command type
CommandComplete(iInputCommands, aCmd, PVMFFailure);
@@ -1282,120 +1282,120 @@
PVMFStatus status = PVMFFailure;
-//#define SIMULATE_BOS
+ //#define SIMULATE_BOS
#ifdef SIMULATE_BOS
if (((PVMFOMXEncPort*)aPort)->iNumFramesConsumed == 6))
- {
+{
- PVMFSharedMediaCmdPtr BOSCmdPtr = PVMFMediaCmd::createMediaCmd();
+ PVMFSharedMediaCmdPtr BOSCmdPtr = PVMFMediaCmd::createMediaCmd();
- // Set the format ID to BOS
- BOSCmdPtr->setFormatID(PVMF_MEDIA_CMD_BOS_FORMAT_ID);
+ // Set the format ID to BOS
+ BOSCmdPtr->setFormatID(PVMF_MEDIA_CMD_BOS_FORMAT_ID);
- // Set the timestamp
- BOSCmdPtr->setTimestamp(201);
- BOSCmdPtr->setStreamID(0);
+ // Set the timestamp
+ BOSCmdPtr->setTimestamp(201);
+ BOSCmdPtr->setStreamID(0);
- // Convert to media message and send it out
- PVMFSharedMediaMsgPtr mediaMsgOut;
- convertToPVMFMediaCmdMsg(mediaMsgOut, BOSCmdPtr);
+ // Convert to media message and send it out
+ PVMFSharedMediaMsgPtr mediaMsgOut;
+ convertToPVMFMediaCmdMsg(mediaMsgOut, BOSCmdPtr);
- //store the stream id and time stamp of bos message
- iStreamID = mediaMsgOut->getStreamID();
- iBOSTimestamp = mediaMsgOut->getTimestamp();
- iSendBOS = true;
+ //store the stream id and time stamp of bos message
+ iStreamID = mediaMsgOut->getStreamID();
+ iBOSTimestamp = mediaMsgOut->getTimestamp();
+ iSendBOS = true;
#ifdef _DEBUG
- printf("PVMFOMXEncNode-%s::ProcessIncomingMsg() SIMULATED BOS\n", iNodeTypeId);
+ printf("PVMFOMXEncNode-%s::ProcessIncomingMsg() SIMULATED BOS\n", iNodeTypeId);
#endif
- ((PVMFOMXEncPort*)aPort)->iNumFramesConsumed++;
- return true;
+ ((PVMFOMXEncPort*)aPort)->iNumFramesConsumed++;
+ return true;
- }
+}
#endif
//#define SIMULATE_PREMATURE_EOS
#ifdef SIMULATE_PREMATURE_EOS
- if (((PVMFOMXEncPort*)aPort)->iNumFramesConsumed == 5)
- {
- PVMFSharedMediaCmdPtr EOSCmdPtr = PVMFMediaCmd::createMediaCmd();
+if (((PVMFOMXEncPort*)aPort)->iNumFramesConsumed == 5)
+{
+ PVMFSharedMediaCmdPtr EOSCmdPtr = PVMFMediaCmd::createMediaCmd();
- // Set the format ID to EOS
- EOSCmdPtr->setFormatID(PVMF_MEDIA_CMD_EOS_FORMAT_ID);
+ // Set the format ID to EOS
+ EOSCmdPtr->setFormatID(PVMF_MEDIA_CMD_EOS_FORMAT_ID);
- // Set the timestamp
- EOSCmdPtr->setTimestamp(200);
+ // Set the timestamp
+ EOSCmdPtr->setTimestamp(200);
- // Convert to media message and send it out
- PVMFSharedMediaMsgPtr mediaMsgOut;
- convertToPVMFMediaCmdMsg(mediaMsgOut, EOSCmdPtr);
+ // Convert to media message and send it out
+ PVMFSharedMediaMsgPtr mediaMsgOut;
+ convertToPVMFMediaCmdMsg(mediaMsgOut, EOSCmdPtr);
- ((PVMFOMXEncPort*)aPort)->iNumFramesConsumed++;
+ ((PVMFOMXEncPort*)aPort)->iNumFramesConsumed++;
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "PVMFOMXEncNode-%s::ProcessIncomingMsg: SIMULATED EOS", iNodeTypeId));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
+ (0, "PVMFOMXEncNode-%s::ProcessIncomingMsg: SIMULATED EOS", iNodeTypeId));
#ifdef _DEBUG
- printf("PVMFOMXEncNode-%s::ProcessIncomingMsg() SIMULATED EOS\n", iNodeTypeId);
+ printf("PVMFOMXEncNode-%s::ProcessIncomingMsg() SIMULATED EOS\n", iNodeTypeId);
#endif
- // Set EOS flag
- iEndOfDataReached = true;
- // Save the timestamp for the EOS cmd
- iEndOfDataTimestamp = mediaMsgOut->getTimestamp();
+ // Set EOS flag
+ iEndOfDataReached = true;
+ // Save the timestamp for the EOS cmd
+ iEndOfDataTimestamp = mediaMsgOut->getTimestamp();
- return true;
- }
+ return true;
+}
#endif
- PVMFSharedMediaMsgPtr msg;
+PVMFSharedMediaMsgPtr msg;
- status = aPort->DequeueIncomingMsg(msg);
- if (status != PVMFSuccess)
+status = aPort->DequeueIncomingMsg(msg);
+if (status != PVMFSuccess)
{
PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_ERR,
(0, "0x%x PVMFOMXEncNode-%s::ProcessIncomingMsg: Error - DequeueIncomingMsg failed", this, iNodeTypeId));
- return false;
- }
+ return false;
+}
- if (msg->getFormatID() == PVMF_MEDIA_CMD_BOS_FORMAT_ID)
- {
- //store the stream id and time stamp of bos message
- iStreamID = msg->getStreamID();
- iBOSTimestamp = msg->getTimestamp();
- iSendBOS = true;
+if (msg->getFormatID() == PVMF_MEDIA_CMD_BOS_FORMAT_ID)
+{
+ //store the stream id and time stamp of bos message
+ iStreamID = msg->getStreamID();
+ iBOSTimestamp = msg->getTimestamp();
+ iSendBOS = true;
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "PVMFOMXEncNode-%s::ProcessIncomingMsg: Received BOS stream %d, timestamp %d", iNodeTypeId, iStreamID, iBOSTimestamp));
- ((PVMFOMXEncPort*)aPort)->iNumFramesConsumed++;
- return true;
- }
- else if (msg->getFormatID() == PVMF_MEDIA_CMD_EOS_FORMAT_ID)
- {
- // Set EOS flag
- iEndOfDataReached = true;
- // Save the timestamp for the EOS cmd
- iEndOfDataTimestamp = msg->getTimestamp();
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
+ (0, "PVMFOMXEncNode-%s::ProcessIncomingMsg: Received BOS stream %d, timestamp %d", iNodeTypeId, iStreamID, iBOSTimestamp));
+ ((PVMFOMXEncPort*)aPort)->iNumFramesConsumed++;
+ return true;
+}
+else if (msg->getFormatID() == PVMF_MEDIA_CMD_EOS_FORMAT_ID)
+{
+ // Set EOS flag
+ iEndOfDataReached = true;
+ // Save the timestamp for the EOS cmd
+ iEndOfDataTimestamp = msg->getTimestamp();
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "PVMFOMXEncNode-%s::ProcessIncomingMsg: Received EOS", iNodeTypeId));
-
- ((PVMFOMXEncPort*)aPort)->iNumFramesConsumed++;
- return true; // do not do conversion into media data, just set the flag and leave
- }
-
- convertToPVMFMediaData(iDataIn, msg);
-
-
- iCurrFragNum = 0; // for new message, reset the fragment counter
-
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
+ (0, "PVMFOMXEncNode-%s::ProcessIncomingMsg: Received EOS", iNodeTypeId));
((PVMFOMXEncPort*)aPort)->iNumFramesConsumed++;
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "PVMFOMXEncNode-%s::ProcessIncomingMsg() Received %d frames", iNodeTypeId, ((PVMFOMXEncPort*)aPort)->iNumFramesConsumed));
+ return true; // do not do conversion into media data, just set the flag and leave
+}
- //return true if we processed an activity...
- return true;
+convertToPVMFMediaData(iDataIn, msg);
+
+
+iCurrFragNum = 0; // for new message, reset the fragment counter
+
+
+((PVMFOMXEncPort*)aPort)->iNumFramesConsumed++;
+PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "PVMFOMXEncNode-%s::ProcessIncomingMsg() Received %d frames", iNodeTypeId, ((PVMFOMXEncPort*)aPort)->iNumFramesConsumed));
+
+//return true if we processed an activity...
+return true;
}
/////////////////////////////////////////////////////////////////////////////
@@ -1421,8 +1421,8 @@
//(the InvalidState error happens when port input is suspended,
//so don't report it.)
if (status != PVMFErrBusy
- && status != PVMFSuccess
- && status != PVMFErrInvalidState)
+ && status != PVMFSuccess
+ && status != PVMFErrInvalidState)
{
PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_ERR,
(0, "0x%x PVMFOMXEncNode-%s::ProcessOutgoingMsg: Error - ProcessPortActivity failed. port=0x%x, type=%d",
@@ -1446,347 +1446,347 @@
switch (iProcessingState)
{
- // The FOLLOWING 4 states handle Dynamic Port Reconfiguration
+ // The FOLLOWING 4 states handle Dynamic Port Reconfiguration
case EPVMFOMXEncNodeProcessingState_PortReconfig:
- {
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "PVMFOMXEncNode-%s::HandleProcessingState() Port Reconfiguration -> Sending Port Disable Command", iNodeTypeId));
-
- // port reconfiguration is required. Only one port at a time is disabled and then re-enabled after buffer resizing
- OMX_SendCommand(iOMXEncoder, OMX_CommandPortDisable, iPortIndexForDynamicReconfig, NULL);
- // the port will now start returning outstanding buffers
- // set the flag to prevent output from going downstream (in case of output port being reconfigd)
- // set the flag to prevent input from being saved and returned to component (in case of input port being reconfigd)
- // set the state to wait for port saying it is disabled
- if (iPortIndexForDynamicReconfig == iOutputPortIndex)
{
- iDoNotSendOutputBuffersDownstreamFlag = true;
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
+ (0, "PVMFOMXEncNode-%s::HandleProcessingState() Port Reconfiguration -> Sending Port Disable Command", iNodeTypeId));
+
+ // port reconfiguration is required. Only one port at a time is disabled and then re-enabled after buffer resizing
+ OMX_SendCommand(iOMXEncoder, OMX_CommandPortDisable, iPortIndexForDynamicReconfig, NULL);
+ // the port will now start returning outstanding buffers
+ // set the flag to prevent output from going downstream (in case of output port being reconfigd)
+ // set the flag to prevent input from being saved and returned to component (in case of input port being reconfigd)
+ // set the state to wait for port saying it is disabled
+ if (iPortIndexForDynamicReconfig == iOutputPortIndex)
+ {
+ iDoNotSendOutputBuffersDownstreamFlag = true;
+ }
+ else if (iPortIndexForDynamicReconfig == iInputPortIndex)
+ {
+ iDoNotSaveInputBuffersFlag = true;
+
+ }
+ iProcessingState = EPVMFOMXEncNodeProcessingState_WaitForBufferReturn;
+
+
+ // fall through to the next case to check if all buffers are already back
}
- else if (iPortIndexForDynamicReconfig == iInputPortIndex)
- {
- iDoNotSaveInputBuffersFlag = true;
-
- }
- iProcessingState = EPVMFOMXEncNodeProcessingState_WaitForBufferReturn;
-
-
- // fall through to the next case to check if all buffers are already back
- }
case EPVMFOMXEncNodeProcessingState_WaitForBufferReturn:
- {
- // as buffers are coming back, Run may be called, wait until all buffers are back, then Free them all
-
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "PVMFOMXEncNode-%s::HandleProcessingState() Port Reconfiguration -> WaitForBufferReturn ", iNodeTypeId));
- // check if it's output port being reconfigured
- if (iPortIndexForDynamicReconfig == iOutputPortIndex)
{
- // if all buffers have returned, free them
- if (iNumOutstandingOutputBuffers == 0)
+ // as buffers are coming back, Run may be called, wait until all buffers are back, then Free them all
+
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
+ (0, "PVMFOMXEncNode-%s::HandleProcessingState() Port Reconfiguration -> WaitForBufferReturn ", iNodeTypeId));
+ // check if it's output port being reconfigured
+ if (iPortIndexForDynamicReconfig == iOutputPortIndex)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "PVMFOMXEncNode-%s::HandleProcessingState() Port Reconfiguration -> all output buffers are back, free them", iNodeTypeId));
- if (false == iOutputBuffersFreed)
+ // if all buffers have returned, free them
+ if (iNumOutstandingOutputBuffers == 0)
{
- if (!FreeBuffersFromComponent(iOutBufMemoryPool, // allocator
- iOutputAllocSize, // size to allocate from pool (hdr only or hdr+ buffer)
- iNumOutputBuffers, // number of buffers
- iOutputPortIndex, // port idx
- false // this is not input
- ))
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
+ (0, "PVMFOMXEncNode-%s::HandleProcessingState() Port Reconfiguration -> all output buffers are back, free them", iNodeTypeId));
+ if (false == iOutputBuffersFreed)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
- (0, "PVMFOMXEncNode-%s::HandleProcessingState() Port Reconfiguration -> Cannot free output buffers ", iNodeTypeId));
+ if (!FreeBuffersFromComponent(iOutBufMemoryPool, // allocator
+ iOutputAllocSize, // size to allocate from pool (hdr only or hdr+ buffer)
+ iNumOutputBuffers, // number of buffers
+ iOutputPortIndex, // port idx
+ false // this is not input
+ ))
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
+ (0, "PVMFOMXEncNode-%s::HandleProcessingState() Port Reconfiguration -> Cannot free output buffers ", iNodeTypeId));
- SetState(EPVMFNodeError);
- ReportErrorEvent(PVMFErrNoMemory);
- return PVMFErrNoMemory;
+ SetState(EPVMFNodeError);
+ ReportErrorEvent(PVMFErrNoMemory);
+ return PVMFErrNoMemory;
+ }
}
- }
- // if the callback (that port is disabled) has not arrived yet, wait for it
- // if it has arrived, it will set the state to PortReEnable
- if (iProcessingState != EPVMFOMXEncNodeProcessingState_PortReEnable)
- iProcessingState = EPVMFOMXEncNodeProcessingState_WaitForPortDisable;
+ // if the callback (that port is disabled) has not arrived yet, wait for it
+ // if it has arrived, it will set the state to PortReEnable
+ if (iProcessingState != EPVMFOMXEncNodeProcessingState_PortReEnable)
+ iProcessingState = EPVMFOMXEncNodeProcessingState_WaitForPortDisable;
- status = PVMFSuccess; // allow rescheduling of the node potentially
+ status = PVMFSuccess; // allow rescheduling of the node potentially
+ }
+ else
+ status = PVMFErrNoMemory; // must wait for buffers to come back. No point in automatic rescheduling
+ // but each buffer will reschedule the node when it comes in
}
else
- status = PVMFErrNoMemory; // must wait for buffers to come back. No point in automatic rescheduling
- // but each buffer will reschedule the node when it comes in
- }
- else
- {
- // this is input port
-
- // if all buffers have returned, free them
- if (iNumOutstandingInputBuffers == 0)
{
+ // this is input port
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "PVMFOMXEncNode-%s::HandleProcessingState() Port Reconfiguration -> all input buffers are back, free them", iNodeTypeId));
- if (false == iInputBuffersFreed)
+ // if all buffers have returned, free them
+ if (iNumOutstandingInputBuffers == 0)
{
- if (!FreeBuffersFromComponent(iInBufMemoryPool, // allocator
- iInputAllocSize, // size to allocate from pool (hdr only or hdr+ buffer)
- iNumInputBuffers, // number of buffers
- iInputPortIndex, // port idx
- true // this is input
- ))
+
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
+ (0, "PVMFOMXEncNode-%s::HandleProcessingState() Port Reconfiguration -> all input buffers are back, free them", iNodeTypeId));
+ if (false == iInputBuffersFreed)
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
- (0, "PVMFOMXEncNode-%s::HandleProcessingState() Port Reconfiguration -> Cannot free input buffers ", iNodeTypeId));
+ if (!FreeBuffersFromComponent(iInBufMemoryPool, // allocator
+ iInputAllocSize, // size to allocate from pool (hdr only or hdr+ buffer)
+ iNumInputBuffers, // number of buffers
+ iInputPortIndex, // port idx
+ true // this is input
+ ))
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
+ (0, "PVMFOMXEncNode-%s::HandleProcessingState() Port Reconfiguration -> Cannot free input buffers ", iNodeTypeId));
- SetState(EPVMFNodeError);
- ReportErrorEvent(PVMFErrNoMemory);
- return PVMFErrNoMemory;
+ SetState(EPVMFNodeError);
+ ReportErrorEvent(PVMFErrNoMemory);
+ return PVMFErrNoMemory;
+ }
}
+ // if the callback (that port is disabled) has not arrived yet, wait for it
+ // if it has arrived, it will set the state to PortReEnable
+ if (iProcessingState != EPVMFOMXEncNodeProcessingState_PortReEnable)
+ iProcessingState = EPVMFOMXEncNodeProcessingState_WaitForPortDisable;
+
+ status = PVMFSuccess; // allow rescheduling of the node
}
- // if the callback (that port is disabled) has not arrived yet, wait for it
- // if it has arrived, it will set the state to PortReEnable
- if (iProcessingState != EPVMFOMXEncNodeProcessingState_PortReEnable)
- iProcessingState = EPVMFOMXEncNodeProcessingState_WaitForPortDisable;
-
- status = PVMFSuccess; // allow rescheduling of the node
+ else
+ status = PVMFErrNoMemory; // must wait for buffers to come back. No point in automatic
+ // rescheduling. Each buffer will reschedule the node
+ // when it comes in
}
- else
- status = PVMFErrNoMemory; // must wait for buffers to come back. No point in automatic
- // rescheduling. Each buffer will reschedule the node
- // when it comes in
+
+
+ // the state will be changed to PortReEnable once we get confirmation that Port was actually disabled
+ break;
}
-
- // the state will be changed to PortReEnable once we get confirmation that Port was actually disabled
- break;
- }
-
case EPVMFOMXEncNodeProcessingState_WaitForPortDisable:
- {
+ {
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "PVMFOMXEncNode-%s::HandleProcessingState() Port Reconfiguration -> wait for port disable callback", iNodeTypeId));
- // do nothing. Just wait for the port to become disabled (we'll get event from component, which will
- // transition the state to PortReEnable
- status = PVMFErrNoMemory; // prevent Rescheduling the node
- break;
- }
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
+ (0, "PVMFOMXEncNode-%s::HandleProcessingState() Port Reconfiguration -> wait for port disable callback", iNodeTypeId));
+ // do nothing. Just wait for the port to become disabled (we'll get event from component, which will
+ // transition the state to PortReEnable
+ status = PVMFErrNoMemory; // prevent Rescheduling the node
+ break;
+ }
case EPVMFOMXEncNodeProcessingState_PortReEnable:
- {
-
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "PVMFOMXEncNode-%s::HandleProcessingState() Port Reconfiguration -> Sending reenable port command", iNodeTypeId));
- // set the port index so that we get parameters for the proper port
- iParamPort.nPortIndex = iPortIndexForDynamicReconfig;
- // iParamPort.nVersion = OMX_VERSION;
-
- // get new parameters of the port
- OMX_GetParameter(iOMXEncoder, OMX_IndexParamPortDefinition, &iParamPort);
-
- // send command for port re-enabling (for this to happen, we must first recreate the buffers)
- OMX_SendCommand(iOMXEncoder, OMX_CommandPortEnable, iPortIndexForDynamicReconfig, NULL);
-
- // is this output port?
- if (iPortIndexForDynamicReconfig == iOutputPortIndex)
{
- iOMXComponentOutputBufferSize = ((iParamPort.format.video.nFrameWidth + 15) & (~15)) * ((iParamPort.format.video.nFrameHeight + 15) & (~15)) * 3 / 2;
- // check the new buffer size
- if (iInPort)
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
+ (0, "PVMFOMXEncNode-%s::HandleProcessingState() Port Reconfiguration -> Sending reenable port command", iNodeTypeId));
+ // set the port index so that we get parameters for the proper port
+ iParamPort.nPortIndex = iPortIndexForDynamicReconfig;
+ // iParamPort.nVersion = OMX_VERSION;
+
+ // get new parameters of the port
+ OMX_GetParameter(iOMXEncoder, OMX_IndexParamPortDefinition, &iParamPort);
+
+ // send command for port re-enabling (for this to happen, we must first recreate the buffers)
+ OMX_SendCommand(iOMXEncoder, OMX_CommandPortEnable, iPortIndexForDynamicReconfig, NULL);
+
+ // is this output port?
+ if (iPortIndexForDynamicReconfig == iOutputPortIndex)
{
- if (((PVMFOMXEncPort*)iInPort)->iFormat == PVMF_MIME_H264_VIDEO ||
+ iOMXComponentOutputBufferSize = ((iParamPort.format.video.nFrameWidth + 15) & (~15)) * ((iParamPort.format.video.nFrameHeight + 15) & (~15)) * 3 / 2;
+
+ // check the new buffer size
+ if (iInPort)
+ {
+ if (((PVMFOMXEncPort*)iInPort)->iFormat == PVMF_MIME_H264_VIDEO ||
((PVMFOMXEncPort*)iInPort)->iFormat == PVMF_MIME_H264_VIDEO_MP4 ||
((PVMFOMXEncPort*)iInPort)->iFormat == PVMF_MIME_H264_VIDEO_RAW ||
((PVMFOMXEncPort*)iInPort)->iFormat == PVMF_MIME_M4V ||
((PVMFOMXEncPort*)iInPort)->iFormat == PVMF_MIME_H2631998 ||
((PVMFOMXEncPort*)iInPort)->iFormat == PVMF_MIME_H2632000)
- {
- iOMXComponentOutputBufferSize = ((iParamPort.format.video.nFrameWidth + 15) & (~15)) * ((iParamPort.format.video.nFrameHeight + 15) & (~15)) * 3 / 2;
+ {
+ iOMXComponentOutputBufferSize = ((iParamPort.format.video.nFrameWidth + 15) & (~15)) * ((iParamPort.format.video.nFrameHeight + 15) & (~15)) * 3 / 2;
+ }
+ else if (((PVMFOMXEncPort*)iInPort)->iFormat == PVMF_MIME_WMV)
+ {
+ // This is a requirement for the WMV encoder that we have currently
+ iOMXComponentOutputBufferSize = ((iParamPort.format.video.nFrameWidth + 3) & (~3)) * (iParamPort.format.video.nFrameHeight) * 3 / 2;
+ }
+ else
+ {
+ OSCL_ASSERT(false);
+ }
}
- else if (((PVMFOMXEncPort*)iInPort)->iFormat == PVMF_MIME_WMV)
+ // set the new width / height
+ iYUVWidth = iParamPort.format.video.nFrameWidth;
+ iYUVHeight = iParamPort.format.video.nFrameHeight;
+
+ if (iOMXComponentOutputBufferSize < iParamPort.nBufferSize)
+ iOMXComponentOutputBufferSize = iParamPort.nBufferSize;
+
+ // do we need to increase the number of buffers?
+ if (iNumOutputBuffers < iParamPort.nBufferCountMin)
+ iNumOutputBuffers = iParamPort.nBufferCountMin;
+
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
+ (0, "PVMFOMXEncNode-%s::HandleProcessingState() new output buffers %d, size %d", iNodeTypeId, iNumOutputBuffers, iOMXComponentOutputBufferSize));
+
+ /* Allocate output buffers */
+ if (!CreateOutMemPool(iNumOutputBuffers))
{
- // This is a requirement for the WMV encoder that we have currently
- iOMXComponentOutputBufferSize = ((iParamPort.format.video.nFrameWidth + 3) & (~3)) * (iParamPort.format.video.nFrameHeight) * 3 / 2;
+
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
+ (0, "PVMFOMXEncNode-%s::HandleProcessingState() Port Reconfiguration -> Cannot allocate output buffers ", iNodeTypeId));
+
+ SetState(EPVMFNodeError);
+ ReportErrorEvent(PVMFErrNoMemory);
+ return PVMFErrNoMemory;
}
- else
+
+ if (!ProvideBuffersToComponent(iOutBufMemoryPool, // allocator
+ iOutputAllocSize, // size to allocate from pool (hdr only or hdr+ buffer)
+ iNumOutputBuffers, // number of buffers
+ iOMXComponentOutputBufferSize, // actual buffer size
+ iOutputPortIndex, // port idx
+ iOMXComponentSupportsExternalOutputBufferAlloc, // can component use OMX_UseBuffer
+ false // this is not input
+ ))
{
- OSCL_ASSERT(false);
+
+
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
+ (0, "PVMFOMXEncNode-%s::HandleProcessingState() Port Reconfiguration -> Cannot provide output buffers to component", iNodeTypeId));
+
+ SetState(EPVMFNodeError);
+ ReportErrorEvent(PVMFErrNoMemory);
+ return PVMFErrNoMemory;
+
}
+
+ // do not drop output any more, i.e. enable output to be sent downstream
+ iDoNotSendOutputBuffersDownstreamFlag = false;
+
+
}
- // set the new width / height
- iYUVWidth = iParamPort.format.video.nFrameWidth;
- iYUVHeight = iParamPort.format.video.nFrameHeight;
-
- if (iOMXComponentOutputBufferSize < iParamPort.nBufferSize)
- iOMXComponentOutputBufferSize = iParamPort.nBufferSize;
-
- // do we need to increase the number of buffers?
- if (iNumOutputBuffers < iParamPort.nBufferCountMin)
- iNumOutputBuffers = iParamPort.nBufferCountMin;
-
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "PVMFOMXEncNode-%s::HandleProcessingState() new output buffers %d, size %d", iNodeTypeId, iNumOutputBuffers, iOMXComponentOutputBufferSize));
-
- /* Allocate output buffers */
- if (!CreateOutMemPool(iNumOutputBuffers))
+ else
{
+ // this is input port
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
- (0, "PVMFOMXEncNode-%s::HandleProcessingState() Port Reconfiguration -> Cannot allocate output buffers ", iNodeTypeId));
+ iOMXComponentInputBufferSize = iParamPort.nBufferSize;
+ // do we need to increase the number of buffers?
+ if (iNumInputBuffers < iParamPort.nBufferCountMin)
+ iNumInputBuffers = iParamPort.nBufferCountMin;
- SetState(EPVMFNodeError);
- ReportErrorEvent(PVMFErrNoMemory);
- return PVMFErrNoMemory;
- }
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
+ (0, "PVMFOMXEncNode-%s::HandleProcessingState() new buffers %d, size %d", iNodeTypeId, iNumInputBuffers, iOMXComponentInputBufferSize));
- if (!ProvideBuffersToComponent(iOutBufMemoryPool, // allocator
- iOutputAllocSize, // size to allocate from pool (hdr only or hdr+ buffer)
- iNumOutputBuffers, // number of buffers
- iOMXComponentOutputBufferSize, // actual buffer size
- iOutputPortIndex, // port idx
- iOMXComponentSupportsExternalOutputBufferAlloc, // can component use OMX_UseBuffer
- false // this is not input
- ))
- {
+ /* Allocate input buffers */
+ if (!CreateInputMemPool(iNumInputBuffers))
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
+ (0, "PVMFOMXEncNode-%s::HandleProcessingState() Port Reconfiguration -> Cannot allocate new input buffers to component", iNodeTypeId));
+
+ SetState(EPVMFNodeError);
+ ReportErrorEvent(PVMFErrNoMemory);
+ return PVMFErrNoMemory;
+ }
+
+ if (!ProvideBuffersToComponent(iInBufMemoryPool, // allocator
+ iInputAllocSize, // size to allocate from pool (hdr only or hdr+ buffer)
+ iNumInputBuffers, // number of buffers
+ iOMXComponentInputBufferSize, // actual buffer size
+ iInputPortIndex, // port idx
+ iOMXComponentSupportsExternalInputBufferAlloc, // can component use OMX_UseBuffer
+ true // this is input
+ ))
+ {
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
- (0, "PVMFOMXEncNode-%s::HandleProcessingState() Port Reconfiguration -> Cannot provide output buffers to component", iNodeTypeId));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
+ (0, "PVMFOMXEncNode-%s::HandleProcessingState() Port Reconfiguration -> Cannot provide new input buffers to component", iNodeTypeId));
- SetState(EPVMFNodeError);
- ReportErrorEvent(PVMFErrNoMemory);
- return PVMFErrNoMemory;
+ SetState(EPVMFNodeError);
+ ReportErrorEvent(PVMFErrNoMemory);
+ return PVMFErrNoMemory;
+
+ }
+ // do not drop partially consumed input
+ iDoNotSaveInputBuffersFlag = false;
+
}
- // do not drop output any more, i.e. enable output to be sent downstream
- iDoNotSendOutputBuffersDownstreamFlag = false;
-
-
- }
- else
- {
- // this is input port
-
- iOMXComponentInputBufferSize = iParamPort.nBufferSize;
- // do we need to increase the number of buffers?
- if (iNumInputBuffers < iParamPort.nBufferCountMin)
- iNumInputBuffers = iParamPort.nBufferCountMin;
-
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "PVMFOMXEncNode-%s::HandleProcessingState() new buffers %d, size %d", iNodeTypeId, iNumInputBuffers, iOMXComponentInputBufferSize));
-
- /* Allocate input buffers */
- if (!CreateInputMemPool(iNumInputBuffers))
- {
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
- (0, "PVMFOMXEncNode-%s::HandleProcessingState() Port Reconfiguration -> Cannot allocate new input buffers to component", iNodeTypeId));
-
- SetState(EPVMFNodeError);
- ReportErrorEvent(PVMFErrNoMemory);
- return PVMFErrNoMemory;
- }
-
- if (!ProvideBuffersToComponent(iInBufMemoryPool, // allocator
- iInputAllocSize, // size to allocate from pool (hdr only or hdr+ buffer)
- iNumInputBuffers, // number of buffers
- iOMXComponentInputBufferSize, // actual buffer size
- iInputPortIndex, // port idx
- iOMXComponentSupportsExternalInputBufferAlloc, // can component use OMX_UseBuffer
- true // this is input
- ))
- {
-
-
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
- (0, "PVMFOMXEncNode-%s::HandleProcessingState() Port Reconfiguration -> Cannot provide new input buffers to component", iNodeTypeId));
-
- SetState(EPVMFNodeError);
- ReportErrorEvent(PVMFErrNoMemory);
- return PVMFErrNoMemory;
-
- }
- // do not drop partially consumed input
- iDoNotSaveInputBuffersFlag = false;
-
-
- }
-
- // if the callback that the port was re-enabled has not arrived yet, wait for it
- // if it has arrived, it will set the state to either PortReconfig or to ReadyToEncode
- if (iProcessingState != EPVMFOMXEncNodeProcessingState_PortReconfig &&
+ // if the callback that the port was re-enabled has not arrived yet, wait for it
+ // if it has arrived, it will set the state to either PortReconfig or to ReadyToEncode
+ if (iProcessingState != EPVMFOMXEncNodeProcessingState_PortReconfig &&
iProcessingState != EPVMFOMXEncNodeProcessingState_ReadyToEncode)
- iProcessingState = EPVMFOMXEncNodeProcessingState_WaitForPortEnable;
+ iProcessingState = EPVMFOMXEncNodeProcessingState_WaitForPortEnable;
- status = PVMFSuccess; // allow rescheduling of the node
- break;
- }
+ status = PVMFSuccess; // allow rescheduling of the node
+ break;
+ }
case EPVMFOMXEncNodeProcessingState_WaitForPortEnable:
- {
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "PVMFOMXEncNode-%s::HandleProcessingState() Port Reconfiguration -> wait for port enable callback", iNodeTypeId));
- // do nothing. Just wait for the port to become enabled (we'll get event from component, which will
- // transition the state to ReadyToEncode
- status = PVMFErrNoMemory; // prevent ReScheduling
- break;
- }
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
+ (0, "PVMFOMXEncNode-%s::HandleProcessingState() Port Reconfiguration -> wait for port enable callback", iNodeTypeId));
+ // do nothing. Just wait for the port to become enabled (we'll get event from component, which will
+ // transition the state to ReadyToEncode
+ status = PVMFErrNoMemory; // prevent ReScheduling
+ break;
+ }
- // NORMAL DATA FLOW STATE:
+ // NORMAL DATA FLOW STATE:
case EPVMFOMXEncNodeProcessingState_ReadyToEncode:
- {
-
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "PVMFOMXEncNode-%s::HandleProcessingState() Ready To Encode start", iNodeTypeId));
- // In normal data flow and decoding state
- // Send all available output buffers to the encoder
-
- while (iNumOutstandingOutputBuffers < iNumOutputBuffers)
{
- // grab buffer header from the mempool if possible, and send to component
- if (!SendOutputBufferToOMXComponent())
- break;
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
+ (0, "PVMFOMXEncNode-%s::HandleProcessingState() Ready To Encode start", iNodeTypeId));
+ // In normal data flow and decoding state
+ // Send all available output buffers to the encoder
+
+ while (iNumOutstandingOutputBuffers < iNumOutputBuffers)
+ {
+ // grab buffer header from the mempool if possible, and send to component
+ if (!SendOutputBufferToOMXComponent())
+
+ break;
+
+ }
+
+
+ // next, see if partially consumed input buffer needs to be resent back to OMX component
+ // NOTE: it is not allowed that the component returns more than 1 partially consumed input buffers
+ // i.e. if a partially consumed input buffer is returned, it is assumed that the OMX component
+ // will be waiting to get data
+
+ if (iInputBufferToResendToComponent != NULL)
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG,
+ (0, "PVMFOMXEncNode-%s::HandleProcessingState() Sending previous - partially consumed input back to the OMX component", iNodeTypeId));
+
+ OMX_EmptyThisBuffer(iOMXEncoder, iInputBufferToResendToComponent);
+ iInputBufferToResendToComponent = NULL; // do this only once
+ }
+ else if ((iNumOutstandingInputBuffers < iNumInputBuffers) && (iDataIn.GetRep() != NULL))
+ {
+ // try to get an input buffer header
+ // and send the input data over to the component
+ SendInputBufferToOMXComponent();
+ }
+
+ status = PVMFSuccess;
+ break;
+
}
-
-
- // next, see if partially consumed input buffer needs to be resent back to OMX component
- // NOTE: it is not allowed that the component returns more than 1 partially consumed input buffers
- // i.e. if a partially consumed input buffer is returned, it is assumed that the OMX component
- // will be waiting to get data
-
- if (iInputBufferToResendToComponent != NULL)
- {
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG,
- (0, "PVMFOMXEncNode-%s::HandleProcessingState() Sending previous - partially consumed input back to the OMX component", iNodeTypeId));
-
- OMX_EmptyThisBuffer(iOMXEncoder, iInputBufferToResendToComponent);
- iInputBufferToResendToComponent = NULL; // do this only once
- }
- else if ((iNumOutstandingInputBuffers < iNumInputBuffers) && (iDataIn.GetRep() != NULL))
- {
- // try to get an input buffer header
- // and send the input data over to the component
- SendInputBufferToOMXComponent();
- }
-
- status = PVMFSuccess;
- break;
-
-
- }
case EPVMFOMXEncNodeProcessingState_Stopping:
- {
+ {
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "PVMFOMXEncNode-%s::HandleProcessingState() Stopping -> wait for Component to move from Executing->Idle", iNodeTypeId));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
+ (0, "PVMFOMXEncNode-%s::HandleProcessingState() Stopping -> wait for Component to move from Executing->Idle", iNodeTypeId));
- status = PVMFErrNoMemory; // prevent rescheduling
- break;
- }
+ status = PVMFErrNoMemory; // prevent rescheduling
+ break;
+ }
case EPVMFOMXEncNodeProcessingState_WaitForOutgoingQueue:
status = PVMFErrNoMemory;
@@ -1987,13 +1987,13 @@
// first check if encode parameters have been set correctly
if ((0 == iVideoEncodeParam.iFrameWidth[0]) ||
- (0 == iVideoEncodeParam.iFrameHeight[0]) ||
- (0 == iVideoEncodeParam.iFrameRate[0]) ||
- (0 == iVideoEncodeParam.iBitRate[0]) ||
- (0 == iVideoInputFormat.iFrameWidth) ||
- (0 == iVideoInputFormat.iFrameHeight) ||
- (0 == iVideoInputFormat.iFrameRate)
- )
+ (0 == iVideoEncodeParam.iFrameHeight[0]) ||
+ (0 == iVideoEncodeParam.iFrameRate[0]) ||
+ (0 == iVideoEncodeParam.iBitRate[0]) ||
+ (0 == iVideoInputFormat.iFrameWidth) ||
+ (0 == iVideoInputFormat.iFrameHeight) ||
+ (0 == iVideoInputFormat.iFrameRate)
+ )
{
PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
(0, "PVMFOMXEncNode-%s::NegotiateVideoComponentParameters() Encode parameters not set correctly", iNodeTypeId));
@@ -2066,7 +2066,7 @@
else if (iInFormat == PVMF_MIME_YUV420)
{
iOMXComponentInputBufferSize = (iVideoInputFormat.iFrameWidth * iVideoInputFormat.iFrameHeight * 3) >> 1;
- //TODO: get color format from MIO. JJ 03/09/09
+ //TODO: get color format from MIO. JJ 03/09/09
iParamPort.format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar;
//iParamPort.format.video.eColorFormat = OMX_COLOR_FormatYUV420Planar;
}
@@ -2124,7 +2124,7 @@
}
-//////////////////// OUTPUT PORT //////////////////////////////////////////////
+ //////////////////// OUTPUT PORT //////////////////////////////////////////////
CONFIG_SIZE_AND_VERSION(Video_port_format);
Video_port_format.nPortIndex = iOutputPortIndex; // set output port as target
@@ -2608,7 +2608,7 @@
{
PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
(0, "PVMFOMXEncNode-%s::SetH263EncoderParameters OMX_GetParameter() failed for index(0x%x)", iNodeTypeId, OMX_IndexParamVideoH263));
- }
+ }
//Set the OMX_VIDEO_PARAM_H263TYPE parameters
@@ -2742,7 +2742,7 @@
ErrCorrType.bEnableHEC = OMX_FALSE;
ErrCorrType.bEnableResync = OMX_FALSE;
ErrCorrType.nResynchMarkerSpacing = 0;
- ErrCorrType.bEnableRVLC = OMX_FALSE; // corresponds to encode param rvlcEnable
+ ErrCorrType.bEnableRVLC = OMX_FALSE; // corresponds to encode param rvlcEnable
Err = OMX_SetParameter(iOMXEncoder, OMX_IndexParamVideoErrorCorrection, &ErrCorrType);
if (OMX_ErrorNone != Err)
{
@@ -3132,15 +3132,15 @@
// first basic check if encode parameters have been set correctly
if ((0 == iAudioEncodeParam.iMaxNumOutputFramesPerBuffer) ||
- (0 == iAudioEncodeParam.iAMRBitrate) ||
- (0 == iAudioEncodeParam.iOutputNumChannels) ||
- (2 < iAudioEncodeParam.iOutputNumChannels) ||
- (0 == iAudioEncodeParam.iOutputSamplingRate) ||
- (0 == iAudioInputFormat.iInputBitsPerSample) ||
- (0 == iAudioInputFormat.iInputNumChannels) ||
- (2 < iAudioInputFormat.iInputNumChannels) ||
- (0 == iAudioInputFormat.iInputSamplingRate)
- )
+ (0 == iAudioEncodeParam.iAMRBitrate) ||
+ (0 == iAudioEncodeParam.iOutputNumChannels) ||
+ (2 < iAudioEncodeParam.iOutputNumChannels) ||
+ (0 == iAudioEncodeParam.iOutputSamplingRate) ||
+ (0 == iAudioInputFormat.iInputBitsPerSample) ||
+ (0 == iAudioInputFormat.iInputNumChannels) ||
+ (2 < iAudioInputFormat.iInputNumChannels) ||
+ (0 == iAudioInputFormat.iInputSamplingRate)
+ )
{
PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
(0, "PVMFOMXEncNode-%s::NegotiateAudioComponentParameters() Encode parameters not set correctly", iNodeTypeId));
@@ -3269,13 +3269,13 @@
}
- Audio_Pcm_Param.nChannels = (OMX_U32) iAudioInputFormat.iInputNumChannels;
- Audio_Pcm_Param.eNumData = OMX_NumericalDataSigned; // signed
- Audio_Pcm_Param.eEndian = OMX_EndianLittle; // little-endian
- Audio_Pcm_Param.bInterleaved = ((EINTERLEAVE_LR == iAudioInputFormat.iInputInterleaveMode) ? OMX_TRUE : OMX_FALSE);
- Audio_Pcm_Param.nBitPerSample = (OMX_U32) iAudioInputFormat.iInputBitsPerSample;
- Audio_Pcm_Param.nSamplingRate = (OMX_U32) iAudioInputFormat.iInputSamplingRate;
- Audio_Pcm_Param.ePCMMode = OMX_AUDIO_PCMModeLinear;
+ Audio_Pcm_Param.nChannels = (OMX_U32) iAudioInputFormat.iInputNumChannels;
+ Audio_Pcm_Param.eNumData = OMX_NumericalDataSigned; // signed
+ Audio_Pcm_Param.eEndian = OMX_EndianLittle; // little-endian
+ Audio_Pcm_Param.bInterleaved = ((EINTERLEAVE_LR == iAudioInputFormat.iInputInterleaveMode) ? OMX_TRUE : OMX_FALSE);
+ Audio_Pcm_Param.nBitPerSample = (OMX_U32) iAudioInputFormat.iInputBitsPerSample;
+ Audio_Pcm_Param.nSamplingRate = (OMX_U32) iAudioInputFormat.iInputSamplingRate;
+ Audio_Pcm_Param.ePCMMode = OMX_AUDIO_PCMModeLinear;
// don't set - let use default Audio_Pcm_Param.eChannelMapping
@@ -3293,8 +3293,8 @@
// first of all, check if the port supports the adequate port format
if ((iOutFormat == PVMF_MIME_AMR_IETF) ||
- (iOutFormat == PVMF_MIME_AMRWB_IETF) ||
- (iOutFormat == PVMF_MIME_AMR_IF2))
+ (iOutFormat == PVMF_MIME_AMRWB_IETF) ||
+ (iOutFormat == PVMF_MIME_AMR_IF2))
{
DesiredPortFormat = OMX_AUDIO_CodingAMR;
}
@@ -3388,8 +3388,8 @@
if ((iOutFormat == PVMF_MIME_AMR_IETF) ||
- (iOutFormat == PVMF_MIME_AMRWB_IETF) ||
- (iOutFormat == PVMF_MIME_AMR_IF2))
+ (iOutFormat == PVMF_MIME_AMRWB_IETF) ||
+ (iOutFormat == PVMF_MIME_AMR_IF2))
{
iParamPort.format.audio.eEncoding = OMX_AUDIO_CodingAMR;
}
@@ -3417,8 +3417,8 @@
// now call codec specific parameter setting
bool status = true;
if ((iOutFormat == PVMF_MIME_AMR_IETF) ||
- (iOutFormat == PVMF_MIME_AMRWB_IETF) ||
- (iOutFormat == PVMF_MIME_AMR_IF2))
+ (iOutFormat == PVMF_MIME_AMRWB_IETF) ||
+ (iOutFormat == PVMF_MIME_AMR_IF2))
{
status = SetAMREncoderParameters();
@@ -3685,9 +3685,9 @@
input_buf->pBufHdr->nOffset = 0;
input_buf->pBufHdr->nTimeStamp = iEndOfDataTimestamp;
- if( bIsQCOMOmxComp )
+ if( bIsQCOMOmxComp )
{
- input_buf->pBufHdr->nTimeStamp = 1000*iEndOfDataTimestamp;
+ input_buf->pBufHdr->nTimeStamp = 1000*iEndOfDataTimestamp;
}
// set ptr to input_buf structure for Context (for when the buffer is returned)
@@ -3760,7 +3760,7 @@
}
}
- input_buf = new(temp)InputBufCtrlStruct ; //JJDBG
+ input_buf = new(temp)InputBufCtrlStruct ; //JJDBG
// keep track of buffers. When buffer is deallocated/released, the counter will be decremented
iInBufMemoryPool->notifyfreechunkavailable(*this, (OsclAny*) iInBufMemoryPool);
@@ -3781,8 +3781,8 @@
// Now we have the buffer header (i.e. a buffer) to send to component:
// Depending on OMX component capabilities, either pass the input msg fragment(s) directly
- // into OMX component without copying (and update the input msg refcount)
- // or memcopy the content of input msg memfrag(s) into OMX component allocated buffers
+ // into OMX component without copying (and update the input msg refcount)
+ // or memcopy the content of input msg memfrag(s) into OMX component allocated buffers
// if this is the first fragment in a new message, extract some info:
@@ -3798,10 +3798,10 @@
iInPacketSeqNum = iDataIn->getSeqNum(); // remember input sequence number
iInTimestamp = iDataIn->getTimestamp();
- if( bIsQCOMOmxComp )
- {
- iInTimestamp *= 1000;
- }
+ if( bIsQCOMOmxComp )
+ {
+ iInTimestamp *= 1000;
+ }
iInDuration = iDataIn->getDuration();
iInNumFrags = iDataIn->getNumFragments();
@@ -3936,8 +3936,8 @@
// if we sent all fragments to OMX component, decouple the input message from iDataIn
// Input message is "decoupled", so that we can get a new message for processing into iDataIn
- // However, the actual message is released completely to upstream mempool once all of its fragments
- // are returned by the OMX component
+ // However, the actual message is released completely to upstream mempool once all of its fragments
+ // are returned by the OMX component
if (iCurrFragNum == iDataIn->getNumFragments())
{
@@ -3986,8 +3986,8 @@
// ENCODER SPECIFIC FOR AVC RAW (BYTESTREAM) FORMAT
if ((iOutFormat == PVMF_MIME_H264_VIDEO_RAW) &&
- (!iOMXComponentUsesFullAVCFrames) &&
- (!iOMXComponentUsesNALStartCodes))
+ (!iOMXComponentUsesFullAVCFrames) &&
+ (!iOMXComponentUsesNALStartCodes))
{
iOutputAllocSize += 4; // NAL SYNC WORD SIZE
}
@@ -4051,28 +4051,28 @@
// 3 cases in order of preference and simplicity
// Case 1 (buffers allocated upstream - no memcpy needed):
- // PV OMX Component - We use buffers allocated outside the OMX node (i.e. allocated upstream)
+ // PV OMX Component - We use buffers allocated outside the OMX node (i.e. allocated upstream)
// Mempool contains InputBufCtrlStructures (ptrs to buffer headers and PMVFMediaData ptrs - to keep track of when to unbind input msgs)
- // NOTE: in this case, when providing input buffers to OMX component,
- // OMX_UseBuffer calls will provide some initial pointers and sizes of buffers, but these
- // are dummy values. Actual buffer pointers and filled sizes will be obtained from the input msg fragments.
- // The PV OMX component will use the buffers even if the ptrs differ from the ones during initialization
- // 3rd party OMX components can also use this case if they are capable of ignoring the actual buffer pointers in
- // buffer header field (i.e. if after OMX_UseBuffer(...) call, they allow the ptr to actual buffer data to change at a later time
+ // NOTE: in this case, when providing input buffers to OMX component,
+ // OMX_UseBuffer calls will provide some initial pointers and sizes of buffers, but these
+ // are dummy values. Actual buffer pointers and filled sizes will be obtained from the input msg fragments.
+ // The PV OMX component will use the buffers even if the ptrs differ from the ones during initialization
+ // 3rd party OMX components can also use this case if they are capable of ignoring the actual buffer pointers in
+ // buffer header field (i.e. if after OMX_UseBuffer(...) call, they allow the ptr to actual buffer data to change at a later time
// CASE 2 (buffers allocated in the node - memcpy needed)
- // If 3rd party OMX component can use buffers allocated outside the OMX component, but it cannot
- // change buffer ptr allocations dynamically (i.e. after initialization with OMX_UseBuffer call is complete)
+ // If 3rd party OMX component can use buffers allocated outside the OMX component, but it cannot
+ // change buffer ptr allocations dynamically (i.e. after initialization with OMX_UseBuffer call is complete)
- // Mempool contains InputBufCtrlStructures (ptrs to buffer headers, PVMFMediaData ptrs to keep track of when to unbind input msgs) +
- // actual buffers.
- // NOTE: Data must be copied from input message into the local buffer before the buffer is given to the OMX component
+ // Mempool contains InputBufCtrlStructures (ptrs to buffer headers, PVMFMediaData ptrs to keep track of when to unbind input msgs) +
+ // actual buffers.
+ // NOTE: Data must be copied from input message into the local buffer before the buffer is given to the OMX component
// CASE 3 (buffers allocated in the component - memcpy needed)
- // If 3rd party OMX component must allocate its own buffers
- // Mempool only contains InputBufCtrlStruct (ptrs to buffer headers + PMVFMediaData ptrs to keep track of when to unbind input msgs)
- // NOTE: Data must be copied from input message into the local buffer before the buffer is given to the OMX component (like in case 2)
+ // If 3rd party OMX component must allocate its own buffers
+ // Mempool only contains InputBufCtrlStruct (ptrs to buffer headers + PMVFMediaData ptrs to keep track of when to unbind input msgs)
+ // NOTE: Data must be copied from input message into the local buffer before the buffer is given to the OMX component (like in case 2)
PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
(0, "PVMFOMXEncNode-%s::CreateInputMemPool() start ", iNodeTypeId));
@@ -4135,19 +4135,19 @@
}
////////////////////////////////////////////////////////////////////////////
bool PVMFOMXEncNode::ProvideBuffersToComponent(OsclMemPoolFixedChunkAllocator *aMemPool, // allocator
- uint32 aAllocSize, // size to allocate from pool (hdr only or hdr+ buffer)
- uint32 aNumBuffers, // number of buffers
- uint32 aActualBufferSize, // aactual buffer size
- uint32 aPortIndex, // port idx
- bool aUseBufferOK, // can component use OMX_UseBuffer or should it use OMX_AllocateBuffer
- bool aIsThisInputBuffer // is this input or output
- )
+ uint32 aAllocSize, // size to allocate from pool (hdr only or hdr+ buffer)
+ uint32 aNumBuffers, // number of buffers
+ uint32 aActualBufferSize, // aactual buffer size
+ uint32 aPortIndex, // port idx
+ bool aUseBufferOK, // can component use OMX_UseBuffer or should it use OMX_AllocateBuffer
+ bool aIsThisInputBuffer // is this input or output
+ )
{
PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "PVMFOMXEncNode-%s::ProvideBuffersToComponent() enter", iNodeTypeId));
uint32 ii = 0;
OMX_ERRORTYPE err = OMX_ErrorNone;
- OsclAny **ctrl_struct_ptr = NULL; // temporary array to keep the addresses of buffer ctrl structures and buffers
+ OsclAny **ctrl_struct_ptr = NULL; // temporary array to keep the addresses of buffer ctrl structures and buffers
ctrl_struct_ptr = (OsclAny **) oscl_malloc(aNumBuffers * sizeof(OsclAny *));
if (ctrl_struct_ptr == NULL)
@@ -4193,10 +4193,10 @@
// just after the buffer header pointer.
// In case of input buffers, the buffer header pointer is followed by a MediaDataSharedPtr
- // which is used to ensure proper unbinding of the input messages. The buffer itself is either:
- // a) allocated upstream (and the ptr to the buffer
- // is a dummy pointer to which the component does not pay attention - PV OMX component)
- // b) located just after the buffer header pointer and MediaDataSharedPtr
+ // which is used to ensure proper unbinding of the input messages. The buffer itself is either:
+ // a) allocated upstream (and the ptr to the buffer
+ // is a dummy pointer to which the component does not pay attention - PV OMX component)
+ // b) located just after the buffer header pointer and MediaDataSharedPtr
uint8 *pB = ((uint8*) ctrl_struct_ptr[ii]);
@@ -4212,14 +4212,14 @@
// advance ptr to skip the structure
pB += oscl_mem_aligned_size(sizeof(InputBufCtrlStruct));
- err = OMX_UseBuffer(iOMXEncoder, // hComponent
- &(temp->pBufHdr), // address where ptr to buffer header will be stored
- aPortIndex, // port index (for port for which buffer is provided)
- ctrl_struct_ptr[ii], // App. private data = pointer to beginning of allocated data
- // to have a context when component returns with a callback (i.e. to know
- // what to free etc.
- (OMX_U32)aActualBufferSize, // buffer size
- pB); // buffer data ptr
+ err = OMX_UseBuffer(iOMXEncoder, // hComponent
+ &(temp->pBufHdr), // address where ptr to buffer header will be stored
+ aPortIndex, // port index (for port for which buffer is provided)
+ ctrl_struct_ptr[ii], // App. private data = pointer to beginning of allocated data
+ // to have a context when component returns with a callback (i.e. to know
+ // what to free etc.
+ (OMX_U32)aActualBufferSize, // buffer size
+ pB); // buffer data ptr
in_ctrl_struct_ptr[ii] = ctrl_struct_ptr[ii];
in_buff_hdr_ptr[ii] = temp->pBufHdr;
@@ -4232,8 +4232,8 @@
pB += oscl_mem_aligned_size(sizeof(OutputBufCtrlStruct));
if ((iOutFormat == PVMF_MIME_H264_VIDEO_RAW) &&
- !iOMXComponentUsesFullAVCFrames &&
- !iOMXComponentUsesNALStartCodes)
+ !iOMXComponentUsesFullAVCFrames &&
+ !iOMXComponentUsesNALStartCodes)
{
// write out NAL sync word at the beginning of the buffer
pB[0] = 0;
@@ -4246,14 +4246,14 @@
// The node will move the ptr -4 when it needs teh sync word
}
- err = OMX_UseBuffer(iOMXEncoder, // hComponent
- &(temp->pBufHdr), // address where ptr to buffer header will be stored
- aPortIndex, // port index (for port for which buffer is provided)
- ctrl_struct_ptr[ii], // App. private data = pointer to beginning of allocated data
- // to have a context when component returns with a callback (i.e. to know
- // what to free etc.
- (OMX_U32)aActualBufferSize, // buffer size
- pB); // buffer data ptr
+ err = OMX_UseBuffer(iOMXEncoder, // hComponent
+ &(temp->pBufHdr), // address where ptr to buffer header will be stored
+ aPortIndex, // port index (for port for which buffer is provided)
+ ctrl_struct_ptr[ii], // App. private data = pointer to beginning of allocated data
+ // to have a context when component returns with a callback (i.e. to know
+ // what to free etc.
+ (OMX_U32)aActualBufferSize, // buffer size
+ pB); // buffer data ptr
out_ctrl_struct_ptr[ii] = ctrl_struct_ptr[ii];
out_buff_hdr_ptr[ii] = temp->pBufHdr;
@@ -4333,17 +4333,17 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool PVMFOMXEncNode::FreeBuffersFromComponent(OsclMemPoolFixedChunkAllocator *aMemPool, // allocator
- uint32 aAllocSize, // size to allocate from pool (hdr only or hdr+ buffer)
- uint32 aNumBuffers, // number of buffers
- uint32 aPortIndex, // port idx
- bool aIsThisInputBuffer // is this input or output
- )
+ uint32 aAllocSize, // size to allocate from pool (hdr only or hdr+ buffer)
+ uint32 aNumBuffers, // number of buffers
+ uint32 aPortIndex, // port idx
+ bool aIsThisInputBuffer // is this input or output
+ )
{
PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "PVMFOMXEncNode-%s::FreeBuffersToComponent() enter", iNodeTypeId));
uint32 ii = 0;
OMX_ERRORTYPE err = OMX_ErrorNone;
- OsclAny **ctrl_struct_ptr = NULL; // temporary array to keep the addresses of buffer ctrl structures and buffers
+ OsclAny **ctrl_struct_ptr = NULL; // temporary array to keep the addresses of buffer ctrl structures and buffers
ctrl_struct_ptr = (OsclAny **) oscl_malloc(aNumBuffers * sizeof(OsclAny *));
if (ctrl_struct_ptr == NULL)
@@ -4452,11 +4452,11 @@
////////////////////// CALLBACK PROCESSING FOR EVENT HANDLER
/////////////////////////////////////////////////////////////////////////////
OMX_ERRORTYPE PVMFOMXEncNode::EventHandlerProcessing(OMX_OUT OMX_HANDLETYPE aComponent,
- OMX_OUT OMX_PTR aAppData,
- OMX_OUT OMX_EVENTTYPE aEvent,
- OMX_OUT OMX_U32 aData1,
- OMX_OUT OMX_U32 aData2,
- OMX_OUT OMX_PTR aEventData)
+ OMX_OUT OMX_PTR aAppData,
+ OMX_OUT OMX_EVENTTYPE aEvent,
+ OMX_OUT OMX_U32 aData1,
+ OMX_OUT OMX_U32 aData2,
+ OMX_OUT OMX_PTR aEventData)
{
OSCL_UNUSED_ARG(aComponent);
OSCL_UNUSED_ARG(aAppData);
@@ -4465,165 +4465,165 @@
switch (aEvent)
{
case OMX_EventCmdComplete:
- {
-
- switch (aData1)
{
- case OMX_CommandStateSet:
- {
- HandleComponentStateChange(aData2);
- break;
- }
- case OMX_CommandFlush: //not supported
- // nothing to do here yet
- break;
- case OMX_CommandPortDisable:
+ switch (aData1)
{
- // if port disable command is done, we can re-allocate the buffers and re-enable the port
+ case OMX_CommandStateSet:
+ {
+ HandleComponentStateChange(aData2);
+ break;
+ }
+ case OMX_CommandFlush: //not supported
+ // nothing to do here yet
+ break;
- iProcessingState = EPVMFOMXEncNodeProcessingState_PortReEnable;
- iPortIndexForDynamicReconfig = aData2;
+ case OMX_CommandPortDisable:
+ {
+ // if port disable command is done, we can re-allocate the buffers and re-enable the port
- RunIfNotReady();
- break;
- }
- case OMX_CommandPortEnable:
- // port enable command is done. Check if the other port also reported change.
- // If not, we can start data flow. Otherwise, must start dynamic reconfig procedure for
- // the other port as well.
- {
- if (iSecondPortReportedChange)
- {
+ iProcessingState = EPVMFOMXEncNodeProcessingState_PortReEnable;
+ iPortIndexForDynamicReconfig = aData2;
+
+ RunIfNotReady();
+ break;
+ }
+ case OMX_CommandPortEnable:
+ // port enable command is done. Check if the other port also reported change.
+ // If not, we can start data flow. Otherwise, must start dynamic reconfig procedure for
+ // the other port as well.
+ {
+ if (iSecondPortReportedChange)
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_ERR,
+ (0, "PVMFOMXEncNode-%s::EventHandlerProcessing: OMX_CommandPortEnable - completed on port %d, dynamic reconfiguration needed on port %d", iNodeTypeId, aData2, iSecondPortToReconfig));
+
+ iProcessingState = EPVMFOMXEncNodeProcessingState_PortReconfig;
+ iPortIndexForDynamicReconfig = iSecondPortToReconfig;
+ iSecondPortReportedChange = false;
+ }
+ else
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_ERR,
+ (0, "PVMFOMXEncNode-%s::EventHandlerProcessing: OMX_CommandPortEnable - completed on port %d, resuming normal data flow", iNodeTypeId, aData2));
+ iProcessingState = EPVMFOMXEncNodeProcessingState_ReadyToEncode;
+ iDynamicReconfigInProgress = false;
+ }
+ RunIfNotReady();
+ break;
+ }
+
+ case OMX_CommandMarkBuffer:
+ // nothing to do here yet;
PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_ERR,
- (0, "PVMFOMXEncNode-%s::EventHandlerProcessing: OMX_CommandPortEnable - completed on port %d, dynamic reconfiguration needed on port %d", iNodeTypeId, aData2, iSecondPortToReconfig));
+ (0, "PVMFOMXEncNode-%s::EventHandlerProcessing: OMX_CommandMarkBuffer - completed - no action taken", iNodeTypeId));
- iProcessingState = EPVMFOMXEncNodeProcessingState_PortReconfig;
- iPortIndexForDynamicReconfig = iSecondPortToReconfig;
- iSecondPortReportedChange = false;
- }
- else
- {
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_ERR,
- (0, "PVMFOMXEncNode-%s::EventHandlerProcessing: OMX_CommandPortEnable - completed on port %d, resuming normal data flow", iNodeTypeId, aData2));
- iProcessingState = EPVMFOMXEncNodeProcessingState_ReadyToEncode;
- iDynamicReconfigInProgress = false;
- }
- RunIfNotReady();
- break;
- }
+ break;
- case OMX_CommandMarkBuffer:
- // nothing to do here yet;
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_ERR,
- (0, "PVMFOMXEncNode-%s::EventHandlerProcessing: OMX_CommandMarkBuffer - completed - no action taken", iNodeTypeId));
+ default:
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_ERR,
+ (0, "PVMFOMXEncNode-%s::EventHandlerProcessing: Unsupported event", iNodeTypeId));
+ break;
+ }
+ }//end of switch (aData1)
- break;
-
- default:
- {
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_ERR,
- (0, "PVMFOMXEncNode-%s::EventHandlerProcessing: Unsupported event", iNodeTypeId));
- break;
- }
- }//end of switch (aData1)
-
- break;
- }//end of case OMX_EventCmdComplete
+ break;
+ }//end of case OMX_EventCmdComplete
case OMX_EventError:
- {
-
- if (aData1 == (OMX_U32) OMX_ErrorStreamCorrupt)
- {
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_ERR,
- (0, "PVMFOMXEncNode-%s::EventHandlerProcessing: OMX_EventError - Bitstream corrupt error", iNodeTypeId));
- // Errors from corrupt bitstream are reported as info events
- ReportInfoEvent(PVMFInfoProcessingFailure, NULL);
-
- }
- else
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_ERR,
- (0, "PVMFOMXEncNode-%s::EventHandlerProcessing: OMX_EventError", iNodeTypeId));
- // for now, any error from the component will be reported as error
- ReportErrorEvent(PVMFErrorEvent, NULL, NULL);
- SetState(EPVMFNodeError);
- }
- break;
+ if (aData1 == (OMX_U32) OMX_ErrorStreamCorrupt)
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_ERR,
+ (0, "PVMFOMXEncNode-%s::EventHandlerProcessing: OMX_EventError - Bitstream corrupt error", iNodeTypeId));
+ // Errors from corrupt bitstream are reported as info events
+ ReportInfoEvent(PVMFInfoProcessingFailure, NULL);
- }
+ }
+ else
+ {
+
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_ERR,
+ (0, "PVMFOMXEncNode-%s::EventHandlerProcessing: OMX_EventError", iNodeTypeId));
+ // for now, any error from the component will be reported as error
+ ReportErrorEvent(PVMFErrorEvent, NULL, NULL);
+ SetState(EPVMFNodeError);
+ }
+ break;
+
+ }
case OMX_EventBufferFlag:
- {
- // the component is reporting it encountered end of stream flag
- // we'll send eos when we get the actual last buffer with marked eos
+ {
+ // the component is reporting it encountered end of stream flag
+ // we'll send eos when we get the actual last buffer with marked eos
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "PVMFOMXEncNode-%s::EventHandlerProcessing: OMX_EventBufferFlag (EOS) flag returned from OMX component", iNodeTypeId));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
+ (0, "PVMFOMXEncNode-%s::EventHandlerProcessing: OMX_EventBufferFlag (EOS) flag returned from OMX component", iNodeTypeId));
- RunIfNotReady();
- break;
- }//end of case OMX_EventBufferFlag
+ RunIfNotReady();
+ break;
+ }//end of case OMX_EventBufferFlag
case OMX_EventMark:
- {
+ {
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "PVMFOMXEncNode-%s::EventHandlerProcessing: OMX_EventMark returned from OMX component - no action taken", iNodeTypeId));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
+ (0, "PVMFOMXEncNode-%s::EventHandlerProcessing: OMX_EventMark returned from OMX component - no action taken", iNodeTypeId));
- RunIfNotReady();
- break;
- }//end of case OMX_EventMark
+ RunIfNotReady();
+ break;
+ }//end of case OMX_EventMark
case OMX_EventPortSettingsChanged:
- {
-
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "PVMFOMXEncNode-%s::EventHandlerProcessing: OMX_EventPortSettingsChanged returned from OMX component", iNodeTypeId));
-
- // first check if dynamic reconfiguration is already in progress,
- // if so, wait until this is completed, and then initiate the 2nd reconfiguration
- if (iDynamicReconfigInProgress)
{
+
PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "PVMFOMXEncNode-%s::EventHandlerProcessing: OMX_EventPortSettingsChanged returned for port %d, dynamic reconfig already in progress", iNodeTypeId, aData1));
+ (0, "PVMFOMXEncNode-%s::EventHandlerProcessing: OMX_EventPortSettingsChanged returned from OMX component", iNodeTypeId));
- iSecondPortToReconfig = aData1;
- iSecondPortReportedChange = true;
- }
- else
- {
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "PVMFOMXEncNode-%s::EventHandlerProcessing: OMX_EventPortSettingsChanged returned for port %d", iNodeTypeId, aData1));
+ // first check if dynamic reconfiguration is already in progress,
+ // if so, wait until this is completed, and then initiate the 2nd reconfiguration
+ if (iDynamicReconfigInProgress)
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
+ (0, "PVMFOMXEncNode-%s::EventHandlerProcessing: OMX_EventPortSettingsChanged returned for port %d, dynamic reconfig already in progress", iNodeTypeId, aData1));
- iProcessingState = EPVMFOMXEncNodeProcessingState_PortReconfig;
- iPortIndexForDynamicReconfig = aData1;
- iDynamicReconfigInProgress = true;
- }
+ iSecondPortToReconfig = aData1;
+ iSecondPortReportedChange = true;
+ }
+ else
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
+ (0, "PVMFOMXEncNode-%s::EventHandlerProcessing: OMX_EventPortSettingsChanged returned for port %d", iNodeTypeId, aData1));
- RunIfNotReady();
- break;
- }//end of case OMX_PortSettingsChanged
+ iProcessingState = EPVMFOMXEncNodeProcessingState_PortReconfig;
+ iPortIndexForDynamicReconfig = aData1;
+ iDynamicReconfigInProgress = true;
+ }
+
+ RunIfNotReady();
+ break;
+ }//end of case OMX_PortSettingsChanged
case OMX_EventResourcesAcquired: //not supported
- {
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "PVMFOMXEncNode-%s::EventHandlerProcessing: OMX_EventResourcesAcquired returned from OMX component - no action taken", iNodeTypeId));
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
+ (0, "PVMFOMXEncNode-%s::EventHandlerProcessing: OMX_EventResourcesAcquired returned from OMX component - no action taken", iNodeTypeId));
- RunIfNotReady();
+ RunIfNotReady();
- break;
- }
+ break;
+ }
default:
- {
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "PVMFOMXEncNode-%s::EventHandlerProcessing: Unknown Event returned from OMX component - no action taken", iNodeTypeId));
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
+ (0, "PVMFOMXEncNode-%s::EventHandlerProcessing: Unknown Event returned from OMX component - no action taken", iNodeTypeId));
- break;
- }
+ break;
+ }
}//end of switch (eEvent)
@@ -4643,170 +4643,170 @@
switch (encoder_state)
{
case OMX_StateIdle:
- {
- iCurrentEncoderState = OMX_StateIdle;
+ {
+ iCurrentEncoderState = OMX_StateIdle;
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "PVMFOMXEncNode-%s::HandleComponentStateChange: OMX_StateIdle reached", iNodeTypeId));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
+ (0, "PVMFOMXEncNode-%s::HandleComponentStateChange: OMX_StateIdle reached", iNodeTypeId));
- // this state can be reached either going from OMX_Loaded->OMX_Idle (preparing)
- // or going from OMX_Executing->OMX_Idle (stopping)
+ // this state can be reached either going from OMX_Loaded->OMX_Idle (preparing)
+ // or going from OMX_Executing->OMX_Idle (stopping)
- if ((iCurrentCommand.size() > 0) &&
+ if ((iCurrentCommand.size() > 0) &&
(iCurrentCommand.front().iCmd == PVMFOMXEncNodeCommand::PVOMXENC_NODE_CMD_PREPARE))
- {
- iProcessingState = EPVMFOMXEncNodeProcessingState_ReadyToEncode;
- SetState(EPVMFNodePrepared);
- CommandComplete(iCurrentCommand, iCurrentCommand.front(), PVMFSuccess);
- RunIfNotReady();
- }
- else if ((iCurrentCommand.size() > 0) &&
- (iCurrentCommand.front().iCmd == PVMFOMXEncNodeCommand::PVOMXENC_NODE_CMD_STOP))
- {
- // if we are stopped, we won't start until the node gets DoStart command.
- // in this case, we are ready to start sending buffers
- if (iProcessingState == EPVMFOMXEncNodeProcessingState_Stopping)
- iProcessingState = EPVMFOMXEncNodeProcessingState_ReadyToEncode;
- // if the processing state was not stopping, leave the state as it was (continue port reconfiguration)
- SetState(EPVMFNodePrepared);
- CommandComplete(iCurrentCommand, iCurrentCommand.front(), PVMFSuccess);
-
- RunIfNotReady();
- }
- else if ((iCurrentCommand.size() > 0) &&
- (iCurrentCommand.front().iCmd == PVMFOMXEncNodeCommand::PVOMXENC_NODE_CMD_FLUSH))
- {
- // if there is a flush, similar to the case of stop, we won't start until the node gets
- // DoStart command. In this case, we'll be ready
- if (iProcessingState == EPVMFOMXEncNodeProcessingState_Stopping)
- iProcessingState = EPVMFOMXEncNodeProcessingState_ReadyToEncode;
-
-
-
- //Flush is complete. Go to prepared state.
- SetState(EPVMFNodePrepared);
- //resume port input (if possible) so the ports can be re-started.
- if (iInPort)
{
- iInPort->ResumeInput();
+ iProcessingState = EPVMFOMXEncNodeProcessingState_ReadyToEncode;
+ SetState(EPVMFNodePrepared);
+ CommandComplete(iCurrentCommand, iCurrentCommand.front(), PVMFSuccess);
+ RunIfNotReady();
}
- if (iOutPort)
+ else if ((iCurrentCommand.size() > 0) &&
+ (iCurrentCommand.front().iCmd == PVMFOMXEncNodeCommand::PVOMXENC_NODE_CMD_STOP))
{
- iOutPort->ResumeInput();
- }
- CommandComplete(iCurrentCommand, iCurrentCommand.front(), PVMFSuccess);
- RunIfNotReady();
+ // if we are stopped, we won't start until the node gets DoStart command.
+ // in this case, we are ready to start sending buffers
+ if (iProcessingState == EPVMFOMXEncNodeProcessingState_Stopping)
+ iProcessingState = EPVMFOMXEncNodeProcessingState_ReadyToEncode;
+ // if the processing state was not stopping, leave the state as it was (continue port reconfiguration)
+ SetState(EPVMFNodePrepared);
+ CommandComplete(iCurrentCommand, iCurrentCommand.front(), PVMFSuccess);
- }
- else if ((iCurrentCommand.size() > 0) &&
- (iCurrentCommand.front().iCmd == PVMFOMXEncNodeCommand::PVOMXENC_NODE_CMD_RESET))
- {
- // State change to Idle was initiated due to Reset. First need to reach idle, and then loaded
- // Once Idle is reached, we need to initiate idle->loaded transition
- iStopInResetMsgSent = false;
- RunIfNotReady();
- }
- break;
- }//end of case OMX_StateIdle
+ RunIfNotReady();
+ }
+ else if ((iCurrentCommand.size() > 0) &&
+ (iCurrentCommand.front().iCmd == PVMFOMXEncNodeCommand::PVOMXENC_NODE_CMD_FLUSH))
+ {
+ // if there is a flush, similar to the case of stop, we won't start until the node gets
+ // DoStart command. In this case, we'll be ready
+ if (iProcessingState == EPVMFOMXEncNodeProcessingState_Stopping)
+ iProcessingState = EPVMFOMXEncNodeProcessingState_ReadyToEncode;
+
+
+
+ //Flush is complete. Go to prepared state.
+ SetState(EPVMFNodePrepared);
+ //resume port input (if possible) so the ports can be re-started.
+ if (iInPort)
+ {
+ iInPort->ResumeInput();
+ }
+ if (iOutPort)
+ {
+ iOutPort->ResumeInput();
+ }
+ CommandComplete(iCurrentCommand, iCurrentCommand.front(), PVMFSuccess);
+ RunIfNotReady();
+
+ }
+ else if ((iCurrentCommand.size() > 0) &&
+ (iCurrentCommand.front().iCmd == PVMFOMXEncNodeCommand::PVOMXENC_NODE_CMD_RESET))
+ {
+ // State change to Idle was initiated due to Reset. First need to reach idle, and then loaded
+ // Once Idle is reached, we need to initiate idle->loaded transition
+ iStopInResetMsgSent = false;
+ RunIfNotReady();
+ }
+ break;
+ }//end of case OMX_StateIdle
case OMX_StateExecuting:
- {
- iCurrentEncoderState = OMX_StateExecuting;
-
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "PVMFOMXEncNode-%s::HandleComponentStateChange: OMX_StateExecuting reached", iNodeTypeId));
-
- // this state can be reached going from OMX_Idle -> OMX_Executing (preparing)
- // or going from OMX_Pause -> OMX_Executing (coming from pause)
- // either way, this is a response to "DoStart" command
-
- if ((iCurrentCommand.size() > 0) &&
- (iCurrentCommand.front().iCmd == PVMFOMXEncNodeCommand::PVOMXENC_NODE_CMD_START))
{
- SetState(EPVMFNodeStarted);
- CommandComplete(iCurrentCommand, iCurrentCommand.front(), PVMFSuccess);
+ iCurrentEncoderState = OMX_StateExecuting;
- RunIfNotReady();
- }
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
+ (0, "PVMFOMXEncNode-%s::HandleComponentStateChange: OMX_StateExecuting reached", iNodeTypeId));
- break;
- }//end of case OMX_StateExecuting
+ // this state can be reached going from OMX_Idle -> OMX_Executing (preparing)
+ // or going from OMX_Pause -> OMX_Executing (coming from pause)
+ // either way, this is a response to "DoStart" command
+
+ if ((iCurrentCommand.size() > 0) &&
+ (iCurrentCommand.front().iCmd == PVMFOMXEncNodeCommand::PVOMXENC_NODE_CMD_START))
+ {
+ SetState(EPVMFNodeStarted);
+ CommandComplete(iCurrentCommand, iCurrentCommand.front(), PVMFSuccess);
+
+ RunIfNotReady();
+ }
+
+ break;
+ }//end of case OMX_StateExecuting
case OMX_StatePause:
- {
- iCurrentEncoderState = OMX_StatePause;
-
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "PVMFOMXEncNode-%s::HandleComponentStateChange: OMX_StatePause reached", iNodeTypeId));
-
-
- // This state can be reached going from OMX_Executing-> OMX_Pause
- if ((iCurrentCommand.size() > 0) &&
- (iCurrentCommand.front().iCmd == PVMFOMXEncNodeCommand::PVOMXENC_NODE_CMD_PAUSE))
{
- SetState(EPVMFNodePaused);
- CommandComplete(iCurrentCommand, iCurrentCommand.front(), PVMFSuccess);
- RunIfNotReady();
- }
+ iCurrentEncoderState = OMX_StatePause;
- break;
- }//end of case OMX_StatePause
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
+ (0, "PVMFOMXEncNode-%s::HandleComponentStateChange: OMX_StatePause reached", iNodeTypeId));
+
+
+ // This state can be reached going from OMX_Executing-> OMX_Pause
+ if ((iCurrentCommand.size() > 0) &&
+ (iCurrentCommand.front().iCmd == PVMFOMXEncNodeCommand::PVOMXENC_NODE_CMD_PAUSE))
+ {
+ SetState(EPVMFNodePaused);
+ CommandComplete(iCurrentCommand, iCurrentCommand.front(), PVMFSuccess);
+ RunIfNotReady();
+ }
+
+ break;
+ }//end of case OMX_StatePause
case OMX_StateLoaded:
- {
- iCurrentEncoderState = OMX_StateLoaded;
-
- // this state can be reached only going from OMX_Idle ->OMX_Loaded (stopped to reset)
- //
-
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "PVMFOMXEncNode-%s::HandleComponentStateChange: OMX_StateLoaded reached", iNodeTypeId));
- //Check if command's responce is pending
- if ((iCurrentCommand.size() > 0) &&
- (iCurrentCommand.front().iCmd == PVMFOMXEncNodeCommand::PVOMXENC_NODE_CMD_RESET))
{
+ iCurrentEncoderState = OMX_StateLoaded;
- // move this here
- if (iInPort)
+ // this state can be reached only going from OMX_Idle ->OMX_Loaded (stopped to reset)
+ //
+
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
+ (0, "PVMFOMXEncNode-%s::HandleComponentStateChange: OMX_StateLoaded reached", iNodeTypeId));
+ //Check if command's responce is pending
+ if ((iCurrentCommand.size() > 0) &&
+ (iCurrentCommand.front().iCmd == PVMFOMXEncNodeCommand::PVOMXENC_NODE_CMD_RESET))
{
- OSCL_DELETE(((PVMFOMXEncPort*)iInPort));
- iInPort = NULL;
+
+ // move this here
+ if (iInPort)
+ {
+ OSCL_DELETE(((PVMFOMXEncPort*)iInPort));
+ iInPort = NULL;
+ }
+
+ if (iOutPort)
+ {
+ OSCL_DELETE(((PVMFOMXEncPort*)iOutPort));
+ iOutPort = NULL;
+ }
+
+ iDataIn.Unbind();
+
+ // Reset the metadata key list
+ iAvailableMetadataKeys.clear();
+
+
+ iProcessingState = EPVMFOMXEncNodeProcessingState_Idle;
+ //logoff & go back to Created state.
+ SetState(EPVMFNodeIdle);
+ CommandComplete(iCurrentCommand, iCurrentCommand.front(), PVMFSuccess);
+ iResetInProgress = false;
+ iResetMsgSent = false;
}
- if (iOutPort)
- {
- OSCL_DELETE(((PVMFOMXEncPort*)iOutPort));
- iOutPort = NULL;
- }
-
- iDataIn.Unbind();
-
- // Reset the metadata key list
- iAvailableMetadataKeys.clear();
-
-
- iProcessingState = EPVMFOMXEncNodeProcessingState_Idle;
- //logoff & go back to Created state.
- SetState(EPVMFNodeIdle);
- CommandComplete(iCurrentCommand, iCurrentCommand.front(), PVMFSuccess);
- iResetInProgress = false;
- iResetMsgSent = false;
- }
-
- break;
- }//end of case OMX_StateLoaded
+ break;
+ }//end of case OMX_StateLoaded
case OMX_StateInvalid:
default:
- {
- iCurrentEncoderState = OMX_StateInvalid;
+ {
+ iCurrentEncoderState = OMX_StateInvalid;
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_ERR,
- (0, "PVMFOMXEncNode-%s::HandleComponentStateChange: OMX_StateInvalid reached", iNodeTypeId));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_ERR,
+ (0, "PVMFOMXEncNode-%s::HandleComponentStateChange: OMX_StateInvalid reached", iNodeTypeId));
- break;
- }//end of case OMX_StateInvalid
+ break;
+ }//end of case OMX_StateInvalid
}//end of switch(encoder_state)
@@ -4821,8 +4821,8 @@
////////////////////// CALLBACK PROCESSING FOR EMPTY BUFFER DONE - input buffer was consumed
/////////////////////////////////////////////////////////////////////////////
OMX_ERRORTYPE PVMFOMXEncNode::EmptyBufferDoneProcessing(OMX_OUT OMX_HANDLETYPE aComponent,
- OMX_OUT OMX_PTR aAppData,
- OMX_OUT OMX_BUFFERHEADERTYPE* aBuffer)
+ OMX_OUT OMX_PTR aAppData,
+ OMX_OUT OMX_BUFFERHEADERTYPE* aBuffer)
{
OSCL_UNUSED_ARG(aComponent);
@@ -4831,7 +4831,7 @@
(0, "PVMFOMXEncNode-%s::EmptyBufferDoneProcessing: In", iNodeTypeId));
OSCL_ASSERT((void*) aComponent == (void*) iOMXEncoder); // component should match the component
- OSCL_ASSERT(aAppData == (OMX_PTR)(this)); // AppData should represent this node ptr
+ OSCL_ASSERT(aAppData == (OMX_PTR)(this)); // AppData should represent this node ptr
// first, get the buffer "context", i.e. pointer to application private data that contains the
// address of the mempool buffer (so that it can be released)
@@ -4856,8 +4856,8 @@
// input buffer is to be released,
// refcount needs to be decremented (possibly - the input msg associated with the buffer will be unbound)
// NOTE: in case of "moveable" input buffers (passed into component without copying), unbinding decrements a refcount which eventually results
- // in input message being released back to upstream mempool once all its fragments are returned
- // in case of input buffers passed into component by copying, unbinding has no effect
+ // in input message being released back to upstream mempool once all its fragments are returned
+ // in case of input buffers passed into component by copying, unbinding has no effect
PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
(0, "PVMFOMXEncNode-%s::EmptyBufferDoneProcessing: Release input buffer (with %d refcount remaining of input message)", iNodeTypeId, (pContext->pMediaData).get_count() - 1));
@@ -4882,8 +4882,8 @@
////////////////////// CALLBACK PROCESSING FOR FILL BUFFER DONE - output buffer is ready
/////////////////////////////////////////////////////////////////////////////
OMX_ERRORTYPE PVMFOMXEncNode::FillBufferDoneProcessing(OMX_OUT OMX_HANDLETYPE aComponent,
- OMX_OUT OMX_PTR aAppData,
- OMX_OUT OMX_BUFFERHEADERTYPE* aBuffer)
+ OMX_OUT OMX_PTR aAppData,
+ OMX_OUT OMX_BUFFERHEADERTYPE* aBuffer)
{
OSCL_UNUSED_ARG(aComponent);
@@ -4892,7 +4892,7 @@
(0, "PVMFOMXEncNode-%s::FillBufferDoneProcessing: In", iNodeTypeId));
OSCL_ASSERT((void*) aComponent == (void*) iOMXEncoder); // component should match the component
- OSCL_ASSERT(aAppData == (OMX_PTR)(this)); // AppData should represent this node ptr
+ OSCL_ASSERT(aAppData == (OMX_PTR)(this)); // AppData should represent this node ptr
// first, get the buffer "context", i.e. pointer to application private data that contains the
// address of the mempool buffer (so that it can be released)
@@ -4911,7 +4911,7 @@
}
if ( ((iOutFormat == PVMF_MIME_H264_VIDEO_MP4) || (iOutFormat == PVMF_MIME_H264_VIDEO_RAW ))
- && (iOMXComponentUsesNALStartCodes))
+ && (iOMXComponentUsesNALStartCodes))
{
// find size of first start code, since it can be either 3 or 4 bytes
uint8* pData = (uint8*)aBuffer->pBuffer + aBuffer->nOffset;
@@ -4959,7 +4959,7 @@
// in case of mp4 streaming and the very 1st buffer, save vol header separately
if ((iOutFormat == PVMF_MIME_M4V) && (iVideoEncodeParam.iContentType == EI_M4V_STREAMING)
- && (iFrameCounter == 1))
+ && (iFrameCounter == 1))
{
// save the first buffer since this is the VOL header
@@ -4988,11 +4988,11 @@
if (iFrameCounter == 1)
{
if ((iOutFormat == PVMF_MIME_ADTS)
- || (iOutFormat == PVMF_MIME_ADIF)
- || (iOutFormat == PVMF_MIME_MPEG4_AUDIO)
- || (iOutFormat == PVMF_MIME_WMA)
- || (iOutFormat == PVMF_MIME_WMV)
- )
+ || (iOutFormat == PVMF_MIME_ADIF)
+ || (iOutFormat == PVMF_MIME_MPEG4_AUDIO)
+ || (iOutFormat == PVMF_MIME_WMA)
+ || (iOutFormat == PVMF_MIME_WMV)
+ )
{
// save the first buffer since this is the config header and needs to be sent separately
@@ -5119,11 +5119,11 @@
// adjust ptr to data to expose the NAL sync word if necessary
if ((iOutFormat == PVMF_MIME_H264_VIDEO_RAW) &&
- (iOMXComponentSupportsExternalOutputBufferAlloc) &&
- (!iOMXComponentUsesFullAVCFrames) &&
- (!iOMXComponentUsesNALStartCodes) &&
- ((iFirstNAL == true) || (iEndOfNALFlagPrevious != 0))
- )
+ (iOMXComponentSupportsExternalOutputBufferAlloc) &&
+ (!iOMXComponentUsesFullAVCFrames) &&
+ (!iOMXComponentUsesNALStartCodes) &&
+ ((iFirstNAL == true) || (iEndOfNALFlagPrevious != 0))
+ )
{
pBufdata -= 4;
bufLen += 4;
@@ -5135,9 +5135,9 @@
// wrap the buffer into the MediaDataImpl wrapper, and queue it for sending downstream
// wrapping will create a refcounter. When refcounter goes to 0 i.e. when media data
// is released in downstream components, the custom deallocator will automatically release the buffer back to the
- // mempool. To do that, the deallocator needs to have info about Context
+ // mempool. To do that, the deallocator needs to have info about Context
// NOTE: we had to wait until now to wrap the buffer data because we only know
- // now where the actual data is located (based on buffer offset)
+ // now where the actual data is located (based on buffer offset)
OsclSharedPtr<PVMFMediaDataImpl> MediaDataCurr = WrapOutputBuffer(pBufdata, bufLen, pContext);
// if you can't get the MediaDataCurr, release the buffer back to the pool
@@ -5154,10 +5154,10 @@
//DV - NOTE:
//In case of AVC, OMX_EndOfFrameFlag is used to mark the end of NAL
- // End of frame is determined by comparing timestamps
- // As a consequence, there is a lag of one buffer
- // i.e. we send/queue the previous buffer and keep the current one so that
- // When the next buffer arrives, we can compare timestamps etc.
+ // End of frame is determined by comparing timestamps
+ // As a consequence, there is a lag of one buffer
+ // i.e. we send/queue the previous buffer and keep the current one so that
+ // When the next buffer arrives, we can compare timestamps etc.
// In case of MP4, OMX_EndOFFrameFlag is used to mark end of frame and there is no lag
@@ -5195,7 +5195,7 @@
MediaDataOut = MediaDataCurr;
// record timestamp, flags etc.
iTimeStampOut = aBuffer->nTimeStamp;
- if( bIsQCOMOmxComp )
+ if( bIsQCOMOmxComp )
{
iTimeStampOut /= 1000;
}
@@ -5238,8 +5238,8 @@
// if EOS and AVC (with a lag), queue also the last buffer
if ((aBuffer->nFlags & OMX_BUFFERFLAG_EOS) &&
- ((iOutFormat == PVMF_MIME_H264_VIDEO_MP4) || (iOutFormat == PVMF_MIME_H264_VIDEO_RAW))
- )
+ ((iOutFormat == PVMF_MIME_H264_VIDEO_MP4) || (iOutFormat == PVMF_MIME_H264_VIDEO_RAW))
+ )
{
MediaDataOut = iPreviousMediaData; // send out previous media data
@@ -5420,7 +5420,7 @@
// create a deallocator and pass the buffer_allocator to it as well as pointer to data that needs to be returned to the mempool
PVOMXEncBufferSharedPtrWrapperCombinedCleanupDA *cleanup_ptr =
- OSCL_PLACEMENT_NEW(my_ptr + aligned_refcnt_size, PVOMXEncBufferSharedPtrWrapperCombinedCleanupDA(iOutBufMemoryPool, pContext));
+ OSCL_PLACEMENT_NEW(my_ptr + aligned_refcnt_size, PVOMXEncBufferSharedPtrWrapperCombinedCleanupDA(iOutBufMemoryPool, pContext));
// create the ref counter after the cleanup object (refcount is set to 1 at creation)
OsclRefCounterDA *my_refcnt;
@@ -5550,7 +5550,7 @@
void PVMFOMXEncNode::CommandComplete(PVMFOMXEncNodeCmdQ& aCmdQ, PVMFOMXEncNodeCommand& aCmd, PVMFStatus aStatus, OsclAny* aEventData)
{
PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "PVMFOMXEncNode-%s::CommandComplete Id %d Cmd %d Status %d Context %d Data %d", iNodeTypeId
- , aCmd.iId, aCmd.iCmd, aStatus, aCmd.iContext, aEventData));
+ , aCmd.iId, aCmd.iCmd, aStatus, aCmd.iContext, aEventData));
//create response
PVMFCmdResp resp(aCmd.iId, aCmd.iContext, aStatus, aEventData);
@@ -5570,11 +5570,11 @@
switch (iInterfaceState)
{
case EPVMFNodeIdle:
- {
- SetState(EPVMFNodeInitialized);
- CommandComplete(iInputCommands, aCmd, PVMFSuccess);
- break;
- }
+ {
+ SetState(EPVMFNodeInitialized);
+ CommandComplete(iInputCommands, aCmd, PVMFSuccess);
+ break;
+ }
default:
CommandComplete(iInputCommands, aCmd, PVMFErrInvalidState);
@@ -5591,453 +5591,453 @@
switch (iInterfaceState)
{
case EPVMFNodeInitialized:
- {
- if (NULL == iInPort)
{
- CommandComplete(iInputCommands, aCmd, PVMFFailure);
- }
+ if (NULL == iInPort)
+ {
+ CommandComplete(iInputCommands, aCmd, PVMFFailure);
+ }
- // by now the encode parameters have been set
+ // by now the encode parameters have been set
- if (iOutFormat == PVMF_MIME_H2631998 ||
+ if (iOutFormat == PVMF_MIME_H2631998 ||
iOutFormat == PVMF_MIME_H2632000)
- {
- Role = (OMX_STRING)"video_encoder.h263";
- iNodeTypeId = LOG_ID_VIDEO_H263;
- }
- else if (iOutFormat == PVMF_MIME_M4V)
- {
- Role = (OMX_STRING)"video_encoder.mpeg4";
- iNodeTypeId = LOG_ID_VIDEO_M4V;
- }
- else if (iOutFormat == PVMF_MIME_H264_VIDEO_RAW ||
- iOutFormat == PVMF_MIME_H264_VIDEO_MP4)
- {
- Role = (OMX_STRING)"video_encoder.avc";
- iNodeTypeId = LOG_ID_VIDEO_AVC;
- iFirstNAL = true; // set this flag to prevent node from queueing the first
- // buffer
- }
- else if ((iOutFormat == PVMF_MIME_AMR_IETF) ||
- (iOutFormat == PVMF_MIME_AMR_IF2))
- {
- Role = (OMX_STRING)"audio_encoder.amrnb";
- iNodeTypeId = LOG_ID_AUDIO_AMRNB;
- }
- else if (iOutFormat == PVMF_MIME_AMRWB_IETF)
- {
- Role = (OMX_STRING)"audio_encoder.amrwb";
- iNodeTypeId = LOG_ID_AUDIO_AMRWB;
- }
- else if (iOutFormat == PVMF_MIME_ADTS ||
- iOutFormat == PVMF_MIME_ADIF ||
- iOutFormat == PVMF_MIME_MPEG4_AUDIO)
- {
- Role = (OMX_STRING)"audio_encoder.aac";
- iNodeTypeId = LOG_ID_AUDIO_AAC;
- }
- else
- {
- // Illegal codec specified.
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "PVMFOMXEncNode-%s::DoPrepare() Input port format other then codec type", iNodeTypeId));
- CommandComplete(iInputCommands, aCmd, PVMFErrArgument);
- return;
- }
-
-
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG,
- (0, "PVMFOMXEncNode-%s::Initializing OMX component and encoder for role %s", iNodeTypeId, Role));
-
- /* Set callback structure */
- iCallbacks.EventHandler = CallbackEventHandlerEnc; //event_handler;
- iCallbacks.EmptyBufferDone = CallbackEmptyBufferDoneEnc; //empty_buffer_done;
- iCallbacks.FillBufferDone = CallbackFillBufferDoneEnc; //fill_buffer_done;
-
-
- // determine components which can fit the role
- // then, create the component. If multiple components fit the role,
- // the first one registered will be selected. If that one fails to
- // be created, the second one in the list is selected etc.
- OMX_U32 num_comps = 0;
- OMX_STRING *CompOfRole;
- OMX_S8 CompName[PV_OMX_MAX_COMPONENT_NAME_LENGTH];
- // call once to find out the number of components that can fit the role
- OMX_GetComponentsOfRole(Role, &num_comps, NULL);
- uint32 ii;
-
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG,
- (0, "PVMFOMXEncNode-%s::DoPrepare(): There are %d components of role %s ", iNodeTypeId, num_comps, Role));
-
- if (num_comps > 0)
- {
- CompOfRole = (OMX_STRING *)oscl_malloc(num_comps * sizeof(OMX_STRING));
-
- for (ii = 0; ii < num_comps; ii++)
- CompOfRole[ii] = (OMX_STRING) oscl_malloc(PV_OMX_MAX_COMPONENT_NAME_LENGTH * sizeof(OMX_U8));
-
- // call 2nd time to get the component names
- OMX_GetComponentsOfRole(Role, &num_comps, (OMX_U8 **)CompOfRole);
-
- for (ii = 0; ii < num_comps; ii++)
{
- // try to create component
- err = OMX_GetHandle(&iOMXEncoder, (OMX_STRING) CompOfRole[ii], (OMX_PTR) this, (OMX_CALLBACKTYPE *) & iCallbacks);
- // if successful, no need to continue
- if ((err == OMX_ErrorNone) && (iOMXEncoder != NULL))
- {
- oscl_strncpy((OMX_STRING)CompName, (OMX_STRING) CompOfRole[ii], PV_OMX_MAX_COMPONENT_NAME_LENGTH);
-
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG,
- (0, "PVMFOMXEncNode-%s::DoPrepare(): Got Component %s handle ", iNodeTypeId, CompOfRole[ii]));
-
- break;
- }
- else
- {
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG,
- (0, "PVMFOMXEncNode-%s::DoPrepare(): Cannot get component %s handle, try another component if available", iNodeTypeId, CompOfRole[ii]));
- }
-
+ Role = (OMX_STRING)"video_encoder.h263";
+ iNodeTypeId = LOG_ID_VIDEO_H263;
}
- // whether successful or not, need to free CompOfRoles
- for (ii = 0; ii < num_comps; ii++)
+ else if (iOutFormat == PVMF_MIME_M4V)
{
- oscl_free(CompOfRole[ii]);
- CompOfRole[ii] = NULL;
+ Role = (OMX_STRING)"video_encoder.mpeg4";
+ iNodeTypeId = LOG_ID_VIDEO_M4V;
+ }
+ else if (iOutFormat == PVMF_MIME_H264_VIDEO_RAW ||
+ iOutFormat == PVMF_MIME_H264_VIDEO_MP4)
+ {
+ Role = (OMX_STRING)"video_encoder.avc";
+ iNodeTypeId = LOG_ID_VIDEO_AVC;
+ iFirstNAL = true; // set this flag to prevent node from queueing the first
+ // buffer
+ }
+ else if ((iOutFormat == PVMF_MIME_AMR_IETF) ||
+ (iOutFormat == PVMF_MIME_AMR_IF2))
+ {
+ Role = (OMX_STRING)"audio_encoder.amrnb";
+ iNodeTypeId = LOG_ID_AUDIO_AMRNB;
+ }
+ else if (iOutFormat == PVMF_MIME_AMRWB_IETF)
+ {
+ Role = (OMX_STRING)"audio_encoder.amrwb";
+ iNodeTypeId = LOG_ID_AUDIO_AMRWB;
+ }
+ else if (iOutFormat == PVMF_MIME_ADTS ||
+ iOutFormat == PVMF_MIME_ADIF ||
+ iOutFormat == PVMF_MIME_MPEG4_AUDIO)
+ {
+ Role = (OMX_STRING)"audio_encoder.aac";
+ iNodeTypeId = LOG_ID_AUDIO_AAC;
+ }
+ else
+ {
+ // Illegal codec specified.
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "PVMFOMXEncNode-%s::DoPrepare() Input port format other then codec type", iNodeTypeId));
+ CommandComplete(iInputCommands, aCmd, PVMFErrArgument);
+ return;
}
- oscl_free(CompOfRole);
- // check if there was a problem
- if ((err != OMX_ErrorNone) || (iOMXEncoder == NULL))
+
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG,
+ (0, "PVMFOMXEncNode-%s::Initializing OMX component and encoder for role %s", iNodeTypeId, Role));
+
+ /* Set callback structure */
+ iCallbacks.EventHandler = CallbackEventHandlerEnc; //event_handler;
+ iCallbacks.EmptyBufferDone = CallbackEmptyBufferDoneEnc; //empty_buffer_done;
+ iCallbacks.FillBufferDone = CallbackFillBufferDoneEnc; //fill_buffer_done;
+
+
+ // determine components which can fit the role
+ // then, create the component. If multiple components fit the role,
+ // the first one registered will be selected. If that one fails to
+ // be created, the second one in the list is selected etc.
+ OMX_U32 num_comps = 0;
+ OMX_STRING *CompOfRole;
+ OMX_S8 CompName[PV_OMX_MAX_COMPONENT_NAME_LENGTH];
+ // call once to find out the number of components that can fit the role
+ OMX_GetComponentsOfRole(Role, &num_comps, NULL);
+ uint32 ii;
+
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG,
+ (0, "PVMFOMXEncNode-%s::DoPrepare(): There are %d components of role %s ", iNodeTypeId, num_comps, Role));
+
+ if (num_comps > 0)
+ {
+ CompOfRole = (OMX_STRING *)oscl_malloc(num_comps * sizeof(OMX_STRING));
+
+ for (ii = 0; ii < num_comps; ii++)
+ CompOfRole[ii] = (OMX_STRING) oscl_malloc(PV_OMX_MAX_COMPONENT_NAME_LENGTH * sizeof(OMX_U8));
+
+ // call 2nd time to get the component names
+ OMX_GetComponentsOfRole(Role, &num_comps, (OMX_U8 **)CompOfRole);
+
+ for (ii = 0; ii < num_comps; ii++)
+ {
+ // try to create component
+ err = OMX_GetHandle(&iOMXEncoder, (OMX_STRING) CompOfRole[ii], (OMX_PTR) this, (OMX_CALLBACKTYPE *) & iCallbacks);
+ // if successful, no need to continue
+ if ((err == OMX_ErrorNone) && (iOMXEncoder != NULL))
+ {
+ oscl_strncpy((OMX_STRING)CompName, (OMX_STRING) CompOfRole[ii], PV_OMX_MAX_COMPONENT_NAME_LENGTH);
+
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG,
+ (0, "PVMFOMXEncNode-%s::DoPrepare(): Got Component %s handle ", iNodeTypeId, CompOfRole[ii]));
+
+ break;
+ }
+ else
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG,
+ (0, "PVMFOMXEncNode-%s::DoPrepare(): Cannot get component %s handle, try another component if available", iNodeTypeId, CompOfRole[ii]));
+ }
+
+ }
+ // whether successful or not, need to free CompOfRoles
+ for (ii = 0; ii < num_comps; ii++)
+ {
+ oscl_free(CompOfRole[ii]);
+ CompOfRole[ii] = NULL;
+ }
+
+ oscl_free(CompOfRole);
+ // check if there was a problem
+ if ((err != OMX_ErrorNone) || (iOMXEncoder == NULL))
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
+ (0, "PVMFOMXEncNode-%s::Can't get handle for encoder!", iNodeTypeId));
+ iOMXEncoder = NULL;
+ CommandComplete(iInputCommands, aCmd, PVMFErrResource);
+ return;
+ }
+ }
+ else
{
PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
- (0, "PVMFOMXEncNode-%s::Can't get handle for encoder!", iNodeTypeId));
+ (0, "PVMFOMXEncNode-%s::No component can handle role %s !", iNodeTypeId, Role));
iOMXEncoder = NULL;
CommandComplete(iInputCommands, aCmd, PVMFErrResource);
return;
}
- }
- else
- {
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
- (0, "PVMFOMXEncNode-%s::No component can handle role %s !", iNodeTypeId, Role));
- iOMXEncoder = NULL;
- CommandComplete(iInputCommands, aCmd, PVMFErrResource);
- return;
- }
- if (!iOMXEncoder)
- {
- CommandComplete(iInputCommands, aCmd, PVMFErrNoResources);
- return;
- }
+ if (!iOMXEncoder)
+ {
+ CommandComplete(iInputCommands, aCmd, PVMFErrNoResources);
+ return;
+ }
- // find out how many roles the component supports
- OMX_U32 NumRoles;
- err = OMX_GetRolesOfComponent((OMX_STRING)CompName, &NumRoles, NULL);
- if (err != OMX_ErrorNone)
- {
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
- (0, "PVMFOMXEncNode-%s::DoPrepare() Problem getting component roles", iNodeTypeId));
-
- CommandComplete(iInputCommands, aCmd, PVMFErrResource);
- return;
- }
-
- if( ( 0 == oscl_strcmp((char*)CompName, "OMX.qcom.video.encoder.h263") )
- || ( 0 == oscl_strcmp((char*)CompName, "OMX.qcom.video.encoder.mpeg4") ) )
- {
- bIsQCOMOmxComp = true;
- }
- else
- {
- bIsQCOMOmxComp = false;
- }
-
- // if the component supports multiple roles, call OMX_SetParameter
- if (NumRoles > 1)
- {
- OMX_PARAM_COMPONENTROLETYPE RoleParam;
- CONFIG_SIZE_AND_VERSION(RoleParam);
- oscl_strncpy((OMX_STRING)RoleParam.cRole, (OMX_STRING)Role, OMX_MAX_STRINGNAME_SIZE);
- err = OMX_SetParameter(iOMXEncoder, OMX_IndexParamStandardComponentRole, &RoleParam);
+ // find out how many roles the component supports
+ OMX_U32 NumRoles;
+ err = OMX_GetRolesOfComponent((OMX_STRING)CompName, &NumRoles, NULL);
if (err != OMX_ErrorNone)
{
PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
- (0, "PVMFOMXEncNode-%s::DoPrepare() Problem setting component role", iNodeTypeId));
+ (0, "PVMFOMXEncNode-%s::DoPrepare() Problem getting component roles", iNodeTypeId));
CommandComplete(iInputCommands, aCmd, PVMFErrResource);
return;
}
- }
+
+ if( ( 0 == oscl_strcmp((char*)CompName, "OMX.qcom.video.encoder.h263") )
+ || ( 0 == oscl_strcmp((char*)CompName, "OMX.qcom.video.encoder.mpeg4") ) )
+ {
+ bIsQCOMOmxComp = true;
+ }
+ else
+ {
+ bIsQCOMOmxComp = false;
+ }
+
+ // if the component supports multiple roles, call OMX_SetParameter
+ if (NumRoles > 1)
+ {
+ OMX_PARAM_COMPONENTROLETYPE RoleParam;
+ CONFIG_SIZE_AND_VERSION(RoleParam);
+ oscl_strncpy((OMX_STRING)RoleParam.cRole, (OMX_STRING)Role, OMX_MAX_STRINGNAME_SIZE);
+ err = OMX_SetParameter(iOMXEncoder, OMX_IndexParamStandardComponentRole, &RoleParam);
+ if (err != OMX_ErrorNone)
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
+ (0, "PVMFOMXEncNode-%s::DoPrepare() Problem setting component role", iNodeTypeId));
+
+ CommandComplete(iInputCommands, aCmd, PVMFErrResource);
+ return;
+ }
+ }
- // GET CAPABILITY FLAGS FROM PV COMPONENT, IF this fails, use defaults
- PV_OMXComponentCapabilityFlagsType Cap_flags;
- err = OMX_GetParameter(iOMXEncoder, (OMX_INDEXTYPE) PV_OMX_COMPONENT_CAPABILITY_TYPE_INDEX, &Cap_flags);
- if (err != OMX_ErrorNone)
- {
- SetDefaultCapabilityFlags();
- }
- else
- {
- iIsOMXComponentMultiThreaded = (OMX_TRUE == Cap_flags.iIsOMXComponentMultiThreaded) ? true : false;
- iOMXComponentSupportsExternalInputBufferAlloc = (OMX_TRUE == Cap_flags.iOMXComponentSupportsExternalInputBufferAlloc) ? true : false;
- iOMXComponentSupportsExternalOutputBufferAlloc = (OMX_TRUE == Cap_flags.iOMXComponentSupportsExternalOutputBufferAlloc) ? true : false;
- iOMXComponentSupportsMovableInputBuffers = (OMX_TRUE == Cap_flags.iOMXComponentSupportsMovableInputBuffers) ? true : false;
- iOMXComponentSupportsPartialFrames = (OMX_TRUE == Cap_flags.iOMXComponentSupportsPartialFrames) ? true : false;
- iOMXComponentUsesNALStartCodes = (OMX_TRUE == Cap_flags.iOMXComponentUsesNALStartCodes) ? true : false;
- iOMXComponentCanHandleIncompleteFrames = (OMX_TRUE == Cap_flags.iOMXComponentCanHandleIncompleteFrames) ? true : false;
- iOMXComponentUsesFullAVCFrames = (OMX_TRUE == Cap_flags.iOMXComponentUsesFullAVCFrames) ? true : false;
- }
+ // GET CAPABILITY FLAGS FROM PV COMPONENT, IF this fails, use defaults
+ PV_OMXComponentCapabilityFlagsType Cap_flags;
+ err = OMX_GetParameter(iOMXEncoder, (OMX_INDEXTYPE) PV_OMX_COMPONENT_CAPABILITY_TYPE_INDEX, &Cap_flags);
+ if (err != OMX_ErrorNone)
+ {
+ SetDefaultCapabilityFlags();
+ }
+ else
+ {
+ iIsOMXComponentMultiThreaded = (OMX_TRUE == Cap_flags.iIsOMXComponentMultiThreaded) ? true : false;
+ iOMXComponentSupportsExternalInputBufferAlloc = (OMX_TRUE == Cap_flags.iOMXComponentSupportsExternalInputBufferAlloc) ? true : false;
+ iOMXComponentSupportsExternalOutputBufferAlloc = (OMX_TRUE == Cap_flags.iOMXComponentSupportsExternalOutputBufferAlloc) ? true : false;
+ iOMXComponentSupportsMovableInputBuffers = (OMX_TRUE == Cap_flags.iOMXComponentSupportsMovableInputBuffers) ? true : false;
+ iOMXComponentSupportsPartialFrames = (OMX_TRUE == Cap_flags.iOMXComponentSupportsPartialFrames) ? true : false;
+ iOMXComponentUsesNALStartCodes = (OMX_TRUE == Cap_flags.iOMXComponentUsesNALStartCodes) ? true : false;
+ iOMXComponentCanHandleIncompleteFrames = (OMX_TRUE == Cap_flags.iOMXComponentCanHandleIncompleteFrames) ? true : false;
+ iOMXComponentUsesFullAVCFrames = (OMX_TRUE == Cap_flags.iOMXComponentUsesFullAVCFrames) ? true : false;
+ }
- /* iOMXComponentUsesNALStartCodes: The component inserts start codes before NALs
+ /* iOMXComponentUsesNALStartCodes: The component inserts start codes before NALs
- iOMXComponentUsesFullAVCFrames
- && !iOMXComponentUsesNALStartCodes: The component outputs full frames, and stores NAL start codes using the
- OMX ExtraData structure in the output buffer
- iOMXComponentUsesFullAVCFrames
- && iOMXComponentUsesNALStartCodes: The component outputs full frames, and delimits NALs by their start codes
+ iOMXComponentUsesFullAVCFrames
+ && !iOMXComponentUsesNALStartCodes: The component outputs full frames, and stores NAL start codes using the
+ OMX ExtraData structure in the output buffer
+ iOMXComponentUsesFullAVCFrames
+ && iOMXComponentUsesNALStartCodes: The component outputs full frames, and delimits NALs by their start codes
- iOutFormat == PVMF_MIME_H264_VIDEO_RAW
- && !iOMXComponentUsesNALStartCodes: The node inserts the start codes and hides them / exposes them when needed
+ iOutFormat == PVMF_MIME_H264_VIDEO_RAW
+ && !iOMXComponentUsesNALStartCodes: The node inserts the start codes and hides them / exposes them when needed
- iOutFormat == PVMF_MIME_H264_VIDEO_RAW
- && !iOMXComponentUsesNALStartCodes
- && iOMXComponentUsesFullAVCFrames: This is an invalid combination. If the node wants raw output, and the component
- uses full frames, and no start codes, then there is no way to detect the
- NAL boundaries.
+ iOutFormat == PVMF_MIME_H264_VIDEO_RAW
+ && !iOMXComponentUsesNALStartCodes
+ && iOMXComponentUsesFullAVCFrames: This is an invalid combination. If the node wants raw output, and the component
+ uses full frames, and no start codes, then there is no way to detect the
+ NAL boundaries.
- */
+ */
- if (iOutFormat == PVMF_MIME_H264_VIDEO_RAW &&
+ if (iOutFormat == PVMF_MIME_H264_VIDEO_RAW &&
iOMXComponentUsesFullAVCFrames && !iOMXComponentUsesNALStartCodes)
- {
- // This is an invalid combination (see above). Therefore, return an error.
+ {
+ // This is an invalid combination (see above). Therefore, return an error.
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
- (0, "PVMFOMXEncNode-%s::DoPrepare() Component cannot support %s format", iNodeTypeId, PVMF_MIME_H264_VIDEO_RAW));
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
+ (0, "PVMFOMXEncNode-%s::DoPrepare() Component cannot support %s format", iNodeTypeId, PVMF_MIME_H264_VIDEO_RAW));
- CommandComplete(iInputCommands, aCmd, PVMFErrNotSupported);
- return;
- }
+ CommandComplete(iInputCommands, aCmd, PVMFErrNotSupported);
+ return;
+ }
- // find out about parameters
- if ((iOutFormat == PVMF_MIME_AMR_IETF) || (iOutFormat == PVMF_MIME_AMRWB_IETF) || (iOutFormat == PVMF_MIME_AMR_IF2) ||
+ // find out about parameters
+ if ((iOutFormat == PVMF_MIME_AMR_IETF) || (iOutFormat == PVMF_MIME_AMRWB_IETF) || (iOutFormat == PVMF_MIME_AMR_IF2) ||
(iOutFormat == PVMF_MIME_ADIF) || (iOutFormat == PVMF_MIME_ADTS) || (iOutFormat == PVMF_MIME_MPEG4_AUDIO))
- {
- if (!NegotiateAudioComponentParameters())
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
- (0, "PVMFOMXEncNode-%s::DoPrepare() Cannot get component parameters", iNodeTypeId));
+ if (!NegotiateAudioComponentParameters())
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
+ (0, "PVMFOMXEncNode-%s::DoPrepare() Cannot get component parameters", iNodeTypeId));
- CommandComplete(iInputCommands, aCmd, PVMFErrNoResources);
- return;
+ CommandComplete(iInputCommands, aCmd, PVMFErrNoResources);
+ return;
+ }
}
- }
- else
- {
-
- if (!NegotiateVideoComponentParameters())
+ else
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
- (0, "PVMFOMXEncNode-%s::DoPrepare() Cannot get component parameters", iNodeTypeId));
- CommandComplete(iInputCommands, aCmd, PVMFErrNoResources);
- return;
+ if (!NegotiateVideoComponentParameters())
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
+ (0, "PVMFOMXEncNode-%s::DoPrepare() Cannot get component parameters", iNodeTypeId));
+
+ CommandComplete(iInputCommands, aCmd, PVMFErrNoResources);
+ return;
+ }
}
- }
- // create active objects to handle callbacks in case of multithreaded implementation
+ // create active objects to handle callbacks in case of multithreaded implementation
- // NOTE: CREATE THE THREADSAFE CALLBACK AOs REGARDLESS OF WHETHER MULTITHREADED COMPONENT OR NOT
- // If it is not multithreaded, we won't use them
- // The Flag iIsComponentMultiThreaded decides which mechanism is used for callbacks.
- // This flag is set by looking at component capabilities (or to true by default)
+ // NOTE: CREATE THE THREADSAFE CALLBACK AOs REGARDLESS OF WHETHER MULTITHREADED COMPONENT OR NOT
+ // If it is not multithreaded, we won't use them
+ // The Flag iIsComponentMultiThreaded decides which mechanism is used for callbacks.
+ // This flag is set by looking at component capabilities (or to true by default)
- if (iThreadSafeHandlerEventHandler)
- {
- OSCL_DELETE(iThreadSafeHandlerEventHandler);
- iThreadSafeHandlerEventHandler = NULL;
- }
- // substitute default parameters: observer(this node),queuedepth(3),nameAO for logging
- // Get the priority of the encoder node, and set the threadsafe callback AO priority to 1 higher
+ if (iThreadSafeHandlerEventHandler)
+ {
+ OSCL_DELETE(iThreadSafeHandlerEventHandler);
+ iThreadSafeHandlerEventHandler = NULL;
+ }
+ // substitute default parameters: observer(this node),queuedepth(3),nameAO for logging
+ // Get the priority of the encoder node, and set the threadsafe callback AO priority to 1 higher
- iThreadSafeHandlerEventHandler = OSCL_NEW(EventHandlerThreadSafeCallbackAOEnc, (this, 10, "EventHandlerAO", Priority() + 2));
+ iThreadSafeHandlerEventHandler = OSCL_NEW(EventHandlerThreadSafeCallbackAOEnc, (this, 10, "EventHandlerAO", Priority() + 2));
- if (iThreadSafeHandlerEmptyBufferDone)
- {
- OSCL_DELETE(iThreadSafeHandlerEmptyBufferDone);
- iThreadSafeHandlerEmptyBufferDone = NULL;
- }
- // use queue depth of iNumInputBuffers to prevent deadlock
- iThreadSafeHandlerEmptyBufferDone = OSCL_NEW(EmptyBufferDoneThreadSafeCallbackAOEnc, (this, iNumInputBuffers, "EmptyBufferDoneAO", Priority() + 1));
+ if (iThreadSafeHandlerEmptyBufferDone)
+ {
+ OSCL_DELETE(iThreadSafeHandlerEmptyBufferDone);
+ iThreadSafeHandlerEmptyBufferDone = NULL;
+ }
+ // use queue depth of iNumInputBuffers to prevent deadlock
+ iThreadSafeHandlerEmptyBufferDone = OSCL_NEW(EmptyBufferDoneThreadSafeCallbackAOEnc, (this, iNumInputBuffers, "EmptyBufferDoneAO", Priority() + 1));
- if (iThreadSafeHandlerFillBufferDone)
- {
- OSCL_DELETE(iThreadSafeHandlerFillBufferDone);
- iThreadSafeHandlerFillBufferDone = NULL;
- }
- // use queue depth of iNumOutputBuffers to prevent deadlock
- iThreadSafeHandlerFillBufferDone = OSCL_NEW(FillBufferDoneThreadSafeCallbackAOEnc, (this, iNumOutputBuffers, "FillBufferDoneAO", Priority() + 1));
+ if (iThreadSafeHandlerFillBufferDone)
+ {
+ OSCL_DELETE(iThreadSafeHandlerFillBufferDone);
+ iThreadSafeHandlerFillBufferDone = NULL;
+ }
+ // use queue depth of iNumOutputBuffers to prevent deadlock
+ iThreadSafeHandlerFillBufferDone = OSCL_NEW(FillBufferDoneThreadSafeCallbackAOEnc, (this, iNumOutputBuffers, "FillBufferDoneAO", Priority() + 1));
- if ((iThreadSafeHandlerEventHandler == NULL) ||
+ if ((iThreadSafeHandlerEventHandler == NULL) ||
(iThreadSafeHandlerEmptyBufferDone == NULL) ||
(iThreadSafeHandlerFillBufferDone == NULL)
- )
- {
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
- (0, "PVMFOMXEncNode-%s::Can't get threadsafe callbacks for encoder!", iNodeTypeId));
- iOMXEncoder = NULL;
+ )
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
+ (0, "PVMFOMXEncNode-%s::Can't get threadsafe callbacks for encoder!", iNodeTypeId));
+ iOMXEncoder = NULL;
+ }
+
+
+ // Init Encoder
+ iCurrentEncoderState = OMX_StateLoaded;
+
+ /* Change state to OMX_StateIdle from OMX_StateLoaded. */
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG,
+ (0, "PVMFOMXEncNode-%s::DoPrepare(): Changing Component state Loaded -> Idle ", iNodeTypeId));
+
+ err = OMX_SendCommand(iOMXEncoder, OMX_CommandStateSet, OMX_StateIdle, NULL);
+ if (err != OMX_ErrorNone)
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
+ (0, "PVMFOMXEncNode-%s::DoPrepare() Can't send StateSet command!", iNodeTypeId));
+
+ CommandComplete(iInputCommands, aCmd, PVMFErrNoResources);
+ return;
+ }
+
+
+ /* Allocate input buffers */
+ if (!CreateInputMemPool(iNumInputBuffers))
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
+ (0, "PVMFOMXEncNode-%s::DoPrepare() Can't allocate mempool for input buffers!", iNodeTypeId));
+
+ CommandComplete(iInputCommands, aCmd, PVMFErrNoResources);
+ return;
+ }
+
+ in_ctrl_struct_ptr = NULL;
+ in_buff_hdr_ptr = NULL;
+
+ in_ctrl_struct_ptr = (OsclAny **) oscl_malloc(iNumInputBuffers * sizeof(OsclAny *));
+
+ if (in_ctrl_struct_ptr == NULL)
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
+ (0, "PVMFOMXEncNode-%s::DoPreapare in_ctrl_struct_ptr == NULL", iNodeTypeId));
+
+ CommandComplete(iInputCommands, aCmd, PVMFErrNoResources);
+ return ;
+ }
+
+ in_buff_hdr_ptr = (OsclAny **) oscl_malloc(iNumInputBuffers * sizeof(OsclAny *));
+
+ if (in_buff_hdr_ptr == NULL)
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
+ (0, "PVMFOMXEncNode-%s::DoPreapare in_buff_hdr_ptr == NULL", iNodeTypeId));
+
+ CommandComplete(iInputCommands, aCmd, PVMFErrNoResources);
+ return ;
+ }
+
+
+ if (!ProvideBuffersToComponent(iInBufMemoryPool, // allocator
+ iInputAllocSize, // size to allocate from pool (hdr only or hdr+ buffer)
+ iNumInputBuffers, // number of buffers
+ iOMXComponentInputBufferSize, // actual buffer size
+ iInputPortIndex, // port idx
+ iOMXComponentSupportsExternalInputBufferAlloc, // can component use OMX_UseBuffer
+ true // this is input
+ ))
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
+ (0, "PVMFOMXEncNode-%s::DoPrepare() Component can't use input buffers!", iNodeTypeId));
+
+ CommandComplete(iInputCommands, aCmd, PVMFErrNoResources);
+ return;
+ }
+
+
+ /* Allocate output buffers */
+ if (!CreateOutMemPool(iNumOutputBuffers))
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
+ (0, "PVMFOMXEncNode-%s::DoPrepare() Can't allocate mempool for output buffers!", iNodeTypeId));
+
+ CommandComplete(iInputCommands, aCmd, PVMFErrNoResources);
+ return;
+ }
+
+ out_ctrl_struct_ptr = NULL;
+ out_buff_hdr_ptr = NULL;
+
+ out_ctrl_struct_ptr = (OsclAny **) oscl_malloc(iNumOutputBuffers * sizeof(OsclAny *));
+
+ if (out_ctrl_struct_ptr == NULL)
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
+ (0, "PVMFOMXEncNode-%s::DoPreapare out_ctrl_struct_ptr == NULL", iNodeTypeId));
+
+ CommandComplete(iInputCommands, aCmd, PVMFErrNoResources);
+ return ;
+ }
+
+ out_buff_hdr_ptr = (OsclAny **) oscl_malloc(iNumOutputBuffers * sizeof(OsclAny *));
+
+ if (out_buff_hdr_ptr == NULL)
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
+ (0, "PVMFOMXEncNode-%s::DoPreapare out_buff_hdr_ptr == NULL", iNodeTypeId));
+
+ CommandComplete(iInputCommands, aCmd, PVMFErrNoResources);
+ return ;
+ }
+
+
+ if (!ProvideBuffersToComponent(iOutBufMemoryPool, // allocator
+ iOutputAllocSize, // size to allocate from pool (hdr only or hdr+ buffer)
+ iNumOutputBuffers, // number of buffers
+ iOMXComponentOutputBufferSize, // actual buffer size
+ iOutputPortIndex, // port idx
+ iOMXComponentSupportsExternalOutputBufferAlloc, // can component use OMX_UseBuffer
+ false // this is not input
+ ))
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
+ (0, "PVMFOMXEncNode-%s::DoPrepare() Component can't use output buffers!", iNodeTypeId));
+
+ CommandComplete(iInputCommands, aCmd, PVMFErrNoResources);
+ return;
+ }
+
+
+ //this command is asynchronous. move the command from
+ //the input command queue to the current command, where
+ //it will remain until it completes. We have to wait for
+ // OMX component state transition to complete
+
+ int32 err;
+ OSCL_TRY(err, iCurrentCommand.StoreL(aCmd););
+ if (err != OsclErrNone)
+ {
+ CommandComplete(iInputCommands, aCmd, PVMFErrNoMemory);
+ return;
+ }
+ iInputCommands.Erase(&aCmd);
+
}
-
-
- // Init Encoder
- iCurrentEncoderState = OMX_StateLoaded;
-
- /* Change state to OMX_StateIdle from OMX_StateLoaded. */
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG,
- (0, "PVMFOMXEncNode-%s::DoPrepare(): Changing Component state Loaded -> Idle ", iNodeTypeId));
-
- err = OMX_SendCommand(iOMXEncoder, OMX_CommandStateSet, OMX_StateIdle, NULL);
- if (err != OMX_ErrorNone)
- {
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
- (0, "PVMFOMXEncNode-%s::DoPrepare() Can't send StateSet command!", iNodeTypeId));
-
- CommandComplete(iInputCommands, aCmd, PVMFErrNoResources);
- return;
- }
-
-
- /* Allocate input buffers */
- if (!CreateInputMemPool(iNumInputBuffers))
- {
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
- (0, "PVMFOMXEncNode-%s::DoPrepare() Can't allocate mempool for input buffers!", iNodeTypeId));
-
- CommandComplete(iInputCommands, aCmd, PVMFErrNoResources);
- return;
- }
-
- in_ctrl_struct_ptr = NULL;
- in_buff_hdr_ptr = NULL;
-
- in_ctrl_struct_ptr = (OsclAny **) oscl_malloc(iNumInputBuffers * sizeof(OsclAny *));
-
- if (in_ctrl_struct_ptr == NULL)
- {
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "PVMFOMXEncNode-%s::DoPreapare in_ctrl_struct_ptr == NULL", iNodeTypeId));
-
- CommandComplete(iInputCommands, aCmd, PVMFErrNoResources);
- return ;
- }
-
- in_buff_hdr_ptr = (OsclAny **) oscl_malloc(iNumInputBuffers * sizeof(OsclAny *));
-
- if (in_buff_hdr_ptr == NULL)
- {
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "PVMFOMXEncNode-%s::DoPreapare in_buff_hdr_ptr == NULL", iNodeTypeId));
-
- CommandComplete(iInputCommands, aCmd, PVMFErrNoResources);
- return ;
- }
-
-
- if (!ProvideBuffersToComponent(iInBufMemoryPool, // allocator
- iInputAllocSize, // size to allocate from pool (hdr only or hdr+ buffer)
- iNumInputBuffers, // number of buffers
- iOMXComponentInputBufferSize, // actual buffer size
- iInputPortIndex, // port idx
- iOMXComponentSupportsExternalInputBufferAlloc, // can component use OMX_UseBuffer
- true // this is input
- ))
- {
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
- (0, "PVMFOMXEncNode-%s::DoPrepare() Component can't use input buffers!", iNodeTypeId));
-
- CommandComplete(iInputCommands, aCmd, PVMFErrNoResources);
- return;
- }
-
-
- /* Allocate output buffers */
- if (!CreateOutMemPool(iNumOutputBuffers))
- {
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
- (0, "PVMFOMXEncNode-%s::DoPrepare() Can't allocate mempool for output buffers!", iNodeTypeId));
-
- CommandComplete(iInputCommands, aCmd, PVMFErrNoResources);
- return;
- }
-
- out_ctrl_struct_ptr = NULL;
- out_buff_hdr_ptr = NULL;
-
- out_ctrl_struct_ptr = (OsclAny **) oscl_malloc(iNumOutputBuffers * sizeof(OsclAny *));
-
- if (out_ctrl_struct_ptr == NULL)
- {
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "PVMFOMXEncNode-%s::DoPreapare out_ctrl_struct_ptr == NULL", iNodeTypeId));
-
- CommandComplete(iInputCommands, aCmd, PVMFErrNoResources);
- return ;
- }
-
- out_buff_hdr_ptr = (OsclAny **) oscl_malloc(iNumOutputBuffers * sizeof(OsclAny *));
-
- if (out_buff_hdr_ptr == NULL)
- {
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "PVMFOMXEncNode-%s::DoPreapare out_buff_hdr_ptr == NULL", iNodeTypeId));
-
- CommandComplete(iInputCommands, aCmd, PVMFErrNoResources);
- return ;
- }
-
-
- if (!ProvideBuffersToComponent(iOutBufMemoryPool, // allocator
- iOutputAllocSize, // size to allocate from pool (hdr only or hdr+ buffer)
- iNumOutputBuffers, // number of buffers
- iOMXComponentOutputBufferSize, // actual buffer size
- iOutputPortIndex, // port idx
- iOMXComponentSupportsExternalOutputBufferAlloc, // can component use OMX_UseBuffer
- false // this is not input
- ))
- {
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
- (0, "PVMFOMXEncNode-%s::DoPrepare() Component can't use output buffers!", iNodeTypeId));
-
- CommandComplete(iInputCommands, aCmd, PVMFErrNoResources);
- return;
- }
-
-
- //this command is asynchronous. move the command from
- //the input command queue to the current command, where
- //it will remain until it completes. We have to wait for
- // OMX component state transition to complete
-
- int32 err;
- OSCL_TRY(err, iCurrentCommand.StoreL(aCmd););
- if (err != OsclErrNone)
- {
- CommandComplete(iInputCommands, aCmd, PVMFErrNoMemory);
- return;
- }
- iInputCommands.Erase(&aCmd);
-
- }
- break;
+ break;
case EPVMFNodePrepared:
CommandComplete(iInputCommands, aCmd, PVMFSuccess);
break;
@@ -6073,61 +6073,61 @@
{
case EPVMFNodePrepared:
case EPVMFNodePaused:
- {
- //Get state of OpenMAX encoder
- err = OMX_GetState(iOMXEncoder, &sState);
- if (err != OMX_ErrorNone)
{
- //Error condition report
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
- (0, "PVMFOMXEncNode-%s::DoStart(): Can't get State of encoder!", iNodeTypeId));
-
- sState = OMX_StateInvalid;
- }
-#ifdef _TEST_AE_ERROR_HANDLING
- if (iErrorHandlingInit)
- {
- //some random state ,we want Init to fail
-
- sState = OMX_StateInvalid;
- }
-#endif
- if ((sState == OMX_StateIdle) || (sState == OMX_StatePause))
- {
- /* Change state to OMX_StateExecuting form OMX_StateIdle. */
- // init the flag
- iDoNotSendOutputBuffersDownstreamFlag = false; // or if output was not being sent downstream due to state changes
- // re-anable sending output
-
- iDoNotSaveInputBuffersFlag = false;
-
-
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "PVMFOMXEncNode-%s::DoStart() Changing Component state Idle->Executing", iNodeTypeId));
-
- err = OMX_SendCommand(iOMXEncoder, OMX_CommandStateSet, OMX_StateExecuting, NULL);
+ //Get state of OpenMAX encoder
+ err = OMX_GetState(iOMXEncoder, &sState);
if (err != OMX_ErrorNone)
{
//Error condition report
PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
- (0, "PVMFOMXEncNode-%s::DoStart(): Can't send StateSet command to encoder!", iNodeTypeId));
+ (0, "PVMFOMXEncNode-%s::DoStart(): Can't get State of encoder!", iNodeTypeId));
+
+ sState = OMX_StateInvalid;
+ }
+#ifdef _TEST_AE_ERROR_HANDLING
+ if (iErrorHandlingInit)
+ {
+ //some random state ,we want Init to fail
+
+ sState = OMX_StateInvalid;
+ }
+#endif
+ if ((sState == OMX_StateIdle) || (sState == OMX_StatePause))
+ {
+ /* Change state to OMX_StateExecuting form OMX_StateIdle. */
+ // init the flag
+ iDoNotSendOutputBuffersDownstreamFlag = false; // or if output was not being sent downstream due to state changes
+ // re-anable sending output
+
+ iDoNotSaveInputBuffersFlag = false;
+
+
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
+ (0, "PVMFOMXEncNode-%s::DoStart() Changing Component state Idle->Executing", iNodeTypeId));
+
+ err = OMX_SendCommand(iOMXEncoder, OMX_CommandStateSet, OMX_StateExecuting, NULL);
+ if (err != OMX_ErrorNone)
+ {
+ //Error condition report
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
+ (0, "PVMFOMXEncNode-%s::DoStart(): Can't send StateSet command to encoder!", iNodeTypeId));
+
+ status = PVMFErrInvalidState;
+ }
+
+ }
+ else
+ {
+ //Error condition report
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
+ (0, "PVMFOMXEncNode-%s::DoStart(): Encoder is not in the Idle or Pause state!", iNodeTypeId));
status = PVMFErrInvalidState;
}
+
}
- else
- {
- //Error condition report
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
- (0, "PVMFOMXEncNode-%s::DoStart(): Encoder is not in the Idle or Pause state!", iNodeTypeId));
-
- status = PVMFErrInvalidState;
- }
-
-
- }
- break;
+ break;
default:
status = PVMFErrInvalidState;
@@ -6236,7 +6236,7 @@
// prevent the node from sending more buffers etc.
// if port reconfiguration is in process, let the state remain one of the port config states
- // if there is a start command, we can do it seemlessly (by continuing the port reconfig)
+ // if there is a start command, we can do it seemlessly (by continuing the port reconfig)
if (iProcessingState == EPVMFOMXEncNodeProcessingState_ReadyToEncode)
iProcessingState = EPVMFOMXEncNodeProcessingState_Stopping;
@@ -6416,356 +6416,356 @@
case EPVMFNodeStarted:
case EPVMFNodePaused:
case EPVMFNodeError:
- {
- //Check if encoder is initilized
- if (iOMXEncoder != NULL)
{
- //Get state of OpenMAX encoder
- err = OMX_GetState(iOMXEncoder, &sState);
- if (err != OMX_ErrorNone)
+ //Check if encoder is initilized
+ if (iOMXEncoder != NULL)
{
- //Error condition report
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
- (0, "PVMFOMXEncNode-%s::DoReset(): Can't get State of encoder!", iNodeTypeId));
- if (iResetInProgress)
+ //Get state of OpenMAX encoder
+ err = OMX_GetState(iOMXEncoder, &sState);
+ if (err != OMX_ErrorNone)
{
- // cmd is in current q
- iResetInProgress = false;
- if ((iCurrentCommand.size() > 0) &&
+ //Error condition report
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
+ (0, "PVMFOMXEncNode-%s::DoReset(): Can't get State of encoder!", iNodeTypeId));
+ if (iResetInProgress)
+ {
+ // cmd is in current q
+ iResetInProgress = false;
+ if ((iCurrentCommand.size() > 0) &&
(iCurrentCommand.front().iCmd == PVMFOMXEncNodeCommand::PVOMXENC_NODE_CMD_RESET)
- )
- {
- CommandComplete(iCurrentCommand, iCurrentCommand.front(), PVMFErrResource);
+ )
+ {
+ CommandComplete(iCurrentCommand, iCurrentCommand.front(), PVMFErrResource);
+ }
+
}
+ else
+ {
+ CommandComplete(iInputCommands, aCmd, PVMFErrResource);
+ }
+ return;
+ }
+
+ if (sState == OMX_StateLoaded)
+ {
+ // this is a value obtained by synchronous call to component. Either the component was
+ // already in this state without node issuing any commands,
+ // or perhaps we started the Reset, but the callback notification has not yet arrived.
+ if (iResetInProgress)
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
+ (0, "PVMFOMXEncNode-%s::DoReset() OMX comp is in loaded state. Wait for official callback to change variables etc.", iNodeTypeId));
+ return;
+ }
+ else
+ {
+ //delete all ports and notify observer.
+ if (iInPort)
+ {
+ OSCL_DELETE(((PVMFOMXEncPort*)iInPort));
+ iInPort = NULL;
+ }
+
+ if (iOutPort)
+ {
+ OSCL_DELETE(((PVMFOMXEncPort*)iOutPort));
+ iOutPort = NULL;
+ }
+
+ iDataIn.Unbind();
+
+
+ // Reset the metadata key list
+ iAvailableMetadataKeys.clear();
+
+ iEndOfDataReached = false;
+ iIsEOSSentToComponent = false;
+ iIsEOSReceivedFromComponent = false;
+
+
+ iProcessingState = EPVMFOMXEncNodeProcessingState_Idle;
+ //logoff & go back to Created state.
+ SetState(EPVMFNodeIdle);
+
+ CommandComplete(iInputCommands, aCmd, PVMFSuccess);
+
+ //CommandComplete(iInputCommands, aCmd, PVMFErrResource);
+ return;
+ }
+ }
+
+ if (sState == OMX_StateIdle)
+ {
+
+
+ //this command is asynchronous. move the command from
+ //the input command queue to the current command, where
+ //it will remain until it is completed.
+ if (!iResetInProgress)
+ {
+ int32 err;
+ OSCL_TRY(err, iCurrentCommand.StoreL(aCmd););
+ if (err != OsclErrNone)
+ {
+ CommandComplete(iInputCommands, aCmd, PVMFErrNoMemory);
+ return;
+ }
+ iInputCommands.Erase(&aCmd);
+
+ iResetInProgress = true;
+ }
+
+ // if buffers aren't all back (due to timing issues with different callback AOs
+ // state change can be reported before all buffers are returned)
+ if (iNumOutstandingInputBuffers > 0 || iNumOutstandingOutputBuffers > 0)
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
+ (0, "PVMFOMXEncNode-%s::DoReset() Waiting for %d input and-or %d output buffers", iNodeTypeId, iNumOutstandingInputBuffers, iNumOutstandingOutputBuffers));
+
+ return;
+ }
+
+ if (!iResetMsgSent)
+ {
+ // We can come here only if all buffers are already back
+ // Don't repeat any of this twice.
+ /* Change state to OMX_StateLoaded form OMX_StateIdle. */
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
+ (0, "PVMFOMXEncNode-%s::DoReset() Changing Component State Idle->Loaded", iNodeTypeId));
+
+ err = OMX_SendCommand(iOMXEncoder, OMX_CommandStateSet, OMX_StateLoaded, NULL);
+ if (err != OMX_ErrorNone)
+ {
+ //Error condition report
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
+ (0, "PVMFOMXEncNode-%s::DoReset(): Can't send StateSet command to encoder!", iNodeTypeId));
+ }
+
+ iResetMsgSent = true;
+
+
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
+ (0, "PVMFOMXEncNode-%s::DoReset() freeing output buffers", iNodeTypeId));
+
+ if (false == iOutputBuffersFreed)
+ {
+ if (!FreeBuffersFromComponent(iOutBufMemoryPool, // allocator
+ iOutputAllocSize, // size to allocate from pool (hdr only or hdr+ buffer)
+ iNumOutputBuffers, // number of buffers
+ iOutputPortIndex, // port idx
+ false // this is not input
+ ))
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
+ (0, "PVMFOMXEncNode-%s::DoReset() Cannot free output buffers ", iNodeTypeId));
+
+ if (iResetInProgress)
+ {
+ iResetInProgress = false;
+ if ((iCurrentCommand.size() > 0) &&
+ (iCurrentCommand.front().iCmd == PVMFOMXEncNodeCommand::PVOMXENC_NODE_CMD_RESET)
+ )
+ {
+ CommandComplete(iCurrentCommand, iCurrentCommand.front() , PVMFErrResource);
+ }
+ }
+
+ }
+
+ }
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
+ (0, "PVMFOMXEncNode-%s::DoReset() freeing input buffers ", iNodeTypeId));
+ if (false == iInputBuffersFreed)
+ {
+ if (!FreeBuffersFromComponent(iInBufMemoryPool, // allocator
+ iInputAllocSize, // size to allocate from pool (hdr only or hdr+ buffer)
+ iNumInputBuffers, // number of buffers
+ iInputPortIndex, // port idx
+ true // this is input
+ ))
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
+ (0, "PVMFOMXEncNode-%s::DoReset() Cannot free input buffers ", iNodeTypeId));
+
+ if (iResetInProgress)
+ {
+ iResetInProgress = false;
+ if ((iCurrentCommand.size() > 0) &&
+ (iCurrentCommand.front().iCmd == PVMFOMXEncNodeCommand::PVOMXENC_NODE_CMD_RESET)
+ )
+ {
+ CommandComplete(iCurrentCommand, iCurrentCommand.front(), PVMFErrResource);
+ }
+ }
+
+
+ }
+ }
+
+
+
+ iEndOfDataReached = false;
+ iIsEOSSentToComponent = false;
+ iIsEOSReceivedFromComponent = false;
+
+
+
+ // also, perform Port deletion when the component replies with the command
+ // complete, not right here
+ } // end of if(iResetMsgSent)
+
+
+ return;
+
+ }
+ if ((sState == OMX_StateExecuting) || (sState == OMX_StatePause))
+ {
+ //this command is asynchronous. move the command from
+ //the input command queue to the current command, where
+ //it will remain until it is completed.
+ if (!iResetInProgress)
+ {
+ int32 err;
+ OSCL_TRY(err, iCurrentCommand.StoreL(aCmd););
+ if (err != OsclErrNone)
+ {
+ CommandComplete(iInputCommands, aCmd, PVMFErrNoMemory);
+ return;
+ }
+ iInputCommands.Erase(&aCmd);
+
+ iResetInProgress = true;
+ }
+
+ /* Change state to OMX_StateIdle from OMX_StateExecuting or OMX_StatePause. */
+
+ if (!iStopInResetMsgSent)
+ {
+
+ // don't send twice in a row
+
+ iDataIn.Unbind();
+ iPreviousMediaData.Unbind();
+ if ((iOutFormat == PVMF_MIME_H264_VIDEO_MP4) || (iOutFormat == PVMF_MIME_H264_VIDEO_RAW))
+ {
+ // prepare for next start (if it comes)
+ iFirstNAL = true;
+ }
+ // Clear queued messages in ports
+ if (iInPort)
+ {
+ iInPort->ClearMsgQueues();
+ }
+
+ if (iOutPort)
+ {
+ iOutPort->ClearMsgQueues();
+ }
+
+ // Clear the data flags
+
+ iEndOfDataReached = false;
+ iIsEOSSentToComponent = false;
+ iIsEOSReceivedFromComponent = false;
+
+
+ iDoNotSendOutputBuffersDownstreamFlag = true; // stop sending output buffers downstream
+ iDoNotSaveInputBuffersFlag = true;
+
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
+ (0, "PVMFOMXEncNode-%s::DoReset() Changing Component State Executing->Idle or Pause->Idle", iNodeTypeId));
+
+ err = OMX_SendCommand(iOMXEncoder, OMX_CommandStateSet, OMX_StateIdle, NULL);
+ if (err != OMX_ErrorNone)
+ {
+ //Error condition report
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
+ (0, "PVMFOMXEncNode-%s::DoReset(): Can't send StateSet command to Encoder!", iNodeTypeId));
+
+ CommandComplete(iInputCommands, aCmd, PVMFErrInvalidState);
+ break;
+ }
+
+ iStopInResetMsgSent = true;
+
+ // prevent the node from sending more buffers etc.
+ // if port reconfiguration is in process, let the state remain one of the port config states
+ // if there is a start command, we can do it seemlessly (by continuing the port reconfig)
+ if (iProcessingState == EPVMFOMXEncNodeProcessingState_ReadyToEncode)
+ iProcessingState = EPVMFOMXEncNodeProcessingState_Stopping;
+ }
+ return;
}
else
{
- CommandComplete(iInputCommands, aCmd, PVMFErrResource);
- }
- return;
- }
-
- if (sState == OMX_StateLoaded)
- {
- // this is a value obtained by synchronous call to component. Either the component was
- // already in this state without node issuing any commands,
- // or perhaps we started the Reset, but the callback notification has not yet arrived.
- if (iResetInProgress)
- {
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "PVMFOMXEncNode-%s::DoReset() OMX comp is in loaded state. Wait for official callback to change variables etc.", iNodeTypeId));
- return;
- }
- else
- {
- //delete all ports and notify observer.
- if (iInPort)
+ //Error condition report
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
+ (0, "PVMFOMXEncNode-%s::DoReset(): Encoder is not in the Idle state!", iNodeTypeId));
+ if (iResetInProgress)
{
- OSCL_DELETE(((PVMFOMXEncPort*)iInPort));
- iInPort = NULL;
- }
-
- if (iOutPort)
- {
- OSCL_DELETE(((PVMFOMXEncPort*)iOutPort));
- iOutPort = NULL;
- }
-
- iDataIn.Unbind();
-
-
- // Reset the metadata key list
- iAvailableMetadataKeys.clear();
-
- iEndOfDataReached = false;
- iIsEOSSentToComponent = false;
- iIsEOSReceivedFromComponent = false;
-
-
- iProcessingState = EPVMFOMXEncNodeProcessingState_Idle;
- //logoff & go back to Created state.
- SetState(EPVMFNodeIdle);
-
- CommandComplete(iInputCommands, aCmd, PVMFSuccess);
-
- //CommandComplete(iInputCommands, aCmd, PVMFErrResource);
- return;
- }
- }
-
- if (sState == OMX_StateIdle)
- {
-
-
- //this command is asynchronous. move the command from
- //the input command queue to the current command, where
- //it will remain until it is completed.
- if (!iResetInProgress)
- {
- int32 err;
- OSCL_TRY(err, iCurrentCommand.StoreL(aCmd););
- if (err != OsclErrNone)
- {
- CommandComplete(iInputCommands, aCmd, PVMFErrNoMemory);
- return;
- }
- iInputCommands.Erase(&aCmd);
-
- iResetInProgress = true;
- }
-
- // if buffers aren't all back (due to timing issues with different callback AOs
- // state change can be reported before all buffers are returned)
- if (iNumOutstandingInputBuffers > 0 || iNumOutstandingOutputBuffers > 0)
- {
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "PVMFOMXEncNode-%s::DoReset() Waiting for %d input and-or %d output buffers", iNodeTypeId, iNumOutstandingInputBuffers, iNumOutstandingOutputBuffers));
-
- return;
- }
-
- if (!iResetMsgSent)
- {
- // We can come here only if all buffers are already back
- // Don't repeat any of this twice.
- /* Change state to OMX_StateLoaded form OMX_StateIdle. */
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "PVMFOMXEncNode-%s::DoReset() Changing Component State Idle->Loaded", iNodeTypeId));
-
- err = OMX_SendCommand(iOMXEncoder, OMX_CommandStateSet, OMX_StateLoaded, NULL);
- if (err != OMX_ErrorNone)
- {
- //Error condition report
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
- (0, "PVMFOMXEncNode-%s::DoReset(): Can't send StateSet command to encoder!", iNodeTypeId));
- }
-
- iResetMsgSent = true;
-
-
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "PVMFOMXEncNode-%s::DoReset() freeing output buffers", iNodeTypeId));
-
- if (false == iOutputBuffersFreed)
- {
- if (!FreeBuffersFromComponent(iOutBufMemoryPool, // allocator
- iOutputAllocSize, // size to allocate from pool (hdr only or hdr+ buffer)
- iNumOutputBuffers, // number of buffers
- iOutputPortIndex, // port idx
- false // this is not input
- ))
+ iResetInProgress = false;
+ if ((iCurrentCommand.size() > 0) &&
+ (iCurrentCommand.front().iCmd == PVMFOMXEncNodeCommand::PVOMXENC_NODE_CMD_RESET)
+ )
{
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
- (0, "PVMFOMXEncNode-%s::DoReset() Cannot free output buffers ", iNodeTypeId));
-
- if (iResetInProgress)
- {
- iResetInProgress = false;
- if ((iCurrentCommand.size() > 0) &&
- (iCurrentCommand.front().iCmd == PVMFOMXEncNodeCommand::PVOMXENC_NODE_CMD_RESET)
- )
- {
- CommandComplete(iCurrentCommand, iCurrentCommand.front() , PVMFErrResource);
- }
- }
-
- }
-
- }
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "PVMFOMXEncNode-%s::DoReset() freeing input buffers ", iNodeTypeId));
- if (false == iInputBuffersFreed)
- {
- if (!FreeBuffersFromComponent(iInBufMemoryPool, // allocator
- iInputAllocSize, // size to allocate from pool (hdr only or hdr+ buffer)
- iNumInputBuffers, // number of buffers
- iInputPortIndex, // port idx
- true // this is input
- ))
- {
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
- (0, "PVMFOMXEncNode-%s::DoReset() Cannot free input buffers ", iNodeTypeId));
-
- if (iResetInProgress)
- {
- iResetInProgress = false;
- if ((iCurrentCommand.size() > 0) &&
- (iCurrentCommand.front().iCmd == PVMFOMXEncNodeCommand::PVOMXENC_NODE_CMD_RESET)
- )
- {
- CommandComplete(iCurrentCommand, iCurrentCommand.front(), PVMFErrResource);
- }
- }
-
-
+ CommandComplete(iCurrentCommand, iCurrentCommand.front(), PVMFErrInvalidState);
}
}
-
-
-
- iEndOfDataReached = false;
- iIsEOSSentToComponent = false;
- iIsEOSReceivedFromComponent = false;
-
-
-
- // also, perform Port deletion when the component replies with the command
- // complete, not right here
- } // end of if(iResetMsgSent)
-
-
- return;
-
- }
- if ((sState == OMX_StateExecuting) || (sState == OMX_StatePause))
- {
- //this command is asynchronous. move the command from
- //the input command queue to the current command, where
- //it will remain until it is completed.
- if (!iResetInProgress)
- {
- int32 err;
- OSCL_TRY(err, iCurrentCommand.StoreL(aCmd););
- if (err != OsclErrNone)
+ else
{
- CommandComplete(iInputCommands, aCmd, PVMFErrNoMemory);
- return;
- }
- iInputCommands.Erase(&aCmd);
-
- iResetInProgress = true;
- }
-
- /* Change state to OMX_StateIdle from OMX_StateExecuting or OMX_StatePause. */
-
- if (!iStopInResetMsgSent)
- {
-
- // don't send twice in a row
-
- iDataIn.Unbind();
- iPreviousMediaData.Unbind();
- if ((iOutFormat == PVMF_MIME_H264_VIDEO_MP4) || (iOutFormat == PVMF_MIME_H264_VIDEO_RAW))
- {
- // prepare for next start (if it comes)
- iFirstNAL = true;
- }
- // Clear queued messages in ports
- if (iInPort)
- {
- iInPort->ClearMsgQueues();
- }
-
- if (iOutPort)
- {
- iOutPort->ClearMsgQueues();
- }
-
- // Clear the data flags
-
- iEndOfDataReached = false;
- iIsEOSSentToComponent = false;
- iIsEOSReceivedFromComponent = false;
-
-
- iDoNotSendOutputBuffersDownstreamFlag = true; // stop sending output buffers downstream
- iDoNotSaveInputBuffersFlag = true;
-
- PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
- (0, "PVMFOMXEncNode-%s::DoReset() Changing Component State Executing->Idle or Pause->Idle", iNodeTypeId));
-
- err = OMX_SendCommand(iOMXEncoder, OMX_CommandStateSet, OMX_StateIdle, NULL);
- if (err != OMX_ErrorNone)
- {
- //Error condition report
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
- (0, "PVMFOMXEncNode-%s::DoReset(): Can't send StateSet command to Encoder!", iNodeTypeId));
-
CommandComplete(iInputCommands, aCmd, PVMFErrInvalidState);
- break;
}
+ break;
+ }//end of if (sState == OMX_StateIdle)
+ }//end of if (iOMXEncoder != NULL)
- iStopInResetMsgSent = true;
+ //delete all ports and notify observer.
+ if (iInPort)
+ {
+ OSCL_DELETE(((PVMFOMXEncPort*)iInPort));
+ iInPort = NULL;
+ }
- // prevent the node from sending more buffers etc.
- // if port reconfiguration is in process, let the state remain one of the port config states
- // if there is a start command, we can do it seemlessly (by continuing the port reconfig)
- if (iProcessingState == EPVMFOMXEncNodeProcessingState_ReadyToEncode)
- iProcessingState = EPVMFOMXEncNodeProcessingState_Stopping;
+ if (iOutPort)
+ {
+ OSCL_DELETE(((PVMFOMXEncPort*)iOutPort));
+ iOutPort = NULL;
+ }
+
+ iDataIn.Unbind();
+
+
+ // Reset the metadata key list
+ iAvailableMetadataKeys.clear();
+
+ iEndOfDataReached = false;
+ iIsEOSSentToComponent = false;
+ iIsEOSReceivedFromComponent = false;
+
+
+ iProcessingState = EPVMFOMXEncNodeProcessingState_Idle;
+ //logoff & go back to Created state.
+ SetState(EPVMFNodeIdle);
+
+
+ if (iResetInProgress)
+ {
+ iResetInProgress = false;
+ if ((iCurrentCommand.size() > 0) &&
+ (iCurrentCommand.front().iCmd == PVMFOMXEncNodeCommand::PVOMXENC_NODE_CMD_RESET)
+ )
+ {
+ CommandComplete(iCurrentCommand, iCurrentCommand.front(), PVMFSuccess);
}
- return;
-
}
else
{
- //Error condition report
- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
- (0, "PVMFOMXEncNode-%s::DoReset(): Encoder is not in the Idle state!", iNodeTypeId));
- if (iResetInProgress)
- {
- iResetInProgress = false;
- if ((iCurrentCommand.size() > 0) &&
- (iCurrentCommand.front().iCmd == PVMFOMXEncNodeCommand::PVOMXENC_NODE_CMD_RESET)
- )
- {
- CommandComplete(iCurrentCommand, iCurrentCommand.front(), PVMFErrInvalidState);
- }
- }
- else
- {
- CommandComplete(iInputCommands, aCmd, PVMFErrInvalidState);
- }
- break;
- }//end of if (sState == OMX_StateIdle)
- }//end of if (iOMXEncoder != NULL)
-
- //delete all ports and notify observer.
- if (iInPort)
- {
- OSCL_DELETE(((PVMFOMXEncPort*)iInPort));
- iInPort = NULL;
- }
-
- if (iOutPort)
- {
- OSCL_DELETE(((PVMFOMXEncPort*)iOutPort));
- iOutPort = NULL;
- }
-
- iDataIn.Unbind();
-
-
- // Reset the metadata key list
- iAvailableMetadataKeys.clear();
-
- iEndOfDataReached = false;
- iIsEOSSentToComponent = false;
- iIsEOSReceivedFromComponent = false;
-
-
- iProcessingState = EPVMFOMXEncNodeProcessingState_Idle;
- //logoff & go back to Created state.
- SetState(EPVMFNodeIdle);
-
-
- if (iResetInProgress)
- {
- iResetInProgress = false;
- if ((iCurrentCommand.size() > 0) &&
- (iCurrentCommand.front().iCmd == PVMFOMXEncNodeCommand::PVOMXENC_NODE_CMD_RESET)
- )
- {
- CommandComplete(iCurrentCommand, iCurrentCommand.front(), PVMFSuccess);
+ CommandComplete(iInputCommands, aCmd, PVMFSuccess);
}
- }
- else
- {
- CommandComplete(iInputCommands, aCmd, PVMFSuccess);
- }
- }
- break;
+ }
+ break;
default:
CommandComplete(iInputCommands, aCmd, PVMFErrInvalidState);
@@ -7069,7 +7069,7 @@
uint32 KeyLen = 0;
if ((oscl_strcmp((*keylistptr)[lcv].get_cstr(), PVOMXENCMETADATA_CODECINFO_VIDEO_WIDTH_KEY) == 0) &&
- iYUVWidth > 0)
+ iYUVWidth > 0)
{
// Video width
// Increment the counter for the number of values found so far
@@ -7742,10 +7742,10 @@
//Match against custom interface1...
if (*mimetype == PVMF_OMX_ENC_NODE_CUSTOM1_MIMETYPE
- //also match against base mimetypes for custom interface1,
- //unless exactmatch is set.
- || (!exactmatch && *mimetype == PVMF_OMX_ENC_NODE_MIMETYPE)
- || (!exactmatch && *mimetype == PVMF_BASEMIMETYPE))
+ //also match against base mimetypes for custom interface1,
+ //unless exactmatch is set.
+ || (!exactmatch && *mimetype == PVMF_OMX_ENC_NODE_MIMETYPE)
+ || (!exactmatch && *mimetype == PVMF_BASEMIMETYPE))
{
PVUuid uuid(PVMF_OMX_ENC_NODE_CUSTOM1_UUID);
@@ -8018,7 +8018,7 @@
for (uint32 lcv = 0; lcv < numkeys; lcv++)
{
if ((oscl_strcmp(aKeyList[lcv].get_cstr(), PVOMXENCMETADATA_CODECINFO_VIDEO_WIDTH_KEY) == 0) &&
- iYUVWidth > 0)
+ iYUVWidth > 0)
{
// Video width
++numvalentries;
@@ -8153,13 +8153,13 @@
{
PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "PVMFOMXEncNode-%s::GetProfileAndLevel() iEncoder is Null", iNodeTypeId));
aProfile = PV_MPEG_VIDEO_RESERVED_PROFILE;
- aLevel = PV_MPEG_VIDEO_LEVEL_UNKNOWN;
+ aLevel = PV_MPEG_VIDEO_LEVEL_UNKNOWN;
return PVMFFailure;
}
PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "PVMFOMXEncNode-%s::GetProfileAndLevel() iEncoder is Null", iNodeTypeId));
aProfile = PV_MPEG_VIDEO_RESERVED_PROFILE;
- aLevel = PV_MPEG_VIDEO_LEVEL_UNKNOWN;
+ aLevel = PV_MPEG_VIDEO_LEVEL_UNKNOWN;
// DV: FOR NOW, JUST RETURN FAILURE, WE DON'T SUPPORT THIS FEATURE YET
return PVMFFailure;
@@ -8798,8 +8798,8 @@
// this particular API is used only for AMR (NB or WB)
// do some error checking - make sure that NB (i.e. WB) bitrates correspond to NB (i.e. WB) codec
if ((iOutFormat == PVMF_MIME_AMR_IF2) ||
- (iOutFormat == PVMF_MIME_AMR_IETF)
- )
+ (iOutFormat == PVMF_MIME_AMR_IETF)
+ )
{
switch (aBitRate)
@@ -8926,9 +8926,9 @@
{
// do some error checking - make sure the input sampling rate is 8khz (i.e. 16khz) for AMRNB (i.e. WB)
if (((iOutFormat == PVMF_MIME_AMR_IF2) ||
- (iOutFormat == PVMF_MIME_AMR_IETF)) &&
- (aSamplingRate != 8000)
- )
+ (iOutFormat == PVMF_MIME_AMR_IETF)) &&
+ (aSamplingRate != 8000)
+ )
{
PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
(0, "PVMFOMXEncNode-%s::SetInputBitsSamplingRate() failed - %d", iNodeTypeId, aSamplingRate));
@@ -8980,10 +8980,10 @@
// do some error checking - make sure the number of INPUT channels is 1 for AMR (NB or WB)
if (((iOutFormat == PVMF_MIME_AMR_IF2) ||
- (iOutFormat == PVMF_MIME_AMR_IETF) ||
- (iOutFormat == PVMF_MIME_AMRWB_IETF)) &&
- (aNumChannels > 1)
- )
+ (iOutFormat == PVMF_MIME_AMR_IETF) ||
+ (iOutFormat == PVMF_MIME_AMRWB_IETF)) &&
+ (aNumChannels > 1)
+ )
{
PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
(0, "PVMFOMXEncNode-%s::SetInputNumChannels() failed - %d", iNodeTypeId, aNumChannels));
@@ -9004,9 +9004,9 @@
uint32 PVMFOMXEncNode::GetOutputBitRate()
{
if ((iOutFormat == PVMF_MIME_AMR_IF2) ||
- (iOutFormat == PVMF_MIME_AMR_IETF) ||
- (iOutFormat == PVMF_MIME_AMRWB_IETF)
- )
+ (iOutFormat == PVMF_MIME_AMR_IETF) ||
+ (iOutFormat == PVMF_MIME_AMRWB_IETF)
+ )
{
switch (iAudioEncodeParam.iAMRBitrate)
@@ -9135,7 +9135,7 @@
switch (aIndex)
{
- case SAMPLING_RATE: // "sampling_rate"
+ case SAMPLING_RATE: // "sampling_rate"
if (PVMI_KVPATTR_CUR == aReqattr)
{
// get the parameter here
@@ -9154,7 +9154,7 @@
}
break;
- case CHANNELS: // "channels"
+ case CHANNELS: // "channels"
if (PVMI_KVPATTR_CUR == aReqattr)
{
@@ -9172,7 +9172,7 @@
}
break;
- case ENCODING_MODE: // "encoding_mode"
+ case ENCODING_MODE: // "encoding_mode"
if (PVMI_KVPATTR_CUR == aReqattr)
{
// Return current value
@@ -9402,7 +9402,7 @@
if ((
(pv_mime_strcmp(compstr, _STRLIT_CHAR("x-pvmf/encoder/video")) < 0) &&
(pv_mime_strcmp(compstr, _STRLIT_CHAR("x-pvmf/encoder/audio")) < 0)
- ) || (compcount < 4))
+ ) || (compcount < 4))
{
// First 3 components should be "x-pvmf/encoder/video" or "x-pvmf/encoder/audio" and there must
// be at least 4 components
@@ -9413,8 +9413,8 @@
// check if audio parameters are asked from video enc instance or vice versa
if (((pv_mime_strcmp(compstr, _STRLIT_CHAR("x-pvmf/encoder/video")) > 0) && (iInFormat == PVMF_MIME_PCM16)) ||
- ((pv_mime_strcmp(compstr, _STRLIT_CHAR("x-pvmf/encoder/audio")) > 0) && (iInFormat != PVMF_MIME_PCM16))
- )
+ ((pv_mime_strcmp(compstr, _STRLIT_CHAR("x-pvmf/encoder/audio")) > 0) && (iInFormat != PVMF_MIME_PCM16))
+ )
{
aRetKVP = &aParameters[paramind];
@@ -9466,7 +9466,7 @@
if ((
(pv_mime_strcmp(compstr, _STRLIT_CHAR("x-pvmf/encoder/video")) < 0) &&
(pv_mime_strcmp(compstr, _STRLIT_CHAR("x-pvmf/encoder/audio")) < 0)
- ) || (compcount < 4))
+ ) || (compcount < 4))
{
// First 3 components should be "x-pvmf/encoder/video" or "x-pvmf/encoder/audio" and there must
// be at least 4 components
@@ -9476,8 +9476,8 @@
// check if audio parameters are asked from video enc instance or vice versa
if (((pv_mime_strcmp(compstr, _STRLIT_CHAR("x-pvmf/encoder/video")) > 0) && (iInFormat == PVMF_MIME_PCM16)) ||
- ((pv_mime_strcmp(compstr, _STRLIT_CHAR("x-pvmf/encoder/audio")) > 0) && (iInFormat != PVMF_MIME_PCM16))
- )
+ ((pv_mime_strcmp(compstr, _STRLIT_CHAR("x-pvmf/encoder/audio")) > 0) && (iInFormat != PVMF_MIME_PCM16))
+ )
{
PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "PVMFOMXEncNode-%s::DoCapConfigGetParameters() Unsupported key", iNodeTypeId));
return PVMFErrNotSupported;
@@ -9552,7 +9552,7 @@
if ((
(pv_mime_strcmp(compstr, _STRLIT_CHAR("x-pvmf/encoder/video")) < 0) &&
(pv_mime_strcmp(compstr, _STRLIT_CHAR("x-pvmf/encoder/audio")) < 0)
- ) || (compcount < 3))
+ ) || (compcount < 3))
{
// First 3 component should be "x-pvmf/encoder/video" or "x-pvmf/encoder/audio" and there must
// be at least three components
@@ -9562,8 +9562,8 @@
// check if audio parameters are asked from video enc instance or vice versa
if (((pv_mime_strcmp(compstr, _STRLIT_CHAR("x-pvmf/encoder/video")) > 0) && (iInFormat == PVMF_MIME_PCM16)) ||
- ((pv_mime_strcmp(compstr, _STRLIT_CHAR("x-pvmf/encoder/audio")) > 0) && (iInFormat != PVMF_MIME_PCM16))
- )
+ ((pv_mime_strcmp(compstr, _STRLIT_CHAR("x-pvmf/encoder/audio")) > 0) && (iInFormat != PVMF_MIME_PCM16))
+ )
{
PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "PVMFOMXEncNode-%s::DoCapConfigReleaseParameters() Unsupported key", iNodeTypeId));
return PVMFErrNotSupported;
@@ -9640,9 +9640,9 @@
pv_mime_string_extract_type(0, aParameters[paramind].key, compstr);
if (
- ((pv_mime_strcmp(compstr, _STRLIT_CHAR("x-pvmf/encoder/video")) < 0) &&
- (pv_mime_strcmp(compstr, _STRLIT_CHAR("x-pvmf/encoder/audio")) < 0)
- ) || compcount < 3)
+ ((pv_mime_strcmp(compstr, _STRLIT_CHAR("x-pvmf/encoder/video")) < 0) &&
+ (pv_mime_strcmp(compstr, _STRLIT_CHAR("x-pvmf/encoder/audio")) < 0)
+ ) || compcount < 3)
{
// First 3 components should be "x-pvmf/encoder/video" or
// "x-pvmf/enoder/audio" and there must
@@ -9654,8 +9654,8 @@
// check if audio parameters are asked from video enc instance or vice versa
if (((pv_mime_strcmp(compstr, _STRLIT_CHAR("x-pvmf/encoder/video")) > 0) && (iInFormat == PVMF_MIME_PCM16)) ||
- ((pv_mime_strcmp(compstr, _STRLIT_CHAR("x-pvmf/encoder/audio")) > 0) && (iInFormat != PVMF_MIME_PCM16))
- )
+ ((pv_mime_strcmp(compstr, _STRLIT_CHAR("x-pvmf/encoder/audio")) > 0) && (iInFormat != PVMF_MIME_PCM16))
+ )
{
PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "PVMFOMXEncNode-%s::DoCapConfigVerifyParameters() Unsupported key", iNodeTypeId));
return PVMFErrNotSupported;
@@ -9953,4 +9953,3 @@
return true;
}
-
diff --git a/pvmi/pvmf/include/pvmf_event_handling.h b/pvmi/pvmf/include/pvmf_event_handling.h
index 7395be6..ed96505 100644
--- a/pvmi/pvmf/include/pvmf_event_handling.h
+++ b/pvmi/pvmf/include/pvmf_event_handling.h
@@ -27,17 +27,17 @@
/**
-Identifies the specific observer session
+ Identifies the specific observer session
**/
typedef int32 PVMFSessionId;
/**
-Identifies the specific API/command that was invoked
+ Identifies the specific API/command that was invoked
**/
typedef int32 PVMFCommandType;
/**
-A unique command id identifying an invocation of any command
+ A unique command id identifying an invocation of any command
**/
typedef int32 PVMFCommandId;
@@ -50,24 +50,24 @@
}PVMFEventCategory;
/**
-Identifies the type of event (error & informational)
+ Identifies the type of event (error & informational)
**/
typedef int32 PVMFEventType;
/**
-The base class for PVMF callback events
+ The base class for PVMF callback events
**/
class PVMFEventBase
{
- public:
- PVMFEventBase() {}
+ public:
+ PVMFEventBase() {}
- virtual ~PVMFEventBase() {};
- /**
- What type of event is this ?
- **/
- virtual PVMFEventCategory IsA() = 0;
+ virtual ~PVMFEventBase() {};
+ /**
+ What type of event is this ?
+ **/
+ virtual PVMFEventCategory IsA() = 0;
};
/**
@@ -78,169 +78,169 @@
**/
class PVMFCmdResp : public PVMFEventBase
{
- public:
- /**
- * Constructor for PVMFCmdResp
- */
- PVMFCmdResp(PVMFCommandId aId,
- const OsclAny* aContext,
- PVMFStatus aStatus,
- OsclAny* aEventData = NULL):
- iId(aId),
- iContext(aContext),
- iStatus(aStatus),
- iEventExtInterface(NULL),
- iEventData(aEventData)
+ public:
+ /**
+ * Constructor for PVMFCmdResp
+ */
+ PVMFCmdResp(PVMFCommandId aId,
+ const OsclAny* aContext,
+ PVMFStatus aStatus,
+ OsclAny* aEventData = NULL):
+ iId(aId),
+ iContext(aContext),
+ iStatus(aStatus),
+ iEventExtInterface(NULL),
+ iEventData(aEventData)
+ {
+ iEventDataLengthAvailable = false;
+ iEventDataLength = 0;
+ }
+
+ /**
+ * Constructor for PVMFCmdResp
+ */
+ PVMFCmdResp(PVMFCommandId aId,
+ const OsclAny* aContext,
+ PVMFStatus aStatus,
+ PVInterface* aEventExtInterface):
+ iId(aId),
+ iContext(aContext),
+ iStatus(aStatus),
+ iEventExtInterface(aEventExtInterface),
+ iEventData(NULL)
+ {
+ iEventDataLengthAvailable = false;
+ iEventDataLength = 0;
+ }
+
+ /**
+ * Constructor for PVMFCmdResp
+ */
+ PVMFCmdResp(PVMFCommandId aId,
+ const OsclAny* aContext,
+ PVMFStatus aStatus,
+ PVInterface* aEventExtInterface,
+ OsclAny* aEventData):
+ iId(aId),
+ iContext(aContext),
+ iStatus(aStatus),
+ iEventExtInterface(aEventExtInterface),
+ iEventData(aEventData)
+ {
+ iEventDataLengthAvailable = false;
+ iEventDataLength = 0;
+ }
+
+ virtual ~PVMFCmdResp() {}
+
+ PVMFEventCategory IsA()
+ {
+ return PVMFCmdRespEvent;
+ }
+
+ /**
+ * @return Returns the unique ID associated with a command of this type.
+ */
+ PVMFCommandId GetCmdId()const
+ {
+ return iId;
+ }
+
+ /**
+ * @return Returns the opaque data that was passed in with the command.
+ */
+ const OsclAny* GetContext()const
+ {
+ return iContext;
+ }
+
+ /**
+ * @return Returns the completion status of the command
+ */
+ PVMFStatus GetCmdStatus()const
+ {
+ return iStatus;
+ }
+
+ /**
+ * This method is going to be deprecated soon. We intend to remove
+ * the opaque event data and use PVInterface pointer if needed to
+ * retrieve more information regarding command completion
+ *
+ *
+ * @return Returns additional data asociated with the command/event. This is to be interpreted
+ based on the type and the return status
+ */
+ OsclAny* GetEventData()const
+ {
+ return iEventData;
+ }
+
+ /**
+ * This method is going to be deprecated soon. We intend to remove
+ * the opaque event data and use PVInterface pointer if needed to
+ * retrieve more information regarding command completion.Therefore,
+ * with the removal of event data, setting length of event data wont be of any significance either.
+ *
+ * @param1 - (uint32) length of event data in bytes.
+ * @return PVMFSuccess, if length of event data can be set.
+ PVMFFailure, if length of event data can't be set.
+ */
+ PVMFStatus SetEventDataLen(uint32 aEventDataLength)
+ {
+ PVMFStatus status = PVMFFailure;
+ if (iEventData)
{
- iEventDataLengthAvailable = false;
- iEventDataLength = 0;
+ iEventDataLengthAvailable = true;
+ iEventDataLength = aEventDataLength;
+ status = PVMFSuccess;
}
+ return status;
+ }
- /**
- * Constructor for PVMFCmdResp
- */
- PVMFCmdResp(PVMFCommandId aId,
- const OsclAny* aContext,
- PVMFStatus aStatus,
- PVInterface* aEventExtInterface):
- iId(aId),
- iContext(aContext),
- iStatus(aStatus),
- iEventExtInterface(aEventExtInterface),
- iEventData(NULL)
+ /**
+ * This method is going to be deprecated soon. We intend to remove
+ * the opaque event data and use PVInterface pointer if needed to
+ * retrieve more information regarding command completion.Therefore,
+ * with the removal of event data, length if event data wont be needed either.
+ *
+ * @param1 - bool& aEventDataLenAvailable
+ * false - length of event data(in bytes) is not available
+ * true - length of event data(in bytes) is available
+ * @param2 - uint32& aEventDataLength
+ * length of eventdata in bytes
+ */
+ void GetEventDataLen(bool& aEventDataLenAvailable, uint32& aEventDataLength)const
+ {
+ aEventDataLenAvailable = false;
+ aEventDataLength = 0;
+ if (iEventDataLengthAvailable)
{
- iEventDataLengthAvailable = false;
- iEventDataLength = 0;
+ aEventDataLenAvailable = true;
+ aEventDataLength = iEventDataLength;
}
+ }
- /**
- * Constructor for PVMFCmdResp
- */
- PVMFCmdResp(PVMFCommandId aId,
- const OsclAny* aContext,
- PVMFStatus aStatus,
- PVInterface* aEventExtInterface,
- OsclAny* aEventData):
- iId(aId),
- iContext(aContext),
- iStatus(aStatus),
- iEventExtInterface(aEventExtInterface),
- iEventData(aEventData)
- {
- iEventDataLengthAvailable = false;
- iEventDataLength = 0;
- }
+ /**
+ * @return Returns the eventinfointerface
+ */
+ PVInterface* GetEventExtensionInterface() const
+ {
+ return iEventExtInterface;
+ }
- virtual ~PVMFCmdResp() {}
-
- PVMFEventCategory IsA()
- {
- return PVMFCmdRespEvent;
- }
-
- /**
- * @return Returns the unique ID associated with a command of this type.
- */
- PVMFCommandId GetCmdId()const
- {
- return iId;
- }
-
- /**
- * @return Returns the opaque data that was passed in with the command.
- */
- const OsclAny* GetContext()const
- {
- return iContext;
- }
-
- /**
- * @return Returns the completion status of the command
- */
- PVMFStatus GetCmdStatus()const
- {
- return iStatus;
- }
-
- /**
- * This method is going to be deprecated soon. We intend to remove
- * the opaque event data and use PVInterface pointer if needed to
- * retrieve more information regarding command completion
- *
- *
- * @return Returns additional data asociated with the command/event. This is to be interpreted
- based on the type and the return status
- */
- OsclAny* GetEventData()const
- {
- return iEventData;
- }
-
- /**
- * This method is going to be deprecated soon. We intend to remove
- * the opaque event data and use PVInterface pointer if needed to
- * retrieve more information regarding command completion.Therefore,
- * with the removal of event data, setting length of event data wont be of any significance either.
- *
- * @param1 - (uint32) length of event data in bytes.
- * @return PVMFSuccess, if length of event data can be set.
- PVMFFailure, if length of event data can't be set.
- */
- PVMFStatus SetEventDataLen(uint32 aEventDataLength)
- {
- PVMFStatus status = PVMFFailure;
- if (iEventData)
- {
- iEventDataLengthAvailable = true;
- iEventDataLength = aEventDataLength;
- status = PVMFSuccess;
- }
- return status;
- }
-
- /**
- * This method is going to be deprecated soon. We intend to remove
- * the opaque event data and use PVInterface pointer if needed to
- * retrieve more information regarding command completion.Therefore,
- * with the removal of event data, length if event data wont be needed either.
- *
- * @param1 - bool& aEventDataLenAvailable
- * false - length of event data(in bytes) is not available
- * true - length of event data(in bytes) is available
- * @param2 - uint32& aEventDataLength
- * length of eventdata in bytes
- */
- void GetEventDataLen(bool& aEventDataLenAvailable, uint32& aEventDataLength)const
- {
- aEventDataLenAvailable = false;
- aEventDataLength = 0;
- if (iEventDataLengthAvailable)
- {
- aEventDataLenAvailable = true;
- aEventDataLength = iEventDataLength;
- }
- }
-
- /**
- * @return Returns the eventinfointerface
- */
- PVInterface* GetEventExtensionInterface() const
- {
- return iEventExtInterface;
- }
-
- protected:
- PVMFCommandId iId;
- const OsclAny* iContext;
- PVMFStatus iStatus;
- PVInterface* iEventExtInterface;
- /**
- * We STRONGLY DISCOURAGE use of this. This field will be deprecated
- * soon.
- */
- OsclAny* iEventData;
- bool iEventDataLengthAvailable;
- uint32 iEventDataLength;
+ protected:
+ PVMFCommandId iId;
+ const OsclAny* iContext;
+ PVMFStatus iStatus;
+ PVInterface* iEventExtInterface;
+ /**
+ * We STRONGLY DISCOURAGE use of this. This field will be deprecated
+ * soon.
+ */
+ OsclAny* iEventData;
+ bool iEventDataLengthAvailable;
+ uint32 iEventDataLength;
};
@@ -254,218 +254,218 @@
#define PVMF_ASYNC_EVENT_LOCAL_BUF_SIZE 16
class PVMFAsyncEvent : public PVMFEventBase
{
- public:
- PVMFAsyncEvent(PVMFEventCategory aEventCategory,
- PVMFEventType aEventType,
- OsclAny* aContext,
- OsclAny* aEventData) :
- iEventCategory(aEventCategory)
- , iEventType(aEventType)
- , iEventExtInterface(NULL)
- , iLocalBufferSize(0)
- , iContext(aContext)
- , iEventData(aEventData)
- {
- oscl_memset(iLocalBuffer, 0, PVMF_ASYNC_EVENT_LOCAL_BUF_SIZE);
- iEventDataLengthAvailable = false;
- iEventDataLength = 0;
- }
+ public:
+ PVMFAsyncEvent(PVMFEventCategory aEventCategory,
+ PVMFEventType aEventType,
+ OsclAny* aContext,
+ OsclAny* aEventData) :
+ iEventCategory(aEventCategory)
+ , iEventType(aEventType)
+ , iEventExtInterface(NULL)
+ , iLocalBufferSize(0)
+ , iContext(aContext)
+ , iEventData(aEventData)
+ {
+ oscl_memset(iLocalBuffer, 0, PVMF_ASYNC_EVENT_LOCAL_BUF_SIZE);
+ iEventDataLengthAvailable = false;
+ iEventDataLength = 0;
+ }
- PVMFAsyncEvent(PVMFEventCategory aEventCategory,
- PVMFEventType aEventType,
- OsclAny* aContext,
- OsclAny* aEventData,
- const void* aLocalBuffer,
- const size_t aLocalBufferSize) :
- iEventCategory(aEventCategory)
- , iEventType(aEventType)
- , iEventExtInterface(NULL)
- , iLocalBufferSize(aLocalBufferSize)
- , iContext(aContext)
- , iEventData(aEventData)
+ PVMFAsyncEvent(PVMFEventCategory aEventCategory,
+ PVMFEventType aEventType,
+ OsclAny* aContext,
+ OsclAny* aEventData,
+ const void* aLocalBuffer,
+ const size_t aLocalBufferSize) :
+ iEventCategory(aEventCategory)
+ , iEventType(aEventType)
+ , iEventExtInterface(NULL)
+ , iLocalBufferSize(aLocalBufferSize)
+ , iContext(aContext)
+ , iEventData(aEventData)
+ {
+ if (aLocalBuffer)
{
- if (aLocalBuffer)
+ OSCL_ASSERT(iLocalBufferSize <= PVMF_ASYNC_EVENT_LOCAL_BUF_SIZE);
+ if (iLocalBufferSize > PVMF_ASYNC_EVENT_LOCAL_BUF_SIZE)
{
- OSCL_ASSERT(iLocalBufferSize <= PVMF_ASYNC_EVENT_LOCAL_BUF_SIZE);
- if (iLocalBufferSize > PVMF_ASYNC_EVENT_LOCAL_BUF_SIZE)
- {
- iLocalBufferSize = PVMF_ASYNC_EVENT_LOCAL_BUF_SIZE;
- }
-
- oscl_memcpy(iLocalBuffer, aLocalBuffer, iLocalBufferSize);
+ iLocalBufferSize = PVMF_ASYNC_EVENT_LOCAL_BUF_SIZE;
}
- iEventDataLengthAvailable = false;
- iEventDataLength = 0;
- }
- PVMFAsyncEvent(PVMFEventCategory aEventCategory,
- PVMFEventType aEventType,
- OsclAny* aContext,
- PVInterface* aEventExtInterface,
- OsclAny* aEventData) :
- iEventCategory(aEventCategory)
- , iEventType(aEventType)
- , iEventExtInterface(aEventExtInterface)
- , iLocalBufferSize(0)
- , iContext(aContext)
- , iEventData(aEventData)
- {
- oscl_memset(iLocalBuffer, 0, PVMF_ASYNC_EVENT_LOCAL_BUF_SIZE);
- iEventDataLengthAvailable = false;
- iEventDataLength = 0;
+ oscl_memcpy(iLocalBuffer, aLocalBuffer, iLocalBufferSize);
}
+ iEventDataLengthAvailable = false;
+ iEventDataLength = 0;
+ }
- PVMFAsyncEvent(PVMFEventCategory aEventCategory,
- PVMFEventType aEventType,
- OsclAny* aContext,
- PVInterface* aEventExtInterface,
- OsclAny* aEventData,
- const void* aLocalBuffer,
- const size_t aLocalBufferSize) :
- iEventCategory(aEventCategory)
- , iEventType(aEventType)
- , iEventExtInterface(aEventExtInterface)
- , iLocalBufferSize(aLocalBufferSize)
- , iContext(aContext)
- , iEventData(aEventData)
+ PVMFAsyncEvent(PVMFEventCategory aEventCategory,
+ PVMFEventType aEventType,
+ OsclAny* aContext,
+ PVInterface* aEventExtInterface,
+ OsclAny* aEventData) :
+ iEventCategory(aEventCategory)
+ , iEventType(aEventType)
+ , iEventExtInterface(aEventExtInterface)
+ , iLocalBufferSize(0)
+ , iContext(aContext)
+ , iEventData(aEventData)
+ {
+ oscl_memset(iLocalBuffer, 0, PVMF_ASYNC_EVENT_LOCAL_BUF_SIZE);
+ iEventDataLengthAvailable = false;
+ iEventDataLength = 0;
+ }
+
+ PVMFAsyncEvent(PVMFEventCategory aEventCategory,
+ PVMFEventType aEventType,
+ OsclAny* aContext,
+ PVInterface* aEventExtInterface,
+ OsclAny* aEventData,
+ const void* aLocalBuffer,
+ const size_t aLocalBufferSize) :
+ iEventCategory(aEventCategory)
+ , iEventType(aEventType)
+ , iEventExtInterface(aEventExtInterface)
+ , iLocalBufferSize(aLocalBufferSize)
+ , iContext(aContext)
+ , iEventData(aEventData)
+ {
+ if (aLocalBuffer)
{
- if (aLocalBuffer)
+ OSCL_ASSERT(iLocalBufferSize <= PVMF_ASYNC_EVENT_LOCAL_BUF_SIZE);
+ if (iLocalBufferSize > PVMF_ASYNC_EVENT_LOCAL_BUF_SIZE)
{
- OSCL_ASSERT(iLocalBufferSize <= PVMF_ASYNC_EVENT_LOCAL_BUF_SIZE);
- if (iLocalBufferSize > PVMF_ASYNC_EVENT_LOCAL_BUF_SIZE)
- {
- iLocalBufferSize = PVMF_ASYNC_EVENT_LOCAL_BUF_SIZE;
- }
-
- oscl_memcpy(iLocalBuffer, aLocalBuffer, iLocalBufferSize);
+ iLocalBufferSize = PVMF_ASYNC_EVENT_LOCAL_BUF_SIZE;
}
- iEventDataLengthAvailable = false;
- iEventDataLength = 0;
+
+ oscl_memcpy(iLocalBuffer, aLocalBuffer, iLocalBufferSize);
}
+ iEventDataLengthAvailable = false;
+ iEventDataLength = 0;
+ }
- virtual ~PVMFAsyncEvent() {}
+ virtual ~PVMFAsyncEvent() {}
- PVMFEventCategory IsA()
+ PVMFEventCategory IsA()
+ {
+ return iEventCategory;
+ }
+
+ /**
+ * @return Returns the unique type identifier of the event.
+ */
+ PVMFEventType GetEventType()const
+ {
+ return iEventType;
+ }
+
+ /**
+ * This method is going to be deprecated soon. We intend to remove
+ * the opaque event data and use PVInterface pointer if needed to
+ * retrieve more information regarding command completion
+ *
+ *
+ * @return Returns additional data asociated with the event.
+ * This is to be interpreted
+ * based on the type and the return status
+ */
+ OsclAny* GetEventData() const
+ {
+ return iEventData;
+ }
+
+ /**
+ * This method is going to be deprecated soon. We intend to remove
+ * the opaque event data and use PVInterface pointer if needed to
+ * retrieve more information regarding command completion.Therefore,
+ * with the removal of event data, setting length of event data wont be of any significance either.
+ *
+ * @param1 - (uint32) length of event data in bytes.
+ * @return PVMFSuccess, if length of event data can be set.
+ PVMFFailure, if length of event data can't be set.
+ */
+ PVMFStatus SetEventDataLen(uint32 aEventDataLength)
+ {
+ PVMFStatus status = PVMFFailure;
+ if (iEventData)
{
- return iEventCategory;
+ iEventDataLengthAvailable = true;
+ iEventDataLength = aEventDataLength;
+ status = PVMFSuccess;
}
+ return status;
+ }
- /**
- * @return Returns the unique type identifier of the event.
- */
- PVMFEventType GetEventType()const
+ /**
+ * This method is going to be deprecated soon. We intend to remove
+ * the opaque event data and use PVInterface pointer if needed to
+ * retrieve more information regarding command completion.Therefore,
+ * with the removal of event data, length if event data wont be needed either.
+ *
+ * @param1 - bool& aEventDataLenAvailable
+ * false - length of event data(in bytes) is not available
+ * true - length of event data(in bytes) is available
+ * @param2 - uint32& aEventDataLength
+ * length of eventdata in bytes
+ */
+ void GetEventDataLen(bool& aEventDataLenAvailable, uint32& aEventDataLength)const
+ {
+ aEventDataLenAvailable = false;
+ aEventDataLength = 0;
+ if (iEventDataLengthAvailable)
{
- return iEventType;
+ aEventDataLenAvailable = true;
+ aEventDataLength = iEventDataLength;
}
+ }
- /**
- * This method is going to be deprecated soon. We intend to remove
- * the opaque event data and use PVInterface pointer if needed to
- * retrieve more information regarding command completion
- *
- *
- * @return Returns additional data asociated with the event.
- * This is to be interpreted
- * based on the type and the return status
- */
- OsclAny* GetEventData() const
- {
- return iEventData;
- }
+ /**
+ * @return Returns the size of the local data asociated with the event.
+ */
+ size_t GetLocalBufferSize() const
+ {
+ return iLocalBufferSize;
+ }
- /**
- * This method is going to be deprecated soon. We intend to remove
- * the opaque event data and use PVInterface pointer if needed to
- * retrieve more information regarding command completion.Therefore,
- * with the removal of event data, setting length of event data wont be of any significance either.
- *
- * @param1 - (uint32) length of event data in bytes.
- * @return PVMFSuccess, if length of event data can be set.
- PVMFFailure, if length of event data can't be set.
- */
- PVMFStatus SetEventDataLen(uint32 aEventDataLength)
- {
- PVMFStatus status = PVMFFailure;
- if (iEventData)
- {
- iEventDataLengthAvailable = true;
- iEventDataLength = aEventDataLength;
- status = PVMFSuccess;
- }
- return status;
- }
+ /**
+ * @return Returns the local data asociated with the event.
+ */
+ // TODO: This is a const method returning a non const ref to some
+ // internal array.
+ uint8* GetLocalBuffer() const
+ {
+ return (uint8*)iLocalBuffer;
+ }
- /**
- * This method is going to be deprecated soon. We intend to remove
- * the opaque event data and use PVInterface pointer if needed to
- * retrieve more information regarding command completion.Therefore,
- * with the removal of event data, length if event data wont be needed either.
- *
- * @param1 - bool& aEventDataLenAvailable
- * false - length of event data(in bytes) is not available
- * true - length of event data(in bytes) is available
- * @param2 - uint32& aEventDataLength
- * length of eventdata in bytes
- */
- void GetEventDataLen(bool& aEventDataLenAvailable, uint32& aEventDataLength)const
- {
- aEventDataLenAvailable = false;
- aEventDataLength = 0;
- if (iEventDataLengthAvailable)
- {
- aEventDataLenAvailable = true;
- aEventDataLength = iEventDataLength;
- }
- }
+ /**
+ * @return Returns the opaque data associated with the callback type.
+ */
+ const OsclAny* GetContext()const
+ {
+ return iContext;
+ }
- /**
- * @return Returns the size of the local data asociated with the event.
- */
- size_t GetLocalBufferSize() const
- {
- return iLocalBufferSize;
- }
+ /**
+ * @return Returns the eventinfointerface
+ */
+ PVInterface* GetEventExtensionInterface() const
+ {
+ return iEventExtInterface;
+ }
- /**
- * @return Returns the local data asociated with the event.
- */
- // TODO: This is a const method returning a non const ref to some
- // internal array.
- uint8* GetLocalBuffer() const
- {
- return (uint8*)iLocalBuffer;
- }
-
- /**
- * @return Returns the opaque data associated with the callback type.
- */
- const OsclAny* GetContext()const
- {
- return iContext;
- }
-
- /**
- * @return Returns the eventinfointerface
- */
- PVInterface* GetEventExtensionInterface() const
- {
- return iEventExtInterface;
- }
-
- protected:
- PVMFEventCategory iEventCategory;
- PVMFEventType iEventType;
- PVInterface* iEventExtInterface;
- uint8 iLocalBuffer[PVMF_ASYNC_EVENT_LOCAL_BUF_SIZE];
- size_t iLocalBufferSize;
- OsclAny* iContext;
- /**
- * We STRONGLY DISCOURAGE use of this. This field will be deprecated
- * soon.
- */
- OsclAny* iEventData;
- bool iEventDataLengthAvailable;
- uint32 iEventDataLength;
+ protected:
+ PVMFEventCategory iEventCategory;
+ PVMFEventType iEventType;
+ PVInterface* iEventExtInterface;
+ uint8 iLocalBuffer[PVMF_ASYNC_EVENT_LOCAL_BUF_SIZE];
+ size_t iLocalBufferSize;
+ OsclAny* iContext;
+ /**
+ * We STRONGLY DISCOURAGE use of this. This field will be deprecated
+ * soon.
+ */
+ OsclAny* iEventData;
+ bool iEventDataLengthAvailable;
+ uint32 iEventDataLength;
};
#endif // PVMF_EVENT_HANDLING_H_INCLUDED