[asterisk-scf-commits] asterisk-scf/integration/file_media_service.git branch "initial_development" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Wed Jan 4 09:45:14 CST 2012
branch "initial_development" has been updated
via 3d42016cb464898fa770a0c1f433bfccfae6794c (commit)
via f05184d8c4f6136c5e378f4d9d3ccef45e8b5b64 (commit)
from 1fb23472383c068f386784761b3591cefec7c11f (commit)
Summary of changes:
config/FileMediaServiceConfigurator.py | 18 +-
.../FileMediaServiceConfigurationIf.ice | 20 -
src/CMakeLists.txt | 6 +-
src/Component.cpp | 2 +-
src/Configuration.cpp | 181 ++------
src/Configuration.h | 4 +-
src/ContainerImpl.cpp | 253 +++++-----
src/ContainerImpl.h | 22 +-
...ositoryReplicationAdapter.h => ContainerInfo.h} | 19 +-
src/ContainerRepository.cpp | 507 ++++++--------------
src/ContainerRepository.h | 2 +
src/FileMediaServiceReplicator.cpp | 2 +-
src/MatroskaUtil.cpp | 23 +-
src/MatroskaUtil.h | 20 +-
src/ReplicatedObject.cpp | 10 +-
src/ReplicationListener.cpp | 67 +++
src/ReplicationListener.h | 2 +
src/Replicator.h | 8 +-
src/RepositoryConfigurationAdapter.h | 34 +-
test/CMakeLists.txt | 2 +
test/UnitTest_ContainerRepository.cpp | 85 +---
21 files changed, 492 insertions(+), 795 deletions(-)
copy src/{RepositoryReplicationAdapter.h => ContainerInfo.h} (64%)
create mode 100644 src/ReplicationListener.cpp
- Log -----------------------------------------------------------------
commit 3d42016cb464898fa770a0c1f433bfccfae6794c
Author: Brent Eagles <beagles at digium.com>
Date: Wed Jan 4 12:14:31 2012 -0330
* Add missing files
* Fixup tests somewhat
* Fix bugs in container writer
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 94c645f..58eb975 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -23,8 +23,11 @@ astscf_component_add_files(FileMediaService
ComponentFeature.h
LoggerF.h
ReplicationListener.h
+ ReplicationListener.cpp
RepositoryConfigurationAdapter.h
RepositoryReplicationAdapter.h
+ ReplicatedObject.h
+ ReplicatedObject.cpp
)
astscf_component_add_files(FileMediaService
diff --git a/src/Configuration.cpp b/src/Configuration.cpp
index 5199f67..a72834f 100644
--- a/src/Configuration.cpp
+++ b/src/Configuration.cpp
@@ -15,6 +15,8 @@
*/
#include "Configuration.h"
+#include "ContainerConfigurationAdapter.h"
+#include "RepositoryConfigurationAdapter.h"
#include <AsteriskSCF/Configuration/FileMediaService/FileMediaServiceConfigurationIf.h>
#include <AsteriskSCF/logger.h>
@@ -38,14 +40,13 @@ public:
ConfigurationImpl(const ContainerRepositoryImplPtr& containerRepository,
const Logger& logger) :
mContainerRepository(containerRepository),
- mRemoteServices(remoteServices),
mLogger(logger)
{
}
ConfigurationGroupSeq getConfiguration(const ConfigurationGroupSeq& groups, const Ice::Current&)
{
- ConfigurationAdapterPtr configAdapter = mContainerRepository->getConfigurationAdapter();
+ RepositoryConfigurationAdapterPtr configAdapter = mContainerRepository->configurationAdapter();
ReplicationParameterGroupPtr replicationConfigurationGroup;
RepositoryGroupPtr repositoryConfigurationGroup;
vector<ContainerConfigurationPtr> containerConfigurations;
@@ -63,20 +64,20 @@ public:
replicationParameters->configurationItems.find(ProgressUpdateIntervalItem);
if (itemIter != replicationParameters->configurationItems.end())
{
- PrgoressUpdateIntervalPtr updateInterval = new ProgressUpdateInterval;
+ ProgressUpdateIntervalPtr updateInterval = new ProgressUpdateInterval;
updateInterval->value = configAdapter->getProgressUpdateInterval();
if (!replicationConfigurationGroup)
{
replicationConfigurationGroup = new ReplicationParameterGroup;
- result.push_back(resultGroup);
+ result.push_back(replicationConfigurationGroup);
}
- replicationConfiugrationGroup->configurationItems[itemIter->first] = updateInterval;
+ replicationConfigurationGroup->configurationItems[itemIter->first] = updateInterval;
}
continue;
}
RepositoryGroupPtr repositoryGroup = RepositoryGroupPtr::dynamicCast(*iter);
- if (respositoryGroup)
+ if (repositoryGroup)
{
ConfigurationItemDict::const_iterator itemIter =
repositoryGroup->configurationItems.find(RepositoryLocationItem);
@@ -95,7 +96,7 @@ public:
continue;
}
- ContainerConfigurationPtr containerGroup = ContainerConfigurationPtr::dynamicCast(*iter);
+ ContainerGroupPtr containerGroup = ContainerGroupPtr::dynamicCast(*iter);
if (containerGroup)
{
ConfigurationItemDict::const_iterator itemIter =
@@ -115,15 +116,13 @@ public:
containerData->catalogId = containerConfig->catalogId();
containerData->uri = containerConfig->uri();
containerData->operations = containerConfig->operations();
+ ContainerGroupPtr resultGroup = new ContainerGroup;
+ resultGroup->configurationItems[ContainerConfigurationItem] = containerData;
+ result.push_back(resultGroup);
+
}
}
}
- if (!resultItems.empty())
- {
- ContainerConfigurationGroupPtr resultGroup = new RepositoryGroup;
- resultGroup->configurationItems = resultItems;
- result.push_back(resultGroup);
- }
continue;
}
}
@@ -133,7 +132,7 @@ public:
ConfigurationGroupSeq getConfigurationAll(const ConfigurationGroupSeq& groups, const Ice::Current&)
{
ConfigurationGroupSeq result;
- ConfigurationAdapterPtr configAdapter = mContainerRepository->getConfigurationAdapter();
+ RepositoryConfigurationAdapterPtr configAdapter = mContainerRepository->configurationAdapter();
for (ConfigurationGroupSeq::const_iterator iter = groups.begin(); iter != groups.end(); ++iter)
{
@@ -141,7 +140,7 @@ public:
if (replicationParameters)
{
ProgressUpdateIntervalPtr updateInterval = new ProgressUpdateInterval;
- updateInterval->value = configAdapter->getProgressInterval();
+ updateInterval->value = configAdapter->getProgressUpdateInterval();
continue;
}
ContainerConfigurationPtr containerGroup = ContainerConfigurationPtr::dynamicCast(*iter);
@@ -150,7 +149,7 @@ public:
continue;
}
RepositoryGroupPtr repositoryGroup = RepositoryGroupPtr::dynamicCast(*iter);
- if (respositoryGroup)
+ if (repositoryGroup)
{
continue;
}
@@ -165,7 +164,7 @@ public:
return groups;
}
- void setConfiguration(const ConfigurationGroupSeq& config, const Ice::Current&)
+ void setConfiguration(const ConfigurationGroupSeq&, const Ice::Current&)
{
}
@@ -173,16 +172,16 @@ public:
// TODO: Some configuration is not really decomposeable in this way, so I will need to look at this more
// closely.
//
- void removeConfigurationItems(const ConfigurationGroupSeq& config, const Ice::Current&)
+ void removeConfigurationItems(const ConfigurationGroupSeq&, const Ice::Current&)
{
}
- void removeConfigurationGroups(const ConfigurationGroupSeq& config, const Ice::Current&)
+ void removeConfigurationGroups(const ConfigurationGroupSeq&, const Ice::Current&)
{
}
private:
- ContainerRepositoryImplPtr mRepository;
+ ContainerRepositoryImplPtr mContainerRepository;
Logger mLogger;
};
typedef IceUtil::Handle<ConfigurationImpl> ConfigurationImplPtr;
@@ -190,9 +189,8 @@ typedef IceUtil::Handle<ConfigurationImpl> ConfigurationImplPtr;
class ConfigurationFeature : public ComponentFeature
{
public:
- ConfigurationFeature(const EndpointLocatorImplPtr& endpointLocator,
- const RemoteServicesPtr& remoteServices, const Logger& logger) :
- mServant(new ConfigurationImpl(endpointLocator, remoteServices, logger)),
+ ConfigurationFeature(const ContainerRepositoryImplPtr& repository, const Logger& logger) :
+ mServant(new ConfigurationImpl(repository, logger)),
mId(std::string("ascf.fsgtw.") + IceUtil::generateUUID()),
mLogger(logger)
{
@@ -206,17 +204,17 @@ public:
return mDirectProxy;
}
- void registerFeature(const FileSessionGatewayComponentPtr& gatewayComponent)
+ void registerFeature(const FileMediaServiceComponentPtr& component)
{
- assert(gatewayComponent);
- if (gatewayComponent)
+ assert(component);
+ if (component)
{
//
// This should be a public proxy because if we fail over to a
// replica, we want the proxy in discovery to be remain generally
// valid.
//
- gatewayComponent->addFeatureProxyToBackplane(mPublicProxy,
+ component->addFeatureProxyToBackplane(mPublicProxy,
AsteriskSCF::Configuration::FileMediaService::V1::ConfigurationDiscoveryCategory);
}
else
@@ -224,7 +222,7 @@ public:
mLogger(Error) << "Unable to register configuration service. Provided component reference is nil";
}
}
-
+
void makeReady(const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& /* locator */,
const AsteriskSCF::Core::Discovery::V1::ServiceLocatorParamsPtr& /* params */)
{
diff --git a/src/ContainerImpl.cpp b/src/ContainerImpl.cpp
index 6ae1078..546eac0 100644
--- a/src/ContainerImpl.cpp
+++ b/src/ContainerImpl.cpp
@@ -29,11 +29,11 @@
#include <AsteriskSCF/logger.h>
+#include "MatroskaUtil.h"
extern "C"
{
#include <corec/helpers/file/streams.h>
}
-#include "MatroskaUtil.h"
using namespace AsteriskSCF::System::Logging;
using namespace std;
diff --git a/src/ContainerImpl.h b/src/ContainerImpl.h
index c5572bc..1dd9966 100644
--- a/src/ContainerImpl.h
+++ b/src/ContainerImpl.h
@@ -16,7 +16,6 @@
#pragma once
-#include "MatroskaUtil.h"
#include "LoggerF.h"
#include "ContainerRepository.h"
#include "ContainerInfo.h"
@@ -25,6 +24,14 @@
#include <AsteriskSCF/Media/File/FileMediaIf.h>
#include <vector>
+//
+// Forward declarations.
+//
+namespace Matroska
+{
+class Environment;
+}
+
namespace AsteriskSCF
{
namespace FileMediaService
diff --git a/src/ContainerInfo.h b/src/ContainerInfo.h
new file mode 100644
index 0000000..983d588
--- /dev/null
+++ b/src/ContainerInfo.h
@@ -0,0 +1,39 @@
+/*
+ * Asterisk SCF -- An open-source communications framework.
+ *
+ * Copyright (C) 2011, Digium, Inc.
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk SCF project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE.txt file
+ * at the top of the source tree.
+ */
+
+#pragma once
+
+#include <boost/shared_ptr.hpp>
+#include <string>
+#include <AsteriskSCF/Media/File/FileMediaIf.h>
+
+namespace AsteriskSCF
+{
+namespace FileMediaService
+{
+
+struct ContainerInfo
+{
+ std::string name;
+ std::string catalogId;
+ std::string filename;
+ AsteriskSCF::Media::File::V1::FileOperations supportedOperations;
+};
+typedef boost::shared_ptr<ContainerInfo> ContainerInfoPtr;
+typedef std::vector<ContainerInfoPtr> ContainerInfoSeq;
+
+} /* End of namespace FileMediaService */
+} /* End of namespace AsteriskSCF */
diff --git a/src/FileMediaServiceReplicator.cpp b/src/FileMediaServiceReplicator.cpp
index a991aa8..565f318 100644
--- a/src/FileMediaServiceReplicator.cpp
+++ b/src/FileMediaServiceReplicator.cpp
@@ -158,7 +158,7 @@ void FileMediaServiceReplicatorApp::start(const string& name, const Ice::Communi
// Category is specified with full scope to avoid problems with namespaces.
//
locatorParameters->category =
- AsteriskSCF::Replication::FileMediaService::V1::StateReplicatorDiscoveryCategory;
+ AsteriskSCF::Replication::FileMediaService::V1::DiscoveryCategory;
locatorParameters->service = serviceName;
locatorParameters->id = communicator->getProperties()->getPropertyWithDefault(name + ".StateReplicatorId",
"default");
diff --git a/src/MatroskaUtil.cpp b/src/MatroskaUtil.cpp
index fda74b1..cb33b27 100644
--- a/src/MatroskaUtil.cpp
+++ b/src/MatroskaUtil.cpp
@@ -899,9 +899,14 @@ bool ContainerWriter::populateHeader(const string& title, const string& filename
EBML_IntegerSetValue((ebml_integer*)el, 1);
assert(EBML_ElementParent(el) == (ebml_element*)ebmlHeader);
+ el = EBML_MasterFindFirstElt(ebmlHeader, &EBML_ContextMaxSizeLength, true, false);
+ assert(el);
+ EBML_IntegerSetValue((ebml_integer*)el, 5); // Allow up to 64 bit sizes.
+ assert(EBML_ElementParent(el) == (ebml_element*)ebmlHeader);
+
el = EBML_MasterFindFirstElt(ebmlHeader, &EBML_ContextMaxIdLength, true, false);
assert(el);
- EBML_IntegerSetValue((ebml_integer*)el, 8);
+ EBML_IntegerSetValue((ebml_integer*)el, 4);
assert(EBML_ElementParent(el) == (ebml_element*)ebmlHeader);
el = EBML_MasterFindFirstElt(ebmlHeader, &EBML_ContextDocType, true, false);
@@ -917,6 +922,7 @@ bool ContainerWriter::populateHeader(const string& title, const string& filename
assert(el);
EBML_IntegerSetValue((ebml_integer*)el, MATROSKA_VERSION);
+
cerr << "children count " << EBML_MasterCount(ebmlHeader) << endl;
cerr << EBML_ElementUpdateSize(ebmlHeader, true, false) << endl;
@@ -1155,8 +1161,8 @@ void ContainerWriter::addFrames(uint16_t trackNumber, const AsteriskSCF::Media::
mCurrentCluster = (matroska_cluster*)EBML_MasterAddElt(mSegment, &MATROSKA_ContextCluster, false);
MATROSKA_LinkClusterWriteSegmentInfo(mCurrentCluster, mSections.segmentInformation);
//
- // The cluster's timeocode is set to the timecode of the first frame for the first track block that is created
- // here.
+ // The cluster's timeocode is set to the timecode of the first
+ // frame for the first track block that is created here.
//
MATROSKA_ClusterSetTimecode(mCurrentCluster, timecode);
mSections.clusterInformation.push_back(mCurrentCluster);
@@ -1173,6 +1179,7 @@ void ContainerWriter::addFrames(uint16_t trackNumber, const AsteriskSCF::Media::
//
block.group = EBML_MasterAddElt((ebml_master*)mCurrentCluster, &MATROSKA_ContextBlockGroup, false);
block.block = (matroska_block*)EBML_MasterAddElt((ebml_master*)block.group, &MATROSKA_ContextBlock, false);
+ MATROSKA_LinkBlockWriteTrack(block.block, (ebml_master*)track);
mCurrentBlocks[trackNumber-1] = block;
MATROSKA_BlockSetTimecode(block.block, timecode, mCurrentTimecode);
}
@@ -1204,15 +1211,15 @@ void ContainerWriter::addFrames(uint16_t trackNumber, const AsteriskSCF::Media::
ShortSeqPayloadPtr shorts = ShortSeqPayloadPtr::dynamicCast((*f)->payload);
if (!shorts)
{
- size_t sz = shorts->payload.size() * sizeof(shorts->payload[0]);
- frame->Data = (uint8_t*)malloc(sz);
- memcpy(frame->Data, (uint8_t*)&bytes->payload.front(), sz);
- frame->Size = static_cast<uint32_t>(sz);
//
- // whoops! XXX add logging.
+ // XXX logging!
//
continue;
}
+ size_t sz = shorts->payload.size() * sizeof(shorts->payload[0]);
+ frame->Data = (uint8_t*)malloc(sz);
+ memcpy(frame->Data, (uint8_t*)&shorts->payload.front(), sz);
+ frame->Size = static_cast<uint32_t>(sz);
}
streamFrame = StreamFramePtr::dynamicCast(*f);
if (streamFrame)
diff --git a/src/ReplicatedObject.cpp b/src/ReplicatedObject.cpp
index fd0ed0e..c86d80f 100644
--- a/src/ReplicatedObject.cpp
+++ b/src/ReplicatedObject.cpp
@@ -17,7 +17,7 @@
#include "ReplicatedObject.h"
#include <string>
-using namespace AsteriskSCF::FileSessionGtw;
+using namespace AsteriskSCF::FileMediaService;
using namespace std;
ReplicatedObject::ReplicatedObject(const std::string& key) :
@@ -43,14 +43,14 @@ void ReplicatedObject::updateReplicator(const ReplicatorSmartProxy& replicator)
onProxyUpdate();
}
-void ReplicatedObject::update(const AsteriskSCF::Replication::FileSessionGateway::V1::StateItemPtr& stateUpdate)
+void ReplicatedObject::update(const AsteriskSCF::Replication::FileMediaService::V1::StateItemPtr& stateUpdate)
{
- AsteriskSCF::Replication::FileSessionGateway::V1::StateItemSeq seq;
+ AsteriskSCF::Replication::FileMediaService::V1::StateItemSeq seq;
seq.push_back(stateUpdate);
update(seq);
}
-void ReplicatedObject::update(const AsteriskSCF::Replication::FileSessionGateway::V1::StateItemSeq& updates)
+void ReplicatedObject::update(const AsteriskSCF::Replication::FileMediaService::V1::StateItemSeq& updates)
{
if (mReplicator)
{
@@ -91,7 +91,7 @@ void ReplicatedObject::remove(const string& key)
remove(items);
}
-void ReplicatedObject::remove(const AsteriskSCF::Replication::FileSessionGateway::V1::StateItemSeq& itemsToRemove)
+void ReplicatedObject::remove(const AsteriskSCF::Replication::FileMediaService::V1::StateItemSeq& itemsToRemove)
{
if (mReplicator)
{
diff --git a/src/ReplicationListener.cpp b/src/ReplicationListener.cpp
new file mode 100644
index 0000000..d86f291
--- /dev/null
+++ b/src/ReplicationListener.cpp
@@ -0,0 +1,67 @@
+/*
+ * Asterisk SCF -- An open-source communications framework.
+ *
+ * Copyright (C) 2011, Digium, Inc.
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk SCF project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE.txt file
+ * at the top of the source tree.
+ */
+
+#include "ReplicationListener.h"
+#include <AsteriskSCF/logger.h>
+
+using namespace AsteriskSCF::System::Logging;
+
+namespace AsteriskSCF
+{
+namespace FileMediaService
+{
+
+class ReplicationListenerImpl : public ReplicationListener
+{
+public:
+
+ ReplicationListenerImpl(const ContainerRepositoryImplPtr& repository,
+ const Ice::ObjectAdapterPtr& userAdapter,
+ const Logger& logger) :
+ mRepository(repository),
+ mAdapter(userAdapter),
+ mLogger(logger)
+ {
+ }
+
+ void stateRemoved(const Ice::StringSeq&, const Ice::Current&)
+ {
+ }
+
+ void stateRemovedForItems(const AsteriskSCF::Replication::FileMediaService::V1::StateItemSeq&,
+ const Ice::Current&)
+ {
+ }
+
+ void stateSet(const AsteriskSCF::Replication::FileMediaService::V1::StateItemSeq&, const Ice::Current&)
+ {
+ }
+
+private:
+
+ ContainerRepositoryImplPtr mRepository;
+ Ice::ObjectAdapterPtr mAdapter; // XXX needed?
+ Logger mLogger;
+};
+
+ReplicationListenerPtr ReplicationListener::create(const ContainerRepositoryImplPtr& repo,
+ const Ice::ObjectAdapterPtr& userAdapter, const Logger& logger)
+{
+ return new ReplicationListenerImpl(repo, userAdapter, logger);
+}
+
+}
+}
diff --git a/src/ReplicationListener.h b/src/ReplicationListener.h
index f8155a6..f0bff6f 100644
--- a/src/ReplicationListener.h
+++ b/src/ReplicationListener.h
@@ -36,5 +36,7 @@ public:
const Ice::ObjectAdapterPtr& userAdapter, const AsteriskSCF::System::Logging::Logger& logger);
};
+typedef IceUtil::Handle<ReplicationListener> ReplicationListenerPtr;
+
} /* End of namespace FileSessionGtw */
} /* End of namespace AsteriskSCF */
diff --git a/src/Replicator.h b/src/Replicator.h
index 76e9146..e25c513 100644
--- a/src/Replicator.h
+++ b/src/Replicator.h
@@ -36,21 +36,21 @@ typedef IceUtil::Handle<StateReplicatorI> StateReplicatorIPtr;
//
// Forward declarations.
//
-class EndpointFactory;
-class StateReplicatorListenerImpl;
+class ContainerRepositoryImpl;
+class ReplicationListenerImpl;
class StateReplicatorListenerI : public AsteriskSCF::Replication::FileMediaService::V1::StateReplicatorListener
{
public:
StateReplicatorListenerI(
- const boost::shared_ptr<EndpointFactory>& factory,
+ const boost::shared_ptr<ContainerRepositoryImpl>& repository,
const Ice::ObjectAdapterPtr& globalAdapter);
void stateRemoved(const Ice::StringSeq&, const Ice::Current&);
void stateRemovedForItems(const AsteriskSCF::Replication::FileMediaService::V1::StateItemSeq&, const Ice::Current&);
void stateSet(const AsteriskSCF::Replication::FileMediaService::V1::StateItemSeq&, const Ice::Current&);
bool operator==(const StateReplicatorListenerI &rhs);
private:
- boost::shared_ptr<StateReplicatorListenerImpl> mImpl;
+ boost::shared_ptr<ReplicationListenerImpl> mImpl;
};
};
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 64eeb97..196e876 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -11,6 +11,8 @@ include_directories(${astscf-matroska2_dir})
astscf_slice_include_collection(FILEMEDIASERVICE)
astscf_component_init(UnitTestContainerRepository)
astscf_component_add_files(UnitTestContainerRepository UnitTest_ContainerRepository.cpp)
+astscf_component_add_files(UnitTestContainerRepository ../src/ReplicatedObject.cpp)
+astscf_component_add_files(UnitTestContainerRepository ../src/ReplicatedObject.h)
astscf_component_add_files(UnitTestContainerRepository ../src/MatroskaUtil.cpp)
astscf_component_add_files(UnitTestContainerRepository ../src/MatroskaUtil.h)
diff --git a/test/UnitTest_ContainerRepository.cpp b/test/UnitTest_ContainerRepository.cpp
index bdfd33c..a2fe711 100644
--- a/test/UnitTest_ContainerRepository.cpp
+++ b/test/UnitTest_ContainerRepository.cpp
@@ -49,6 +49,7 @@
#pragma warning(pop)
#endif
+using namespace AsteriskSCF::Media::V1;
using namespace AsteriskSCF::System::Logging;
using namespace boost::unit_test;
using namespace std;
@@ -66,16 +67,12 @@ public:
void rootPathTest()
{
- ContainerRepositoryPrx repository;
try
{
- ContainerRepositoryServantPtr testImpl(new ContainerRepositoryServant(mObjectAdapter, "TestRepository", mLogger));
- BOOST_REQUIRE(testImpl != 0);
- repository = ContainerRepositoryPrx::uncheckedCast(
- mObjectAdapter->addWithUUID(testImpl));
- BOOST_REQUIRE(repository != 0);
-
- string configurationProperty = mCommunicator->getProperties()->getPropertyWithDefault("Test.RootPath", "./data");
+ ContainerRepositoryServantPtr testImpl(new ContainerRepositoryServant(mObjectAdapter, "TestRepository",
+ mLogger));
+ string configurationProperty = mCommunicator->getProperties()->getPropertyWithDefault("Test.RootPath",
+ "./data");
BOOST_REQUIRE(!configurationProperty.empty());
testImpl->configurationAdapter()->setRootPath(configurationProperty);
BOOST_CHECK(testImpl->configurationAdapter()->getRootPath() == configurationProperty);
@@ -84,64 +81,11 @@ public:
{
mLogger(Error) << "Unknown exception occurred in test.";
}
- if (repository)
- {
- mObjectAdapter->remove(repository->ice_getIdentity());
- repository = 0;
- }
- //
+ //
// This would be a good spot to put a breakpoint in a destructor if doing a code walk through.
//
}
- void rootPathScanTest()
- {
- ContainerRepositoryPrx repository;
- try
- {
- ContainerRepositoryServantPtr testImpl(new ContainerRepositoryServant(mObjectAdapter, "TestRepository", mLogger));
- BOOST_REQUIRE(testImpl != 0);
- repository = ContainerRepositoryPrx::uncheckedCast(
- mObjectAdapter->addWithUUID(testImpl));
- BOOST_REQUIRE(repository != 0);
-
- string configurationProperty = mCommunicator->getProperties()->getPropertyWithDefault("Test.RootPath", "./data");
- BOOST_REQUIRE(!configurationProperty.empty());
- testImpl->configurationAdapter()->setRootPath(configurationProperty);
- BOOST_REQUIRE(testImpl->configurationAdapter()->getRootPath() == configurationProperty);
-
- vector<string> extensions = testImpl->configurationAdapter()->getFilenameExtensions();
- BOOST_REQUIRE(extensions.empty());
- ContainerInfoSeq containers = repository->getContainerList();
- BOOST_REQUIRE(containers.empty());
- testImpl->configurationAdapter()->addFilenameExtension("mka");
- containers = repository->getContainerList();
- BOOST_REQUIRE(containers.empty());
- testImpl->configurationAdapter()->setAutoUpdateOption(true);
- containers = repository->getContainerList();
- BOOST_REQUIRE(!containers.empty());
- bool pickedOne = false;
- for (ContainerInfoSeq::const_iterator it = containers.begin(); it != containers.end(); ++it)
- {
- if ((*it)->id.find("auto") == string::npos)
- {
- pickedOne = true;
- }
- }
- BOOST_CHECK_MESSAGE(!pickedOne, "With no container info configured, all entries should have been tagged as 'auto'");
- }
- catch (...)
- {
- mLogger(Error) << "Unknown exception occurred in test.";
- }
-
- if (repository)
- {
- mObjectAdapter->remove(repository->ice_getIdentity());
- repository = 0;
- }
- }
-
class TestSink : public AsteriskSCF::Media::V1::StreamSink
{
public:
@@ -201,9 +145,9 @@ public:
// is *inside* is what should come out.
//
Matroska::Environment env;
- PlaybackSessionImplPtr playback =
- new PlaybackSessionImpl(mObjectAdapter, "testSimplePlayback", FileMediaSpecification(), &env,
- mLogger);
+ AsteriskSCF::FileMediaService::Implementation::PlaybackSessionImplPtr playback =
+ new AsteriskSCF::FileMediaService::Implementation::PlaybackSessionImpl(
+ mObjectAdapter, "testSimplePlayback", FileMediaSpecification(), &env, mLogger);
string containerFileName =
mCommunicator->getProperties()->getPropertyWithDefault("Test.SimplePlayback.MkvFile",
"simpleplayback.mka");
@@ -275,7 +219,7 @@ public:
SFLAG_WRONLY | SFLAG_CREATE);
BOOST_REQUIRE(stream);
- boost::shared_ptr<ContainerWriter> writer(new Matroska::ContainerWriter(stream));
+ boost::shared_ptr<Matroska::ContainerWriter> writer(new Matroska::ContainerWriter(stream));
BOOST_REQUIRE(writer);
AudioFormatPtr format = new AudioFormat;
@@ -286,7 +230,9 @@ public:
pjmedia_port* port = 0;
try
{
+ BOOST_CHECKPOINT("Setting up header");
writer->populateHeader("SimpleMuxTest", containerFilename);
+ BOOST_CHECKPOINT("Adding the track");
uint16_t trackNumber = writer->addTrack(format, "testtrack");
BOOST_CHECK(trackNumber == 1);
boost::shared_ptr<pj_caching_pool> cachingPool(new pj_caching_pool);
@@ -315,6 +261,7 @@ public:
p->payload.resize(frame.size * sizeof(frameDataBuf[0])/8);
memcpy(&(p->payload[0]), frame.buf, frame.size);
data->payload = p;
+ frames.push_back(data);
writer->addFrames(trackNumber, frames);
result = pjmedia_port_get_frame(port, &frame);
}
@@ -351,14 +298,8 @@ bool init_unit_test()
{
pj_init();
framework::master_test_suite().add(BOOST_TEST_CASE(boost::bind(&ContainerRepositoryTests::rootPathTest, globalTestSuite)));
- framework::master_test_suite().add(BOOST_TEST_CASE(boost::bind(&ContainerRepositoryTests::rootPathScanTest, globalTestSuite)));
-
framework::master_test_suite().add(BOOST_TEST_CASE(boost::bind(&ContainerRepositoryTests::testSimpleMux,
globalTestSuite)));
- // framework::master_test_suite().add(BOOST_TEST_CASE(boost::bind(&ContainerRepositoryTests::testTrackDataOrdering,
- // globalTestSuite)));
- // framework::master_test_suite().add(BOOST_TEST_CASE(boost::bind(&ContainerRepositoryTests::testSimplePlayback,
- // globalTestSuite)));
return true;
}
commit f05184d8c4f6136c5e378f4d9d3ccef45e8b5b64
Author: Brent Eagles <beagles at digium.com>
Date: Tue Jan 3 12:11:26 2012 -0330
Capture a lot of build oriented changes.
diff --git a/config/FileMediaServiceConfigurator.py b/config/FileMediaServiceConfigurator.py
index 52429cd..93c86a7 100755
--- a/config/FileMediaServiceConfigurator.py
+++ b/config/FileMediaServiceConfigurator.py
@@ -54,12 +54,10 @@ class SectionVisitors(Configurator.SectionVisitors):
group.configurationItems = { }
mapper = Configuration.OptionMapper()
- item = AsteriskSCF.Configuration.FileMediaService.V1.BackgroundUpdates()
- mapper.map('enable_updates', item, 'enabled',
- AsteriskSCF.Configuration.FileMediaService.V1.BackgroundUpdatesItem, config.getboolean, None)
- mapper.map('update_interval', item, 'updateInterval',
- AsteriskSCF.Configuration.FileMediaService.V1.BackgroundUpdatesItem, config.get, None)
-
+ item = AsteriskSCF.Configuration.FileMediaService.V1.RepositoryLocation()
+ mapper.map('path', item, 'pathname',
+ AsteriskSCF.Configuration.FileMediaService.V1.RepositoryLocationItem, config.get, None)
+
for option in config.options(section):
mapper.execute(group, section, option)
mapper.finish()
@@ -102,8 +100,12 @@ class SectionVisitors(Configurator.SectionVisitors):
self.groups.append(group)
def visit_unsupported(self, config, section):
- if config.get(section, 'type') == 'endpoint':
- self.visit_endpoint_group(config, section)
+ if config.get(section, 'type') == 'repository':
+ self.visit_repository_group(config, section)
+ elif config.get(section, 'type') == 'container':
+ self.visit_container_group(config, section)
+ elif config.get(section, 'type') == 'replication':
+ self.visit_replication_configuration_group(config, section)
# In order to do service locator based lookup we need to pass in a params object
serviceLocatorParams = AsteriskSCF.Core.Discovery.V1.ServiceLocatorParams()
diff --git a/slice/AsteriskSCF/Configuration/FileMediaService/FileMediaServiceConfigurationIf.ice b/slice/AsteriskSCF/Configuration/FileMediaService/FileMediaServiceConfigurationIf.ice
index 90afc26..745770b 100644
--- a/slice/AsteriskSCF/Configuration/FileMediaService/FileMediaServiceConfigurationIf.ice
+++ b/slice/AsteriskSCF/Configuration/FileMediaService/FileMediaServiceConfigurationIf.ice
@@ -109,26 +109,6 @@ class RepositoryLocation extends RepositoryConfigurationItem
string pathname;
};
-
-const long DefaultUpdateInterval = 60; /* Update interval is specified in seconds */
-
-/**
- * Configure the background management facility.
- **/
-const string BackgroundUpdatesItem = "backgroundUpdates";
-class BackgroundUpdates extends RepositoryConfigurationItem
-{
- /**
- * Enable the background updates.
- */
- bool enabled;
-
- /**
- * The update interval in seconds.
- */
- int updateInterval;
-};
-
class ContainerGroup extends FileMediaServiceGroup
{
};
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 37e660e..94c645f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -15,6 +15,7 @@ astscf_component_add_files(FileMediaService
ContainerRepository.h
FileMediaServiceComponent.cpp
FileMediaServiceComponent.h
+ ContainerInfo.h
ContainerImpl.cpp
ContainerImpl.h
Configuration.cpp
@@ -48,7 +49,7 @@ astscf_component_add_files(FileMediaServiceReplicator
astscf_component_add_ice_libraries(FileMediaServiceReplicator IceStorm)
astscf_component_add_boost_libraries(FileMediaServiceReplicator core)
-astscf_component_add_slice_collection_libraries(FileMediaServiceReplicator FILESESSIONGATEWAY ASTSCF)
+astscf_component_add_slice_collection_libraries(FileMediaServiceReplicator FILEMEDIASERVICE ASTSCF)
astscf_component_build_icebox(FileMediaServiceReplicator)
target_link_libraries(FileMediaServiceReplicator astscf-ice-util-cpp logging-client)
astscf_component_install(FileMediaServiceReplicator)
diff --git a/src/Component.cpp b/src/Component.cpp
index 7717c73..5623fb1 100644
--- a/src/Component.cpp
+++ b/src/Component.cpp
@@ -185,7 +185,7 @@ public:
void createBackplaneServices()
{
mConfigurationFeature =
- createConfigurationFeature(mContainerRepository);
+ createConfigurationFeature(mContainerRepository, mLogger);
mConfigurationProxy =
AsteriskSCF::System::Configuration::V1::ConfigurationServicePrx::uncheckedCast(
mConfigurationFeature->activate(getBackplaneAdapter()));
diff --git a/src/Configuration.cpp b/src/Configuration.cpp
index f474141..5199f67 100644
--- a/src/Configuration.cpp
+++ b/src/Configuration.cpp
@@ -91,19 +91,7 @@ public:
}
repositoryConfigurationGroup->configurationItems[itemIter->first] = location;
}
- itemIter = repositoryGroup->configurationItems.find(BackgroundUpdatesItem);
- if (itemIter != repositoryGroup->configurationItems.end())
- {
- BackgroundUpdatesPtr backgroundUpdates = new BackgroundUpdates;
- backgroundUpdates.enabled = configAdapter->getAutoUpdateOption();
- backgroundUpdates.updateInterval = configAdapter->getAutoUpdateInterval();
- if (!repositoryConfigurationGroup)
- {
- repositoryConfigurationGroup = new RepositoryGroup;
- result.push_back(repositoryConfigurationGroup);
- }
- repositoryConfigurationGroup->configurationItems[itemIter->first] = backgroundUpdates;
- }
+
continue;
}
@@ -174,63 +162,11 @@ public:
ConfigurationGroupSeq getConfigurationGroups(const Ice::Current&)
{
ConfigurationGroupSeq groups;
-
- EndpointImplSeq endpointImpls = mEndpointLocator->getEndpoints();
- for (EndpointImplSeq::const_iterator iter = endpointImpls.begin();
- iter != endpointImpls.end(); ++iter)
- {
- EndpointGroupPtr endpointGroup = new EndpointGroup;
- endpointGroup->name = (*iter)->getName();
- groups.push_back(endpointGroup);
- }
- groups.push_back(new GeneralGroup);
return groups;
}
void setConfiguration(const ConfigurationGroupSeq& config, const Ice::Current&)
{
- EndpointSpecificationSeq newSpecs;
- for (ConfigurationGroupSeq::const_iterator configIter = config.begin();
- configIter != config.end(); ++configIter)
- {
- EndpointGroupPtr endpointGroup = EndpointGroupPtr::dynamicCast(*configIter);
- if (endpointGroup)
- {
- newSpecs.push_back(createSpecificationFromGroup(endpointGroup));
- continue;
- }
- GeneralGroupPtr generalGroup = GeneralGroupPtr::dynamicCast(*configIter);
- if (generalGroup)
- {
- ConfigurationItemDict::const_iterator itemIter = generalGroup->configurationItems.find(
- RoutingServiceItem);
- if (itemIter != generalGroup->configurationItems.end())
- {
- RoutingServicePtr routingService = RoutingServicePtr::dynamicCast(itemIter->second);
- if (routingService)
- {
- mRemoteServices->setRoutingServiceName(routingService->serviceName);
- }
- continue;
- }
-
- itemIter = generalGroup->configurationItems.find(FileMediaServiceItem);
- if (itemIter != generalGroup->configurationItems.end())
- {
- FileMediaServicePtr fileMediaService = FileMediaServicePtr::dynamicCast(itemIter->second);
- if (fileMediaService)
- {
- mRemoteServices->setMediaServiceName(fileMediaService->serviceName);
- }
- continue;
- }
-
- }
- }
- if (!newSpecs.empty())
- {
- mEndpointLocator->addEndpoints(newSpecs);
- }
}
//
@@ -239,63 +175,14 @@ public:
//
void removeConfigurationItems(const ConfigurationGroupSeq& config, const Ice::Current&)
{
- for (ConfigurationGroupSeq::const_iterator configIter = config.begin();
- configIter != config.end(); ++configIter)
- {
- GeneralGroupPtr generalGroup = GeneralGroupPtr::dynamicCast(*configIter);
- if (generalGroup)
- {
- for (ConfigurationItemDict::const_iterator itemIter = generalGroup->configurationItems.begin();
- itemIter != generalGroup->configurationItems.end(); ++itemIter)
- {
- if (itemIter->first == RoutingServiceItem)
- {
- mRemoteServices->setRoutingServiceName("default");
- }
- else if (itemIter->first == FileMediaServiceItem)
- {
- mRemoteServices->setMediaServiceName("default");
- }
- }
- }
- }
}
void removeConfigurationGroups(const ConfigurationGroupSeq& config, const Ice::Current&)
{
- EndpointSpecificationSeq specsToRemove;
- EndpointImplSeq endpoints = mEndpointLocator->getEndpoints();
- for (ConfigurationGroupSeq::const_iterator configIter = config.begin();
- configIter != config.end(); ++configIter)
- {
- EndpointGroupPtr endpointGroup = EndpointGroupPtr::dynamicCast(*configIter);
- if (endpointGroup)
- {
- for (EndpointImplSeq::const_iterator endpointIter = endpoints.begin();
- endpointIter != endpoints.end(); ++endpointIter)
- {
- EndpointSpecificationPtr spec = (*endpointIter)->getSpecification();
- if (spec->name == endpointGroup->name)
- {
- specsToRemove.push_back(spec);
- break;
- }
- }
- }
-
- //
- // General group cannot be removed.
- //
- }
-
- if (!specsToRemove.empty())
- {
- mEndpointLocator->removeEndpoints(specsToRemove);
- }
}
+
private:
- EndpointLocatorImplPtr mEndpointLocator;
- RemoteServicesPtr mRemoteServices;
+ ContainerRepositoryImplPtr mRepository;
Logger mLogger;
};
typedef IceUtil::Handle<ConfigurationImpl> ConfigurationImplPtr;
@@ -330,7 +217,7 @@ public:
// valid.
//
gatewayComponent->addFeatureProxyToBackplane(mPublicProxy,
- AsteriskSCF::Configuration::FileSessionGateway::V1::ConfigurationDiscoveryCategory);
+ AsteriskSCF::Configuration::FileMediaService::V1::ConfigurationDiscoveryCategory);
}
else
{
@@ -368,10 +255,8 @@ typedef IceUtil::Handle<ConfigurationFeature> ConfigurationFeaturePtr;
}
-AsteriskSCF::FileSessionGtw::ComponentFeaturePtr AsteriskSCF::FileSessionGtw::createConfigurationFeature(
- const EndpointLocatorImplPtr& endpointLocator,
- const RemoteServicesPtr& remoteServices)
+AsteriskSCF::FileMediaService::ComponentFeaturePtr AsteriskSCF::FileMediaService::createConfigurationFeature(
+ const ContainerRepositoryImplPtr& repository, const Logger& logger)
{
- return new ConfigurationFeature(endpointLocator, remoteServices,
- getLoggerFactory().getLogger(LoggerId + ".Configuration"));
+ return new ConfigurationFeature(repository, logger);
}
diff --git a/src/Configuration.h b/src/Configuration.h
index 8700a97..b44406d 100644
--- a/src/Configuration.h
+++ b/src/Configuration.h
@@ -18,13 +18,15 @@
#include "ComponentFeature.h"
#include "ContainerRepository.h"
+#include "LoggerF.h"
namespace AsteriskSCF
{
namespace FileMediaService
{
-ComponentFeaturePtr createConfigurationFeature(const ContainerRepositoryImplPtr& endpointLocator);
+ComponentFeaturePtr createConfigurationFeature(const ContainerRepositoryImplPtr& repository,
+ const AsteriskSCF::System::Logging::Logger& logger);
} /* End of namespace FileMediaService */
} /* End of namespace AsteriskSCF */
diff --git a/src/ContainerImpl.cpp b/src/ContainerImpl.cpp
index 8f7cc3d..6ae1078 100644
--- a/src/ContainerImpl.cpp
+++ b/src/ContainerImpl.cpp
@@ -14,35 +14,29 @@
* at the top of the source tree.
*/
-#include "ContainerImpl.h"
-#include "ContainerRepository.h"
-
-#define BOOST_FILESYSTEM_VERSION 3
+#define BOOST_FILESYSTEM_VERSION 2
#include <boost/thread/shared_mutex.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/filesystem.hpp>
-#include <AsteriskSCF/logger.h>
+#include "ContainerImpl.h"
+#include "ContainerRepository.h"
+#include "ContainerInfo.h"
#include <Ice/Ice.h>
#include <IceUtil/UUID.h>
#include <IceUtil/Thread.h>
-
-
-#include "MatroskaUtil.h"
+
+#include <AsteriskSCF/logger.h>
extern "C"
{
-#include <config.h>
#include <corec/helpers/file/streams.h>
}
+#include "MatroskaUtil.h"
-using namespace AsteriskSCF::FileMediaService::MediaContainer::V1;
-using namespace AsteriskSCF::Media::File::V1;
-using namespace AsteriskSCF::Media::V1;
using namespace AsteriskSCF::System::Logging;
using namespace std;
-using namespace Matroska;
//
// TODO: While working on the snags of our file handling library, I'm going to assume a single
@@ -63,7 +57,7 @@ struct TrackQueue
{
IceUtil::Time earliest;
IceUtil::Time latest;
- FrameSeq frames;
+ AsteriskSCF::Media::V1::FrameSeq frames;
TrackQueue() :
earliest(IceUtil::Time::seconds(0)),
@@ -172,7 +166,6 @@ private:
};
typedef IceUtil::Handle<IODriverThread> IODriverThreadPtr;
-
/**
*
* Wrap up and encapsulate cookie management functions, cut down on
@@ -188,13 +181,13 @@ public:
{
}
- void setCookies(const SessionCookies& cookies)
+ void setCookies(const AsteriskSCF::Media::V1::SessionCookies& cookies)
{
UniqueLock lock(mLock);
- for (SessionCookies::const_iterator lookingFor = cookies.begin();
+ for (AsteriskSCF::Media::V1::SessionCookies::const_iterator lookingFor = cookies.begin();
lookingFor != cookies.end(); ++lookingFor)
{
- for (SessionCookies::iterator myCookie = mCookies.begin();
+ for (AsteriskSCF::Media::V1::SessionCookies::iterator myCookie = mCookies.begin();
myCookie != mCookies.end(); ++myCookie)
{
if ((*lookingFor)->ice_id() == (*myCookie)->ice_id())
@@ -206,13 +199,14 @@ public:
}
}
- void removeCookies(const SessionCookies& cookies)
+ void removeCookies(const AsteriskSCF::Media::V1::SessionCookies& cookies)
{
UniqueLock lock(mLock);
- for (SessionCookies::const_iterator lookingFor = cookies.begin();
+ for (AsteriskSCF::Media::V1::SessionCookies::const_iterator lookingFor = cookies.begin();
lookingFor != cookies.end(); ++lookingFor)
{
- for (SessionCookies::iterator myCookie = mCookies.begin(); myCookie != mCookies.end(); ++myCookie)
+ for (AsteriskSCF::Media::V1::SessionCookies::iterator myCookie = mCookies.begin();
+ myCookie != mCookies.end(); ++myCookie)
{
if ((*lookingFor)->ice_id() == (*myCookie)->ice_id())
{
@@ -223,14 +217,16 @@ public:
}
}
- SessionCookies getCookies(const SessionCookies& cookies)
+ AsteriskSCF::Media::V1::SessionCookies getCookies(const
+ AsteriskSCF::Media::V1::SessionCookies& cookies)
{
SharedLock lock(mLock);
- SessionCookies results;
- for (SessionCookies::const_iterator lookingFor = cookies.begin();
+ AsteriskSCF::Media::V1::SessionCookies results;
+ for (AsteriskSCF::Media::V1::SessionCookies::const_iterator lookingFor = cookies.begin();
lookingFor != cookies.end(); ++lookingFor)
{
- for (SessionCookies::const_iterator myCookie = mCookies.begin(); myCookie != mCookies.end(); ++myCookie)
+ for (AsteriskSCF::Media::V1::SessionCookies::const_iterator myCookie = mCookies.begin();
+ myCookie != mCookies.end(); ++myCookie)
{
if ((*lookingFor)->ice_id() == (*myCookie)->ice_id())
{
@@ -244,7 +240,7 @@ public:
private:
boost::shared_mutex mLock;
- SessionCookies mCookies;
+ AsteriskSCF::Media::V1::SessionCookies mCookies;
};
/**
@@ -287,37 +283,37 @@ public:
{
public:
SinkManager(const string& id,
- const FormatPtr& format,
- double trackTimecodeScale,
- const Ice::ObjectAdapterPtr& adapter,
- const Logger& logger) :
+ const AsteriskSCF::Media::V1::FormatPtr& format,
+ double trackTimecodeScale,
+ const Ice::ObjectAdapterPtr& adapter,
+ const Logger& logger) :
mId(id),
mTimeScale(trackTimecodeScale),
- mFormat(AudioFormatPtr::dynamicCast(format)),
+ mFormat(AsteriskSCF::Media::V1::AudioFormatPtr::dynamicCast(format)),
mLogger(logger),
mAdapter(adapter),
mSeqno(0)
{
}
- void addSink(const StreamSinkPrx& sink, const Ice::Current& current)
+ void addSink(const AsteriskSCF::Media::V1::StreamSinkPrx& sink, const Ice::Current& current)
{
UniqueLock lock(mLock);
string newSinkId = current.adapter->getCommunicator()->identityToString(sink->ice_getIdentity());
if (mSinks.find(newSinkId) != mSinks.end())
{
- mLogger(Info) << mId << " is updating proxy for " << newSinkId;
+ mLogger(Debug) << mId << " is updating proxy for " << newSinkId;
}
mSinks[newSinkId] = sink;
}
- StreamSinkSeq getSinks(const Ice::Current&)
+ AsteriskSCF::Media::V1::StreamSinkSeq getSinks(const Ice::Current&)
{
SharedLock lock(mLock);
return getSinksImpl();
}
- void removeSink(const StreamSinkPrx& sink, const Ice::Current& current)
+ void removeSink(const AsteriskSCF::Media::V1::StreamSinkPrx& sink, const Ice::Current& current)
{
UniqueLock lock(mLock);
string newSinkId = current.adapter->getCommunicator()->identityToString(sink->ice_getIdentity());
@@ -327,13 +323,13 @@ public:
}
}
- FormatSeq getFormats(const Ice::Current&)
+ AsteriskSCF::Media::V1::FormatSeq getFormats(const Ice::Current&)
{
//
// TODO: It is actually conceivable that different copies of the same track exist with
// different formats. It might be possible to support this.
//
- FormatSeq r;
+ AsteriskSCF::Media::V1::FormatSeq r;
r.push_back(mFormat);
return r;
}
@@ -346,7 +342,7 @@ public:
return mId;
}
- void requestFormat(const FormatPtr& f, const Ice::Current&)
+ void requestFormat(const AsteriskSCF::Media::V1::FormatPtr& f, const Ice::Current&)
{
//
// You get what you got!
@@ -357,10 +353,10 @@ public:
{
return;
}
- throw MediaFormatSwitchException();
+ throw AsteriskSCF::Media::V1::MediaFormatSwitchException();
}
- void distributePacket(TrackFrame* data)
+ void distributePacket(Matroska::TrackFrame* data)
{
//
// We have to decode the whole packet and store it in our own frame(s), because
@@ -370,14 +366,15 @@ public:
unsigned long bytesToDecode = data->frameData.Size;
unsigned char* buf = static_cast<unsigned char*>(data->frameData.Data);
- timecode_t startTimecode = static_cast<timecode_t>( static_cast<double>(data->frameData.Timecode) / mTimeScale);
+ timecode_t startTimecode =
+ static_cast<timecode_t>( static_cast<double>(data->frameData.Timecode) / mTimeScale);
size_t sampleCount = 0;
size_t durationFactor = (mFormat->sampleSize / sizeof(buf[0])) * mFormat->sampleRate; // bits per second
while(bytesToDecode != 0)
{
- FrameSeq frames;
- AudioFramePtr frame = new AudioFrame;
+ AsteriskSCF::Media::V1::FrameSeq frames;
+ AsteriskSCF::Media::V1::AudioFramePtr frame = new AsteriskSCF::Media::V1::AudioFrame;
frame->seqno = ++mSeqno;
//
@@ -402,14 +399,14 @@ public:
{
short* buf16 = reinterpret_cast<short*>(buf);
Ice::ShortSeq payloadData(buf16, buf16 + sampleRangeEnd);
- ShortSeqPayloadPtr payloadObj = new ShortSeqPayload;
+ AsteriskSCF::Media::V1::ShortSeqPayloadPtr payloadObj = new AsteriskSCF::Media::V1::ShortSeqPayload;
payloadObj->payload = payloadData;
frame->payload = payloadObj;
}
else
{
Ice::ByteSeq payloadData(buf, buf + sampleRangeEnd);
- ByteSeqPayloadPtr payloadObj = new ByteSeqPayload;
+ AsteriskSCF::Media::V1::ByteSeqPayloadPtr payloadObj = new AsteriskSCF::Media::V1::ByteSeqPayload;
payloadObj->payload = payloadData;
frame->payload = payloadObj;
}
@@ -448,18 +445,18 @@ public:
//
// get a snapshot of our current sinks.
//
- StreamSinkSeq mySinks = getSinksImpl();
+ AsteriskSCF::Media::V1::StreamSinkSeq mySinks = getSinksImpl();
//
// Select frames
//
- FrameSeq ready;
+ AsteriskSCF::Media::V1::FrameSeq ready;
IceUtil::Time now = IceUtil::Time::now();
//
// these are set outside the loop because we want to use them afterwards.
//
- FrameSeq::iterator frameIter = mQueuedFrames.begin();
+ AsteriskSCF::Media::V1::FrameSeq::iterator frameIter = mQueuedFrames.begin();
IceUtil::Time frameStamp;
bool updateT = false;
@@ -470,7 +467,8 @@ public:
// for this session.
//
frameStamp = mStartTime;
- StreamFramePtr p = StreamFramePtr::dynamicCast(*frameIter);
+ AsteriskSCF::Media::V1::StreamFramePtr p =
+ AsteriskSCF::Media::V1::StreamFramePtr::dynamicCast(*frameIter);
if (p)
{
frameStamp += IceUtil::Time::milliSeconds(p->timestamp);
@@ -495,7 +493,8 @@ public:
return frameStamp;
}
- for (StreamSinkSeq::const_iterator iter = mySinks.begin(); iter != mySinks.end(); ++iter)
+ for (AsteriskSCF::Media::V1::StreamSinkSeq::const_iterator iter = mySinks.begin();
+ iter != mySinks.end(); ++iter)
{
try
{
@@ -503,6 +502,7 @@ public:
}
catch (const Ice::ObjectNotExistException&)
{
+ mLogger(Debug) << "removing sink on receipt of ONE";
removeSinkImpl(*iter);
}
catch (const Ice::Exception& ex)
@@ -526,20 +526,20 @@ public:
boost::shared_mutex mLock;
string mId;
double mTimeScale;
- AudioFormatPtr mFormat;
+ AsteriskSCF::Media::V1::AudioFormatPtr mFormat;
Logger mLogger;
Ice::ObjectAdapterPtr mAdapter;
IceUtil::Time mStartTime;
size_t mSeqno;
- FrameSeq mQueuedFrames;
+ AsteriskSCF::Media::V1::FrameSeq mQueuedFrames;
- typedef map<string, StreamSinkPrx> SinkMap;
+ typedef map<string, AsteriskSCF::Media::V1::StreamSinkPrx> SinkMap;
SinkMap mSinks;
- StreamSinkSeq getSinksImpl()
+ AsteriskSCF::Media::V1::StreamSinkSeq getSinksImpl()
{
- StreamSinkSeq results;
+ AsteriskSCF::Media::V1::StreamSinkSeq results;
for (SinkMap::const_iterator iter = mSinks.begin(); iter != mSinks.end(); ++iter)
{
results.push_back(iter->second);
@@ -547,7 +547,7 @@ public:
return results;
}
- void removeSinkImpl(const StreamSinkPrx& sink)
+ void removeSinkImpl(const AsteriskSCF::Media::V1::StreamSinkPrx& sink)
{
string id = mAdapter->getCommunicator()->identityToString(sink->ice_getIdentity());
UniqueLock lock(mLock);
@@ -559,7 +559,7 @@ public:
typedef vector<SinkManagerPtr> SinkManagerSeq;
PlaybackSessionImpl(const Ice::ObjectAdapterPtr& adapter, const string& id,
- const FileMediaSpecification& spec,
+ const AsteriskSCF::Media::File::V1::FileMediaSpecification& spec,
Matroska::Environment* matroskaEnvironment,
const Logger& logger) :
mObjectAdapter(adapter),
@@ -638,20 +638,21 @@ public:
mSinkManagers[i] = new SinkManager(sourceId, mContainerReader->getFormatForTrack(trackNumber),
mContainerReader->getTimecodeScaleForTrack(trackNumber), mObjectAdapter, mLogger);
Ice::Identity id = mObjectAdapter->getCommunicator()->stringToIdentity(sourceId);
- mSources.push_back(StreamSourcePrx::uncheckedCast(mObjectAdapter->add(mSinkManagers[i], id)));
+ mSources.push_back(
+ AsteriskSCF::Media::V1::StreamSourcePrx::uncheckedCast(mObjectAdapter->add(mSinkManagers[i], id)));
}
return true;
}
- StreamSourceSeq getSources(const Ice::Current&)
+ AsteriskSCF::Media::V1::StreamSourceSeq getSources(const Ice::Current&)
{
return mSources;
}
- StreamSinkSeq getSinks(const Ice::Current&)
+ AsteriskSCF::Media::V1::StreamSinkSeq getSinks(const Ice::Current&)
{
- return StreamSinkSeq();
+ return AsteriskSCF::Media::V1::StreamSinkSeq();
}
string getId(const Ice::Current&)
@@ -659,12 +660,12 @@ public:
return mId;
}
- void setCookies(const SessionCookies& cookies, const Ice::Current&)
+ void setCookies(const AsteriskSCF::Media::V1::SessionCookies& cookies, const Ice::Current&)
{
mCookieManager.setCookies(cookies);
}
- void removeCookies(const SessionCookies& cookies, const Ice::Current&)
+ void removeCookies(const AsteriskSCF::Media::V1::SessionCookies& cookies, const Ice::Current&)
{
mCookieManager.removeCookies(cookies);
}
@@ -688,7 +689,7 @@ public:
}
}
- FileMediaSpecification getInfo(const Ice::Current&)
+ AsteriskSCF::Media::File::V1::FileMediaSpecification getInfo(const Ice::Current&)
{
return mSpec;
}
@@ -771,7 +772,7 @@ public:
//
if (readPacket)
{
- TrackFrame* newFrame = mContainerReader->getNextFrame();
+ Matroska::TrackFrame* newFrame = mContainerReader->getNextFrame();
if (!newFrame)
{
//
@@ -876,10 +877,10 @@ private:
Ice::ObjectAdapterPtr mObjectAdapter;
const string mId;
- FileMediaSpecification mSpec;
+ AsteriskSCF::Media::File::V1::FileMediaSpecification mSpec;
Logger mLogger;
Matroska::Environment* mMatroskaEnvironment;
- boost::shared_ptr<ContainerReader> mContainerReader;
+ boost::shared_ptr<Matroska::ContainerReader> mContainerReader;
//
// TODO: a small resource guard wrapper class would be useful for the corec stream member.
@@ -888,7 +889,7 @@ private:
CookieManager mCookieManager;
SinkManagerSeq mSinkManagers;
- StreamSourceSeq mSources;
+ AsteriskSCF::Media::V1::StreamSourceSeq mSources;
IODriverThreadPtr mDriver;
bool mStarted;
};
@@ -900,14 +901,13 @@ typedef IceUtil::Handle<PlaybackSessionImpl> PlaybackSessionImplPtr;
struct WritingRecord
{
unsigned trackNumber;
- FramePtr frame;
+ AsteriskSCF::Media::V1::FramePtr frame;
};
-
static bool frameTimestampComparator(const WritingRecord& a, const WritingRecord& b)
{
- StreamFramePtr streamA = StreamFramePtr::dynamicCast(a.frame);
- StreamFramePtr streamB = StreamFramePtr::dynamicCast(b.frame);
+ AsteriskSCF::Media::V1::StreamFramePtr streamA = AsteriskSCF::Media::V1::StreamFramePtr::dynamicCast(a.frame);
+ AsteriskSCF::Media::V1::StreamFramePtr streamB = AsteriskSCF::Media::V1::StreamFramePtr::dynamicCast(b.frame);
if (streamA && streamB)
{
return streamA->timestamp < streamB->timestamp;
@@ -937,7 +937,7 @@ static bool frameTimestampComparator(const WritingRecord& a, const WritingRecord
class FrameWriter : public IceUtil::Shared
{
public:
- FrameWriter(const boost::shared_ptr<ContainerWriter>& writer, unsigned trackCount) :
+ FrameWriter(const boost::shared_ptr<Matroska::ContainerWriter>& writer, unsigned trackCount) :
mContainerWriter(writer)
{
//
@@ -949,7 +949,7 @@ public:
mTrackQueues.resize(trackCount);
}
- void write(unsigned trackIndex, const FrameSeq& frames)
+ void write(unsigned trackIndex, const AsteriskSCF::Media::V1::FrameSeq& frames)
{
//
// Called from queueFrames when it is time
@@ -957,7 +957,7 @@ public:
mContainerWriter->addFrames(static_cast<uint16_t>(trackIndex), frames);
}
- void queueFrames(unsigned trackIndex, const FrameSeq& frames)
+ void queueFrames(unsigned trackIndex, const AsteriskSCF::Media::V1::FrameSeq& frames)
{
boost::mutex::scoped_lock lock(mLock);
@@ -982,9 +982,10 @@ public:
// setting up test data, so let's not sweat it :)
//
IceUtil::Time earliestStamp(mTrackQueues[index].earliest);
- for (FrameSeq::const_iterator iter = frames.begin(); iter != frames.end(); ++iter)
+ for (AsteriskSCF::Media::V1::FrameSeq::const_iterator iter = frames.begin(); iter != frames.end(); ++iter)
{
- StreamFramePtr streamFrame = StreamFramePtr::dynamicCast(*iter);
+ AsteriskSCF::Media::V1::StreamFramePtr streamFrame =
+ AsteriskSCF::Media::V1::StreamFramePtr::dynamicCast(*iter);
if (streamFrame)
{
earliestStamp = IceUtil::Time::milliSeconds(streamFrame->timestamp);
@@ -993,9 +994,11 @@ public:
}
IceUtil::Time latestStamp(mTrackQueues[index].latest);
- for (FrameSeq::const_reverse_iterator iter = frames.rbegin(); iter < frames.rend(); ++iter)
+ for (AsteriskSCF::Media::V1::FrameSeq::const_reverse_iterator iter = frames.rbegin();
+ iter < frames.rend(); ++iter)
{
- StreamFramePtr streamFrame = StreamFramePtr::dynamicCast(*iter);
+ AsteriskSCF::Media::V1::StreamFramePtr streamFrame =
+ AsteriskSCF::Media::V1::StreamFramePtr::dynamicCast(*iter);
if (streamFrame)
{
latestStamp = IceUtil::Time::milliSeconds(streamFrame->timestamp);
@@ -1079,10 +1082,12 @@ public:
vector<WritingRecord> framesToWrite;
for (vector<TrackQueue>::iterator iter = mTrackQueues.begin(); iter != mTrackQueues.end(); ++iter)
{
- FrameSeq leftOvers;
- for (FrameSeq::iterator frameIter = iter->frames.begin(); frameIter != iter->frames.end(); ++frameIter)
+ AsteriskSCF::Media::V1::FrameSeq leftOvers;
+ for (AsteriskSCF::Media::V1::FrameSeq::iterator frameIter = iter->frames.begin();
+ frameIter != iter->frames.end(); ++frameIter)
{
- StreamFramePtr streamFrame = StreamFramePtr::dynamicCast(*frameIter);
+ AsteriskSCF::Media::V1::StreamFramePtr streamFrame =
+ AsteriskSCF::Media::V1::StreamFramePtr::dynamicCast(*frameIter);
if (streamFrame)
{
IceUtil::Time t(IceUtil::Time::milliSeconds(streamFrame->timestamp));
@@ -1143,7 +1148,8 @@ public:
vector<WritingRecord> framesToWrite;
for (vector<TrackQueue>::iterator iter = mTrackQueues.begin(); iter != mTrackQueues.end(); ++iter)
{
- for (FrameSeq::iterator frameIter = iter->frames.begin(); frameIter != iter->frames.end(); ++frameIter)
+ for (AsteriskSCF::Media::V1::FrameSeq::iterator frameIter = iter->frames.begin();
+ frameIter != iter->frames.end(); ++frameIter)
{
WritingRecord newRecord;
newRecord.trackNumber = trackNumber;
@@ -1153,14 +1159,14 @@ public:
++trackNumber;
}
//
- // TODO: Byt right
+ // TODO: Byte order? right
//
muxAndWrite(framesToWrite);
}
private:
boost::mutex mLock;
- boost::shared_ptr<ContainerWriter> mContainerWriter;
+ boost::shared_ptr<Matroska::ContainerWriter> mContainerWriter;
vector<TrackQueue> mTrackQueues;
@@ -1178,7 +1184,7 @@ private:
//
sort(framesToWrite.begin(), framesToWrite.end(), frameTimestampComparator);
unsigned currentTrack = 0;
- FrameSeq collectedFrames;
+ AsteriskSCF::Media::V1::FrameSeq collectedFrames;
for (vector<WritingRecord>::iterator w = framesToWrite.begin(); w != framesToWrite.end(); ++w)
{
//
@@ -1220,7 +1226,7 @@ public:
{
}
- void write(const FrameSeq& newFrames, const Ice::Current&)
+ void write(const AsteriskSCF::Media::V1::FrameSeq& newFrames, const Ice::Current&)
{
{
UniqueLock lock(mLock);
@@ -1236,25 +1242,25 @@ public:
mWriter->queueFrames(mTrack, newFrames);
}
- void setSource(const StreamSourcePrx& source, const Ice::Current&)
+ void setSource(const AsteriskSCF::Media::V1::StreamSourcePrx& source, const Ice::Current&)
{
UniqueLock lock(mLock);
mSource = source;
}
- StreamSourcePrx getSource(const Ice::Current&)
+ AsteriskSCF::Media::V1::StreamSourcePrx getSource(const Ice::Current&)
{
SharedLock lock(mLock);
return mSource;
}
- FormatSeq getFormats(const Ice::Current&)
+ AsteriskSCF::Media::V1::FormatSeq getFormats(const Ice::Current&)
{
//
// XXX
//
SharedLock lock(mLock);
- return FormatSeq();
+ return AsteriskSCF::Media::V1::FormatSeq();
}
string getId(const Ice::Current&)
@@ -1281,17 +1287,17 @@ public:
unsigned mTrack;
bool mWriting;
- StreamSourcePrx mSource;
+ AsteriskSCF::Media::V1::StreamSourcePrx mSource;
IceUtil::Time mStartTime;
- FrameSeq mQueuedFrames;
+ AsteriskSCF::Media::V1::FrameSeq mQueuedFrames;
boost::shared_mutex mLock;
};
typedef IceUtil::Handle<SourceManager> SourceManagerPtr;
typedef vector<SourceManagerPtr> SourceManagers;
RecordingSessionImpl(const Ice::ObjectAdapterPtr& adapter, const string& id,
- const FileMediaSpecification& spec,
- Matroska::Environment* matroskaEnvironment) :
+ const AsteriskSCF::Media::File::V1::FileMediaSpecification& spec,
+ Matroska::Environment* matroskaEnvironment) :
mObjectAdapter(adapter),
mId(id),
mSpec(spec),
@@ -1301,12 +1307,12 @@ public:
}
- void setCookies(const SessionCookies& cookies, const Ice::Current&)
+ void setCookies(const AsteriskSCF::Media::V1::SessionCookies& cookies, const Ice::Current&)
{
mCookieManager.setCookies(cookies);
}
- void removeCookies(const SessionCookies& cookies, const Ice::Current&)
+ void removeCookies(const AsteriskSCF::Media::V1::SessionCookies& cookies, const Ice::Current&)
{
mCookieManager.removeCookies(cookies);
}
@@ -1330,7 +1336,7 @@ public:
}
}
- FileMediaSpecification getInfo(const Ice::Current&)
+ AsteriskSCF::Media::File::V1::FileMediaSpecification getInfo(const Ice::Current&)
{
return mSpec;
}
@@ -1416,7 +1422,8 @@ public:
mContainer->populateHeader(string("ASCF.Recording.") + mId, filename);
int id = 0;
- for (FormatSeq::const_iterator iter = mSpec.formats.begin(); iter != mSpec.formats.end(); ++iter)
+ for (AsteriskSCF::Media::V1::FormatSeq::const_iterator iter = mSpec.formats.begin();
+ iter != mSpec.formats.end(); ++iter)
{
string trackId = containerId;
trackId += boost::lexical_cast<string>(id++);
@@ -1451,7 +1458,7 @@ public:
{
SourceManagerPtr s = new SourceManager(*iter, mWriter, trackNumber++);
mSourceManagers.push_back(s);
- mSinks.push_back(StreamSinkPrx::uncheckedCast(mObjectAdapter->add(s,
+ mSinks.push_back(AsteriskSCF::Media::V1::StreamSinkPrx::uncheckedCast(mObjectAdapter->add(s,
mObjectAdapter->getCommunicator()->stringToIdentity(*iter))));
}
}
@@ -1459,7 +1466,7 @@ public:
private:
Ice::ObjectAdapterPtr mObjectAdapter;
const string mId;
- FileMediaSpecification mSpec;
+ AsteriskSCF::Media::File::V1::FileMediaSpecification mSpec;
CookieManager mCookieManager;
Matroska::Environment* mMatroskaEnvironment;
boost::shared_ptr<Matroska::ContainerWriter> mContainer;
@@ -1472,15 +1479,16 @@ private:
class ContainerServant : public ContainerImpl
{
public:
- ContainerServant(const ContainerInfoImplPtr& info,
- const FileMediaSpecification& spec,
+ ContainerServant(const ContainerInfoPtr& info,
+ const AsteriskSCF::Media::File::V1::FileMediaSpecification& spec,
Matroska::Environment* matroskaEnvironment,
const Ice::ObjectAdapterPtr& adapter, const Logger& logger) :
- mInfo(info),
- mSpec(spec),
- mMatroskaEnvironment(matroskaEnvironment),
- mAdapter(adapter),
- mLogger(logger)
+ ContainerImpl(info->catalogId),
+ mInfo(info),
+ mSpec(spec),
+ mMatroskaEnvironment(matroskaEnvironment),
+ mAdapter(adapter),
+ mLogger(logger)
{
}
@@ -1512,12 +1520,12 @@ public:
mInfo->supportedOperations = supportedOperations;
}
- ContainerInfoPtr getInfo(const Ice::Current&)
+ ContainerInfoPtr getInfo()
{
return getInfoImpl();
}
- AsteriskSCF::Media::File::V1::FileSessionPrx getMediaSession(const Ice::Current&)
+ AsteriskSCF::Media::File::V1::FileSessionPrx getMediaSession()
{
if (mInfo->supportedOperations == AsteriskSCF::Media::File::V1::Playback)
{
@@ -1525,7 +1533,7 @@ public:
// Just stick to using the adapter to keep track of servants for now.
//
- string id = getInfoImpl()->id;
+ string id = getInfoImpl()->catalogId;
id += ".";
id += IceUtil::generateUUID();
@@ -1553,14 +1561,13 @@ public:
private:
boost::shared_mutex mLock;
- ContainerInfoImplPtr mInfo;
- FileMediaSpecification mSpec;
+ ContainerInfoPtr mInfo;
+ AsteriskSCF::Media::File::V1::FileMediaSpecification mSpec;
Matroska::Environment* mMatroskaEnvironment;
Ice::ObjectAdapterPtr mAdapter;
Logger mLogger;
-
- ContainerInfoImplPtr getInfoImpl()
+ ContainerInfoPtr getInfoImpl()
{
SharedLock lock(mLock);
return mInfo;
@@ -1605,17 +1612,25 @@ private:
};
typedef IceUtil::Handle<ContainerServant> ContainerServantPtr;
+
+} /* End of namespace Implementation */
+
+ContainerImpl::ContainerImpl(const string& id) :
+ ReplicatedObject(id)
+{
+}
+
ContainerImplPtr
-ContainerImpl::create(const ContainerInfoImplPtr& info,
- const FileMediaSpecification& spec,
+ContainerImpl::create(const ContainerInfoPtr& info,
+ const AsteriskSCF::Media::File::V1::FileMediaSpecification& spec,
Matroska::Environment* matroskaEnvironment,
const Ice::ObjectAdapterPtr& adapter,
const AsteriskSCF::System::Logging::Logger& logger)
{
- return new ContainerServant(info, spec, matroskaEnvironment, adapter, logger);
+ return
+ new AsteriskSCF::FileMediaService::Implementation::ContainerServant(info, spec, matroskaEnvironment,
+ adapter, logger);
}
-
-} /* End of namespace Implementation */
} /* End of namespace FileMediaService */
} /* End of namespace AsteriskSCF */
diff --git a/src/ContainerImpl.h b/src/ContainerImpl.h
index 79a8a35..c5572bc 100644
--- a/src/ContainerImpl.h
+++ b/src/ContainerImpl.h
@@ -16,11 +16,14 @@
#pragma once
-#include "LoggerF.h"
#include "MatroskaUtil.h"
+#include "LoggerF.h"
#include "ContainerRepository.h"
+#include "ContainerInfo.h"
+#include "ReplicatedObject.h"
#include <AsteriskSCF/Media/File/FileMediaIf.h>
+#include <vector>
namespace AsteriskSCF
{
@@ -32,17 +35,25 @@ class ContainerImpl : public IceUtil::Shared,
{
public:
+ ContainerImpl(const std::string& id);
+
+ virtual ContainerInfoPtr getInfo() = 0;
+
+ virtual AsteriskSCF::Media::File::V1::FileSessionPrx getMediaSession() =0;
+
virtual void updateInfo(const std::string& uri,
const AsteriskSCF::Media::File::V1::FileOperations supportedOperations) = 0;
static IceUtil::Handle<ContainerImpl> create(
- const ContainerInfoImplPtr& info,
+ const ContainerInfoPtr& info,
const AsteriskSCF::Media::File::V1::FileMediaSpecification& spec,
Matroska::Environment* matroskaEnvironment,
const Ice::ObjectAdapterPtr& adapter,
const AsteriskSCF::System::Logging::Logger& logger);
};
+
typedef IceUtil::Handle<ContainerImpl> ContainerImplPtr;
+typedef std::vector<ContainerImplPtr> ContainerImplSeq;
} /* End of namespace FileMediaService */
} /* End of namespace AsteriskSCF */
diff --git a/src/ContainerRepository.cpp b/src/ContainerRepository.cpp
index 80f930e..7e8624d 100644
--- a/src/ContainerRepository.cpp
+++ b/src/ContainerRepository.cpp
@@ -14,15 +14,22 @@
* at the top of the source tree.
*/
+//
+// There is some kind of collision/namespace confusion that causes
+// compilation errors with tss unless this header file is put first
+//
+#include <boost/thread/tss.hpp>
+
#include "ContainerRepository.h"
#include "ContainerImpl.h"
#include "ContainerConfigurationAdapter.h"
+#include "ContainerInfo.h"
//
// Use latest boost stuff. There is some sensitivity with this boost filesystem
// and the matroska code, so I've included it up here.
//
-#define BOOST_FILESYSTEM_VERSION 3
+#define BOOST_FILESYSTEM_VERSION 2
#include <boost/thread/shared_mutex.hpp>
#include <boost/filesystem.hpp>
@@ -38,7 +45,6 @@
#include "MatroskaUtil.h"
-using namespace AsteriskSCF::FileMediaService::MediaContainer::V1;
using namespace AsteriskSCF::System::Logging;
using namespace AsteriskSCF::FileMediaService;
using namespace AsteriskSCF::Media::File::V1;
@@ -50,38 +56,27 @@ namespace
class ContainerRepositoryServant;
typedef IceUtil::Handle<ContainerRepositoryServant> ContainerRepositoryServantPtr;
-//
-// It is important to note that the updater thread is *not* about automagically adding entries to a repository. That is
-// the job of configuration (although you could design a drop box kind of functionality I suppose). The
-// purpose of the updater is to scan through a repo, destroying objects that are no longer relevant and updating
-// ones that might be dynamically created (recordings?).
-//
-class Updater : public IceUtil::Thread
+struct Memento
{
-public:
- virtual void stop() = 0;
- virtual void setUpdateInterval(const IceUtil::Time& t) = 0;
+ string rootPath;
+ int progressInterval;
};
-typedef IceUtil::Handle<Updater> UpdaterPtr;
class ContainerRepositoryServant : public ContainerRepositoryImpl
{
public:
+
ContainerRepositoryServant(const Ice::ObjectAdapterPtr& adapter, const string& name, const Logger& logger);
- /**
- *
- * Slice to C++ mapping
- *
- */
- ContainerInfoSeq getContainerList(const Ice::Current& current);
- ContainerPrx getContainer(const string& containerId, const Ice::Current& current);
+ ContainerImplSeq getContainerList();
+ ContainerImplPtr getContainer(const string& containerId);
/**
*
* Component implementation.
*
**/
+ AsteriskSCF::Media::File::V1::FileMediaServicePrx mediaService();
RepositoryConfigurationAdapterPtr configurationAdapter();
RepositoryReplicationAdapterPtr replicationAdapter();
@@ -93,15 +88,12 @@ public:
void refresh();
void updateRootPath(const string& pathname);
string getRootPath();
- void startBackgroundUpdates();
- void stopBackgroundUpdates();
- void setUpdateInterval(const IceUtil::Time& interval);
- void setAutoUpdateOption(bool enable);
- void addFilenameExtension(const string& extension);
- void removeFilenameExtension(const string& extension);
- void setFilenameExtensions(const vector<string>& extensions);
- vector<string> getFilenameExtensions();
+ void setProgressUpdateInterval(int updateInterval);
+ int getProgressUpdateInterval();
+
+ void updateConfig(const Memento& memento);
+ Memento* createMemento();
//
// Container info configurations support.
@@ -121,16 +113,16 @@ private:
string mName;
Logger mLogger;
bool mDestroyed;
- bool mAutoUpdate;
string mPath;
-
- ContainerInfoImplSeq mContainerInfoList;
- UpdaterPtr mUpdater;
+
+ typedef map<string, ContainerImplPtr> ContainerMap;
+ ContainerMap mContainers;
set<string> mExtensions;
Matroska::Environment* mMatroskaEnvironment;
+ int mSessionReplicationUpdateInterval;
//
// A *locked* accessor for obtaining the path string. Handy for methods that want the path,
@@ -141,21 +133,6 @@ private:
typedef IceUtil::Handle<ContainerRepositoryServant> ContainerRepositoryServantPtr;
-class UpdaterImpl : public Updater
-{
-public:
- UpdaterImpl(const ContainerRepositoryServantPtr& repository, const Logger& logger);
- void run();
- void setUpdateInterval(const IceUtil::Time& interval);
- void stop();
-private:
- IceUtil::Monitor<IceUtil::Mutex> mMonitor;
- ContainerRepositoryServantPtr mRepository;
- Logger mLogger;
- bool mDone;
- IceUtil::Time mUpdateInterval;
-};
-
class ReplicationAdapterImpl : public RepositoryReplicationAdapter
{
public:
@@ -171,25 +148,25 @@ class ConfigurationAdapterImpl : public RepositoryConfigurationAdapter
public:
ConfigurationAdapterImpl(const ContainerRepositoryServantPtr& containerRepository, const Logger&);
~ConfigurationAdapterImpl();
- void setRootPath(const string& filesystemPath);
- string getRootPath();
- void addFilenameExtension(const string& extension);
- void removeFilenameExtension(const string& extension);
- void setFilenameExtensions(const vector<string>& extensions);
- vector<string> getFilenameExtensions();
... 726 lines suppressed ...
--
asterisk-scf/integration/file_media_service.git
More information about the asterisk-scf-commits
mailing list