本文整理汇总了C++中RefPointer类的典型用法代码示例。如果您正苦于以下问题:C++ RefPointer类的具体用法?C++ RefPointer怎么用?C++ RefPointer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RefPointer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FilterPictureSink
FilterPictureSink*
FilterPictureSink::make(FilterGraph* graph, AVFilterContext* ctx) {
Global::init();
RefPointer<FilterPictureSink> r;
r.reset(new FilterPictureSink(graph, ctx), true);
return r.get();
}
示例2: builder
//
// Sign a binary that has no notion of architecture.
// That currently means anything that isn't Mach-O format.
//
void SecCodeSigner::Signer::signArchitectureAgnostic(const Requirement::Context &context)
{
// non-Mach-O executable - single-instance signing
RefPointer<DiskRep::Writer> writer = state.mDetached ?
(new DetachedBlobWriter(*this)) : rep->writer();
CodeDirectory::Builder builder(state.mDigestAlgorithm);
InternalRequirements ireqs;
ireqs(state.mRequirements, rep->defaultRequirements(NULL, state), context);
populate(*writer);
populate(builder, *writer, ireqs, rep->signingBase(), rep->signingLimit());
// add identification blob (made from this architecture) only if we're making a detached signature
if (state.mDetached) {
CFRef<CFDataRef> identification = rep->identification();
writer->component(cdIdentificationSlot, identification);
}
CodeDirectory *cd = builder.build();
CFRef<CFDataRef> signature = signCodeDirectory(cd);
if (!state.mDryRun) {
writer->codeDirectory(cd);
writer->signature(signature);
writer->flush();
}
::free(cd);
}
示例3: getCtx
Coder*
Container::Stream::getCoder() {
if (!mCoder) {
// we need to know the stream direction...
AVFormatContext* ctx = mContainer->getFormatCtx();
AVStream* stream = getCtx();
if (!ctx || !stream) {
VS_THROW(HumbleRuntimeError("could not get container context to find coder"));
}
if (!stream->codec) {
VS_THROW(HumbleRuntimeError("No codec set for stream"));
}
RefPointer<Codec> codec;
if (ctx->iformat) {
// make a copy of the decoder so we decouple it from the container
// completely
codec = Codec::findDecodingCodec((Codec::ID)stream->codec->codec_id);
if (!codec) {
VS_THROW(HumbleRuntimeError("could not find decoding codec"));
}
mCoder = Decoder::make(codec.value(), stream->codec, true);
} else {
VS_THROW(HumbleRuntimeError("Got null encoder on MuxerStream which should not be possible"));
}
}
return mCoder.get();
}
示例4: notify
bool SignallingInterface::notify(Notification event)
{
m_recvMutex.lock();
RefPointer<SignallingReceiver> tmp = m_receiver;
m_recvMutex.unlock();
return tmp && tmp->notify(event);
}
示例5:
Codec*
Codec::guessEncodingCodec(MuxerFormat* pFmt, const char* shortName,
const char* url, const char* mimeType, MediaDescriptor::Type type) {
Global::init();
Codec* retval = 0;
RefPointer<MuxerFormat> fmt = 0;
AVOutputFormat * oFmt = 0;
// We acquire here because the RefPointer always
// releases.
fmt.reset(dynamic_cast<MuxerFormat*>(pFmt), true);
if (!fmt) {
fmt = MuxerFormat::guessFormat(shortName, url, mimeType);
}
if (fmt) oFmt = fmt->getCtx();
// Make sure at least one in put is specified.
// The av_guess_codec function REQUIRES a
// non null AVOutputFormat
// It also examines url with a strcmp(), so let's
// give it a zero-length string.
// In reality, it ignores the other params.
if (!url) url = "";
if (oFmt) {
enum AVCodecID id = av_guess_codec(oFmt, shortName, url, mimeType,
(enum AVMediaType) type);
retval = Codec::findEncodingCodecByIntID((int) id);
}
return retval;
}
示例6: control
bool SignallingReceiver::control(SignallingInterface::Operation oper, NamedList* params)
{
m_ifaceMutex.lock();
RefPointer<SignallingInterface> tmp = m_interface;
m_ifaceMutex.unlock();
return TelEngine::controlReturn(params,tmp && tmp->control(oper,params));
}
示例7: receivedPacket
bool SignallingInterface::receivedPacket(const DataBlock& packet)
{
m_recvMutex.lock();
RefPointer<SignallingReceiver> tmp = m_receiver;
m_recvMutex.unlock();
return tmp && tmp->receivedPacket(packet);
}
示例8: testStreamSetMetaData
void
MetaDataTest :: testStreamSetMetaData()
{
Helper h;
h.setupWriting("testStreamSetMetaData.mp3",
0, "libmp3lame", 0);
RefPointer<IStream> stream = h.container->getStream(0);
RefPointer<IMetaData> meta = stream->getMetaData();
VS_TUT_ENSURE("got meta data", meta);
meta = IMetaData::make();
if (meta)
{
VS_TUT_ENSURE_EQUALS("", meta->getNumKeys(), 0);
meta->setValue("author", "Art Clarke");
stream->setMetaData(meta.value());
}
meta = stream->getMetaData();
VS_TUT_ENSURE("got meta data", meta);
if (meta)
{
VS_TUT_ENSURE_EQUALS("", meta->getNumKeys(), 1);
const char* value = meta->getValue("author", IMetaData::METADATA_NONE);
VS_TUT_ENSURE("", strcmp("Art Clarke",value)==0);
}
}
示例9: make
BufferImpl*
BufferImpl :: make(io::humble::ferry::RefCounted* requestor, int32_t bufferSize)
{
RefPointer<BufferImpl> retval;
if (bufferSize <= 0)
VS_THROW(HumbleInvalidArgument("bufferSize must be > 0"));
void * allocator = requestor ? requestor->getJavaAllocator() : 0;
void *buffer = JNIMemoryManager::malloc(allocator, bufferSize);
if (!buffer) {
VS_THROW(HumbleBadAlloc());
}
try {
retval = BufferImpl::make();
retval->mBuffer = buffer;
retval->mBufferSize = bufferSize;
retval->mInternallyAllocated = true;
} catch (std::exception & e) {
JNIMemoryManager::free(buffer);
throw;
}
return retval.get();
}
示例10: cons
// Attach a tone detector on "chan.attach" as consumer or sniffer
bool AttachHandler::received(Message& msg)
{
String cons(msg.getValue("consumer"));
if (!cons.startsWith("tone/"))
cons.clear();
String snif(msg.getValue("sniffer"));
if (!snif.startsWith("tone/"))
snif.clear();
if (cons.null() && snif.null())
return false;
CallEndpoint* ch = static_cast<CallEndpoint*>(msg.userObject("CallEndpoint"));
RefPointer<DataEndpoint> de = static_cast<DataEndpoint*>(msg.userObject("DataEndpoint"));
DataSource* ds = static_cast<DataSource*>(msg.userObject("DataSource"));
if (ch) {
if (cons) {
ToneConsumer* c = new ToneConsumer(ch->id(),cons);
c->setFaxDivert(msg);
ch->setConsumer(c);
c->deref();
}
if (snif) {
de = ch->setEndpoint();
// try to reinit sniffer if one already exists
ToneConsumer* c = static_cast<ToneConsumer*>(de->getSniffer(snif));
if (c) {
c->init();
c->setFaxDivert(msg);
}
else {
c = new ToneConsumer(ch->id(),snif);
c->setFaxDivert(msg);
de->addSniffer(c);
c->deref();
}
}
return msg.getBoolValue("single");
}
else if (ds && cons) {
ToneConsumer* c = new ToneConsumer(msg.getValue("id"),cons);
c->setFaxDivert(msg);
bool ok = DataTranslator::attachChain(ds,c);
if (ok)
msg.userData(c);
else
msg.setParam("reason","attach-failure");
c->deref();
return ok && msg.getBoolValue("single");
}
else if (de && cons) {
ToneConsumer* c = new ToneConsumer(msg.getValue("id"),cons);
c->setFaxDivert(msg);
de->setConsumer(c);
c->deref();
return msg.getBoolValue("single");
}
else
Debug(&plugin,DebugWarn,"ToneDetector attach request with no call endpoint!");
return false;
}
示例11: FilterAudioSource
FilterAudioSource*
FilterAudioSource::make(FilterGraph* graph,
AVFilterContext* ctx) {
Global::init();
RefPointer<FilterAudioSource> r;
r.reset(new FilterAudioSource(graph, ctx), true);
return r.get();
}
示例12: transmitPacket
bool SignallingReceiver::transmitPacket(const DataBlock& packet, bool repeat,
SignallingInterface::PacketType type)
{
m_ifaceMutex.lock();
RefPointer<SignallingInterface> tmp = m_interface;
m_ifaceMutex.unlock();
return tmp && tmp->transmitPacket(packet,repeat,type);
}
示例13: TS_ASSERT
void
BitStreamFilterTest::testMakeByType () {
const char* name = "noise";
RefPointer<BitStreamFilterType> t = BitStreamFilterType::getBitStreamFilterType(name);
TS_ASSERT(strcmp(name, t->getName())==0);
RefPointer<BitStreamFilter> f = BitStreamFilter::make(t.value());
TS_ASSERT(strcmp(name, f->getName())==0);
}
示例14:
void
EncoderTest::testCreation() {
Logger::setGlobalIsLogging(Logger::LEVEL_TRACE, false);
RefPointer<Codec> codec = Codec::findEncodingCodec(Codec::CODEC_ID_H264);
RefPointer<Encoder> encoder = Encoder::make(codec.value());
TS_ASSERT(encoder);
}
示例15: HumbleInvalidArgument
MediaSubtitleRectangle*
MediaSubtitleRectangle::make(AVSubtitleRect* ctx) {
if (!ctx)
throw HumbleInvalidArgument("no context");
RefPointer<MediaSubtitleRectangle> retval = make();
retval->mCtx = ctx;
return retval.get();
}