当前位置: 首页>>代码示例>>C++>>正文


C++ MediaSource类代码示例

本文整理汇总了C++中MediaSource的典型用法代码示例。如果您正苦于以下问题:C++ MediaSource类的具体用法?C++ MediaSource怎么用?C++ MediaSource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MediaSource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DragDrop

/*	FUNCTION:		ViewObject :: DragDrop
	ARGUMENTS:		none
	RETURN:			n/a
	DESCRIPTION:	Hook function called when user drops files in application window.
					Essentially, determine if file is image or video.	
*/
void ViewObject :: DragDrop(entry_ref *ref, float mouse_x, float mouse_y)
{
	//	Image file?
	BPath path(ref);
	BBitmap *bitmap = BTranslationUtils::GetBitmap(path.Path(), NULL);
	if (bitmap)
	{
		MediaSource *media = new MediaSource(this);
		GLCreateTexture(media, bitmap);
		if (!SurfaceUpdate(media, mouse_x, mouse_y))
			delete media;
		delete bitmap;
		return;
	}
	
	//	Video file
	Video *video = new Video(ref);
	if (video->GetStatus() == B_OK)
	{
		MediaSource *media = new MediaSource(this);
		GLCreateTexture(media, video->GetBitmap());
		media->SetVideo(video);
		if (SurfaceUpdate(media, mouse_x, mouse_y))
			video->Start();
		else
			delete media;
		return;
	}
	else
		delete video;
	
	printf("Unsupported file\n");
}
开发者ID:mariuz,项目名称:haiku,代码行数:39,代码来源:ViewObject.cpp

示例2: DCHECK_EQ

void MediaSourceRegistry::registerURL(SecurityOrigin*, const KURL& url, URLRegistrable* registrable)
{
    DCHECK_EQ(&registrable->registry(), this);
    DCHECK(isMainThread());

    MediaSource* source = static_cast<MediaSource*>(registrable);
    source->addedToRegistry();
    m_mediaSources.set(url.getString(), source);
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:9,代码来源:MediaSourceRegistry.cpp

示例3: ASSERT

void MediaSourceRegistry::registerURL(SecurityOrigin*, const URL& url, URLRegistrable* registrable)
{
    ASSERT(&registrable->registry() == this);
    ASSERT(isMainThread());

    MediaSource* source = static_cast<MediaSource*>(registrable);
    source->addedToRegistry();
    m_mediaSources.set(url.string(), source);
}
开发者ID:AndriyKalashnykov,项目名称:webkit,代码行数:9,代码来源:MediaSourceRegistry.cpp

示例4: durationAttrSetter

static void durationAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
    MediaSource* imp = V8MediaSource::toNative(info.Holder());
    double v = static_cast<double>(value->NumberValue());
    ExceptionCode ec = 0;
    imp->setDuration(v, ec);
    if (UNLIKELY(ec))
        setDOMException(ec, info.GetIsolate());
    return;
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:10,代码来源:V8MediaSource.cpp

示例5: DCHECK

void MediaSourceRegistry::unregisterURL(const KURL& url)
{
    DCHECK(isMainThread());
    PersistentHeapHashMap<String, Member<MediaSource>>::iterator iter = m_mediaSources.find(url.getString());
    if (iter == m_mediaSources.end())
        return;

    MediaSource* source = iter->value;
    m_mediaSources.remove(iter);
    source->removedFromRegistry();
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:11,代码来源:MediaSourceRegistry.cpp

示例6: activeSourceBuffersAttrGetter

static v8::Handle<v8::Value> activeSourceBuffersAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    MediaSource* imp = V8MediaSource::toNative(info.Holder());
    RefPtr<SourceBufferList> result = imp->activeSourceBuffers();
    v8::Handle<v8::Value> wrapper = result.get() ? v8::Handle<v8::Value>(DOMDataStore::getWrapper(result.get(), info.GetIsolate())) : v8Undefined();
    if (wrapper.IsEmpty()) {
        wrapper = toV8(result.get(), info.Holder(), info.GetIsolate());
        if (!wrapper.IsEmpty())
            V8DOMWrapper::setNamedHiddenReference(info.Holder(), "activeSourceBuffers", wrapper);
    }
    return wrapper;
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:12,代码来源:V8MediaSource.cpp

示例7: endOfStreamCallback

static v8::Handle<v8::Value> endOfStreamCallback(const v8::Arguments& args)
{
    MediaSource* imp = V8MediaSource::toNative(args.Holder());
    ExceptionCode ec = 0;
    {
    V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, error, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsNullString));
    imp->endOfStream(error, ec);
    if (UNLIKELY(ec))
        goto fail;
    return v8Undefined();
    }
    fail:
    return setDOMException(ec, args.GetIsolate());
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:14,代码来源:V8MediaSource.cpp

示例8: lookupByName

Boolean FramedSource::lookupByName(UsageEnvironment& env, char const* sourceName,
				   FramedSource*& resultSource) {
  resultSource = NULL; // unless we succeed

  MediaSource* source;
  if (!MediaSource::lookupByName(env, sourceName, source)) return False;

  if (!source->isFramedSource()) {
    env.setResultMsg(sourceName, " is not a framed source");
    return False;
  }

  resultSource = (FramedSource*)source;
  return True;
}
开发者ID:hudokkow,项目名称:pvr.mediaportal.tvserver,代码行数:15,代码来源:FramedSource.cpp

示例9: setNextSource

void MediaObject::setNextSource(const MediaSource &source)
{
    if (source.type() == MediaSource::Invalid &&
        source.type() == MediaSource::Empty)
        return;
    m_nextSource = source;
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:7,代码来源:mediaobject.cpp

示例10: dispatchEventCallback

static v8::Handle<v8::Value> dispatchEventCallback(const v8::Arguments& args)
{
    if (args.Length() < 1)
        return throwNotEnoughArgumentsError(args.GetIsolate());
    MediaSource* imp = V8MediaSource::toNative(args.Holder());
    ExceptionCode ec = 0;
    {
    V8TRYCATCH(Event*, event, V8Event::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8Event::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0);
    bool result = imp->dispatchEvent(event, ec);
    if (UNLIKELY(ec))
        goto fail;
    return v8Boolean(result, args.GetIsolate());
    }
    fail:
    return setDOMException(ec, args.GetIsolate());
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:16,代码来源:V8MediaSource.cpp

示例11: sourceIsCompatibleWithUs

Boolean LiveAMRAudioRTPSink::sourceIsCompatibleWithUs( MediaSource& source )
{
  // Our source must be an AMR audio source:
  if (!source.isAMRAudioSource()) return False;

  // Also, the source must be wideband iff we asked for this:
  LiveAMRAudioDeviceSource& amrSource = (LiveAMRAudioDeviceSource&)source;
  if ((amrSource.isWideband()^sourceIsWideband()) != 0) return False;

  // Also, the source must have the same number of channels that we
  // specified.  (It could, in principle, have more, but we don't
  // support that.)
  if (amrSource.numChannels() != numChannels()) return False;

  // Also, because in our current implementation we output only one
  // frame in each RTP packet, this means that for multi-channel audio,
  // each 'frame-block' will be split over multiple RTP packets, which
  // may violate the spec.  Warn about this:
  if (amrSource.numChannels() > 1) {
    envir() << "AMRAudioRTPSink: Warning: Input source has " << amrSource.numChannels()
      << " audio channels.  In the current implementation, the multi-frame frame-block will be split over multiple RTP packets\n";
  }

  return True;
}
开发者ID:duongbaoduy,项目名称:LiveMediaExt,代码行数:25,代码来源:LiveAMRAudioRTPSink.cpp

示例12: addSourceBufferCallback

static v8::Handle<v8::Value> addSourceBufferCallback(const v8::Arguments& args)
{
    if (args.Length() < 1)
        return throwNotEnoughArgumentsError(args.GetIsolate());
    MediaSource* imp = V8MediaSource::toNative(args.Holder());
    ExceptionCode ec = 0;
    {
    V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, type, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
    RefPtr<SourceBuffer> result = imp->addSourceBuffer(type, ec);
    if (UNLIKELY(ec))
        goto fail;
    return toV8(result.release(), args.Holder(), args.GetIsolate());
    }
    fail:
    return setDOMException(ec, args.GetIsolate());
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:16,代码来源:V8MediaSource.cpp

示例13: K_D

void MediaObject::setCurrentSource(const MediaSource &newSource)
{
    K_D(MediaObject);
    if (!k_ptr->backendObject()) {
        d->mediaSource = newSource;
        return;
    }

    pDebug() << Q_FUNC_INFO << newSource.url();

    stop(); // first call stop as that often is the expected state
            // for setting a new URL

    d->mediaSource = newSource;
#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM
    d->kiofallback = 0; // kiofallback auto-deletes
#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM

//X         if (url.scheme() == "http") {
//X             d->kiofallback = Platform::createMediaStream(url, this);
//X             if (d->kiofallback) {
//X                 ...
//X                 return;
//X             }
//X         }

#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM
    if (d->mediaSource.type() == MediaSource::Stream) {
        Q_ASSERT(d->mediaSource.stream());
        d->mediaSource.stream()->d_func()->setMediaObjectPrivate(d);
    } 
#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM

    INTERFACE_CALL(setSource(d->mediaSource));
}
开发者ID:sandsmark,项目名称:phonon-visualization-gsoc,代码行数:35,代码来源:mediaobject.cpp

示例14: removeSourceBufferCallback

static v8::Handle<v8::Value> removeSourceBufferCallback(const v8::Arguments& args)
{
    if (args.Length() < 1)
        return throwNotEnoughArgumentsError(args.GetIsolate());
    MediaSource* imp = V8MediaSource::toNative(args.Holder());
    ExceptionCode ec = 0;
    {
    V8TRYCATCH(SourceBuffer*, buffer, V8SourceBuffer::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8SourceBuffer::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0);
    imp->removeSourceBuffer(buffer, ec);
    if (UNLIKELY(ec))
        goto fail;
    return v8Undefined();
    }
    fail:
    return setDOMException(ec, args.GetIsolate());
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:16,代码来源:V8MediaSource.cpp

示例15: data

void MediaSourceTest::testIODevice()
{
    const QByteArray data("0192380");
    QBuffer *buffer = new QBuffer;
    buffer->setData(data);
    buffer->open(QIODevice::ReadOnly);

    MediaSource a(buffer);
    QCOMPARE(a.type(), MediaSource::Stream);
    QCOMPARE(a.fileName(), QString());
    QCOMPARE(a.url(), QUrl());
    QCOMPARE(a.discType(), Phonon::NoDisc);
    QVERIFY(a.stream() != 0);
    QCOMPARE(a.deviceName(), QString());
    //QCOMPARE(a.audioCaptureDevice(), AudioCaptureDevice());
    //QCOMPARE(a.videoCaptureDevice(), VideoCaptureDevice());
    MediaSource b(a);
    MediaSource c;
    c = a;
    QCOMPARE(a, b);
    QCOMPARE(a, c);
    QCOMPARE(b, c);

    QCOMPARE(b.type(), MediaSource::Stream);
    QCOMPARE(b.fileName(), QString());
    QCOMPARE(b.url(), QUrl());
    QCOMPARE(b.discType(), Phonon::NoDisc);
    QVERIFY(b.stream() != 0);
    QCOMPARE(b.deviceName(), QString());
    //QCOMPARE(b.audioCaptureDevice(), AudioCaptureDevice());
    //QCOMPARE(b.videoCaptureDevice(), VideoCaptureDevice());

    QCOMPARE(c.type(), MediaSource::Stream);
    QCOMPARE(c.fileName(), QString());
    QCOMPARE(c.url(), QUrl());
    QCOMPARE(c.discType(), Phonon::NoDisc);
    QVERIFY(c.stream() != 0);
    QCOMPARE(c.deviceName(), QString());
    //QCOMPARE(c.audioCaptureDevice(), AudioCaptureDevice());
    //QCOMPARE(c.videoCaptureDevice(), VideoCaptureDevice());

    delete buffer;
    QCOMPARE(a.type(), MediaSource::Invalid);
    QCOMPARE(b.type(), MediaSource::Invalid);
    QCOMPARE(c.type(), MediaSource::Invalid);
    const AbstractMediaStream *null = 0;
    QCOMPARE(a.stream(), null);
    QCOMPARE(b.stream(), null);
    QCOMPARE(c.stream(), null);
}
开发者ID:sandsmark,项目名称:phonon-visualization-gsoc,代码行数:50,代码来源:mediasourcetest.cpp


注:本文中的MediaSource类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。