00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "freMediaBridgeController.h"
00024 #include "freExceptions.h"
00025
00026 namespace FREE
00027 {
00028
00032
00033 MediaBridgeController::GenericMediaPointer
00034 MediaBridgeController::
00035 GetMediaCasted(const MediaID& mediaID,
00036 ComponentType* pComponent,
00037 SessionComponentCache* pComponentCache,
00038 SessionInfo* pSessionInfo) const
00039 {
00040 if (!pComponentCache) throwCtrlExceptionMacro("","Passed component cache is NULL.");
00041 if (!pSessionInfo) throwCtrlExceptionMacro("","Passed session info is NULL.");
00042
00043 ComponentMediaLink::Pointer smpLink = pComponentCache->Setup()->MediaLinks().GetElement(mediaID);
00044 if (smpLink.IsNotNull())
00045 {
00046 try
00047 {
00048 GenericMediaPointer smpMedia = SessionAccessor::GetLinkedMedia(mediaID, pComponentCache, pSessionInfo);
00049 return smpMedia;
00050 }
00051 catchAllNPassMacro("Error while getting bridged media. Media ID: "<<mediaID<<" ; link: "<<smpLink->GetSourceIDPath().ToStr());
00052 }
00053 else
00054 {
00055 return Superclass::GetMediaCasted(mediaID, pComponent, pComponentCache, pSessionInfo);
00056 }
00057 };
00058
00059 void
00060 MediaBridgeController::
00061 SetMediaCasted(const MediaID& mediaID, GenericMediaType* pMedia, ComponentType* pComponent,
00062 SessionComponentCache* pComponentCache,
00063 SessionInfo* pSessionInfo) const
00064 {
00065 if (!pComponentCache) throwCtrlExceptionMacro("","Passed component cache is NULL.");
00066 if (!pSessionInfo) throwCtrlExceptionMacro("","Passed session info is NULL.");
00067
00068 ComponentMediaLink::Pointer smpLink = pComponentCache->Setup()->MediaLinks().GetElement(mediaID);
00069 if (smpLink.IsNotNull())
00070 {
00071 try
00072 {
00073 GenericMediaPointer smpMedia = pMedia;
00074 SessionAccessor::SetMedia(smpLink->GetSourceIDPath(), smpMedia, pSessionInfo);
00075 }
00076 catchAllNPassMacro("Error while setting bridged media. Media ID: "<<mediaID<<" ; link: "<<smpLink->GetSourceIDPath().ToStr());
00077 }
00078 else
00079 {
00080 Superclass::SetMediaCasted(mediaID, pMedia, pComponent, pComponentCache, pSessionInfo);
00081 }
00082 };
00083
00084 MediaBridgeController::
00085 MediaBridgeController()
00086 {
00087 this->UpdateControllerID(ControllerID::MediaBridgeController);
00088 this->m_Description = "Media bridge offering the possibility of logical bridges/stubs (e.g. used as final media repository).";
00089 };
00090
00091 ValidityTag::Pointer
00092 MediaBridgeController::
00093 GetMediaValidityTag(const MediaID& mediaID, SessionComponentCache* pComponentCache) const
00094 {
00095 if (!pComponentCache) throwCtrlExceptionMacro("","Passed component cache is NULL.");
00096
00097 ComponentMediaLink::Pointer smpLink = pComponentCache->Setup()->MediaLinks().GetElement(mediaID);
00098 if (smpLink.IsNotNull())
00099 {
00100 try
00101 {
00102 return SessionAccessor::GetValidityTag(smpLink->GetSourceIDPath(),pComponentCache);
00103 }
00104 catchAllNPassMacro("Error while retrieving validity tag. Media ID: "<<mediaID<<" ; link: "<<smpLink->GetSourceIDPath().ToStr());
00105 }
00106 else
00107 {
00108 return Superclass::GetMediaValidityTag(mediaID, pComponentCache);
00109 }
00110 };
00111
00112 ValidityTag::Pointer
00113 MediaBridgeController::
00114 GetMediaValidityTagRequirement(const MediaID& mediaID, SessionComponentCache* pComponentCache) const
00115 {
00116 if (!pComponentCache) throwCtrlExceptionMacro("","Passed component cache is NULL.");
00117
00118 ComponentMediaLink::Pointer smpLink = pComponentCache->Setup()->MediaLinks().GetElement(mediaID);
00119 if (smpLink.IsNotNull())
00120 {
00121 try
00122 {
00123 return SessionAccessor::GetValidityTagRequirement(smpLink->GetSourceIDPath(),pComponentCache);
00124 }
00125 catchAllNPassMacro("Error while retrieving validity tag requirement. Media ID: "<<mediaID<<" ; link: "<<smpLink->GetSourceIDPath().ToStr());
00126 }
00127 else
00128 {
00129 return Superclass::GetMediaValidityTagRequirement(mediaID, pComponentCache);
00130 }
00131 };
00132
00133 std::string
00134 MediaBridgeController::
00135 GetMediaControllerID(const MediaID& mediaID, SessionComponentCache* pComponentCache) const
00136 {
00137 if (!pComponentCache) throwCtrlExceptionMacro("","Passed component cache is NULL.");
00138
00139 ComponentMediaLink::Pointer smpLink = pComponentCache->Setup()->MediaLinks().GetElement(mediaID);
00140 if (smpLink.IsNotNull())
00141 {
00142 try
00143 {
00144 return SessionAccessor::GetMediaControllerID(smpLink->GetSourceIDPath(),pComponentCache);
00145 }
00146 catchAllNPassMacro("Error while retrieving controller id. Media ID: "<<mediaID<<" ; link: "<<smpLink->GetSourceIDPath().ToStr());
00147 }
00148
00149 return csUndefinedController;
00150 };
00151
00152 }