BufferQueueCore::BufferQueueCore(const sp<IGraphicBufferAlloc>& allocator) :
    mAllocator(allocator),
    mMutex(),
    mIsAbandoned(false),
    mConsumerControlledByApp(false),
    mConsumerName(getUniqueName()),
    mConsumerListener(),
    mConsumerUsageBits(0),
    mConnectedApi(NO_CONNECTED_API),
    mLinkedToDeath(),
    mConnectedProducerListener(),
    mSlots(),
    mQueue(),
    mFreeSlots(),
    mFreeBuffers(),
    mUnusedSlots(),
    mActiveBuffers(),
    mDequeueCondition(),
    mDequeueBufferCannotBlock(false),
    mDefaultBufferFormat(PIXEL_FORMAT_RGBA_8888),
    mDefaultWidth(1),
    mDefaultHeight(1),
    mDefaultBufferDataSpace(HAL_DATASPACE_UNKNOWN),
    mMaxBufferCount(BufferQueueDefs::NUM_BUFFER_SLOTS),
    mMaxAcquiredBufferCount(1),
    mMaxDequeuedBufferCount(1),
    mBufferHasBeenQueued(false),
    mFrameCounter(0),
    mTransformHint(0),
    mIsAllocating(false),
    mIsAllocatingCondition(),
    mAllowAllocation(true),
    mBufferAge(0),
    mGenerationNumber(0),
    mAsyncMode(false),
    mSharedBufferMode(false),
    mAutoRefresh(false),
    mSharedBufferSlot(INVALID_BUFFER_SLOT),
    mSharedBufferCache(Rect::INVALID_RECT, 0, NATIVE_WINDOW_SCALING_MODE_FREEZE,
            HAL_DATASPACE_UNKNOWN),
    mUniqueId(getUniqueId())
{
    if (allocator == NULL) {

#ifdef HAVE_NO_SURFACE_FLINGER
        // Without a SurfaceFlinger, allocate in-process.  This only makes
        // sense in systems with static SELinux configurations and no
        // applications (since applications need dynamic SELinux policy).
        mAllocator = new GraphicBufferAlloc();
#else
        // Run time check for headless, where we also allocate in-process.
        char value[PROPERTY_VALUE_MAX];
        property_get("config.headless", value, "0");
        if (atoi(value) == 1) {
            mAllocator = new GraphicBufferAlloc();
        } else {
            sp<ISurfaceComposer> composer(ComposerService::getComposerService());
            mAllocator = composer->createGraphicBufferAlloc();
        }
#endif  // HAVE_NO_SURFACE_FLINGER

        if (mAllocator == NULL) {
            BQ_LOGE("createGraphicBufferAlloc failed");
        }
    }

    int numStartingBuffers = getMaxBufferCountLocked();
    for (int s = 0; s < numStartingBuffers; s++) {
        mFreeSlots.insert(s);
    }
    for (int s = numStartingBuffers; s < BufferQueueDefs::NUM_BUFFER_SLOTS;
            s++) {
        mUnusedSlots.push_front(s);
    }
}
TEST(LayerComposer, FindsNoSuitableWindowForLayer) {
  auto renderer = std::make_shared<MockRenderer>();

  // The default policy will create a dumb window instance when requested
  // from the manager.
  auto platform = platform::create();
  auto app_db = std::make_shared<application::Database>();
  auto wm = std::make_shared<wm::MultiWindowManager>(platform, nullptr, app_db);

  auto single_window = wm::WindowState{
      wm::Display::Id{1},
      true,
      graphics::Rect{0, 0, 1024, 768},
      "org.anbox.test.1",
      wm::Task::Id{1},
      wm::Stack::Id::Freeform,
  };

  wm->apply_window_state_update({single_window}, {});

  LayerComposer composer(renderer, std::make_shared<MultiWindowComposerStrategy>(wm));

  // A single renderable which has a different task id then the window we know
  // about
  RenderableList renderables = {
      {"org.anbox.surface.2", 0, {0, 0, 1024, 768}, {0, 0, 1024, 768}},
  };

  // The renderer should not be called for a layer which doesn't exist
  EXPECT_CALL(*renderer, draw(_, _, _)).Times(0);

  composer.submit_layers(renderables);
}
Exemple #3
0
BufferQueue::BufferQueue(  bool allowSynchronousMode, int bufferCount ) :
    mDefaultWidth(1),
    mDefaultHeight(1),
    mPixelFormat(PIXEL_FORMAT_RGBA_8888),
    mMinUndequeuedBuffers(bufferCount),
    mMinAsyncBufferSlots(bufferCount + 1),
    mMinSyncBufferSlots(bufferCount),
    mBufferCount(mMinAsyncBufferSlots),
    mClientBufferCount(0),
    mServerBufferCount(mMinAsyncBufferSlots),
    mSynchronousMode(false),
    mAllowSynchronousMode(allowSynchronousMode),
    mConnectedApi(NO_CONNECTED_API),
    mAbandoned(false),
    mFrameCounter(0),
    mBufferHasBeenQueued(false),
    mDefaultBufferFormat(0),
    mConsumerUsageBits(0),
    mTransformHint(0)
{
    // Choose a name using the PID and a process-unique ID.
    mConsumerName = String8::format("unnamed-%d-%d", getpid(), createProcessUniqueId());

    ST_LOGV("BufferQueue");
    sp<ISurfaceComposer> composer(ComposerService::getComposerService());
    mGraphicBufferAlloc = composer->createGraphicBufferAlloc();
    if (mGraphicBufferAlloc == 0) {
        ST_LOGE("createGraphicBufferAlloc() failed in BufferQueue()");
    }
}
BufferQueue::BufferQueue(bool allowSynchronousMode,
        const sp<IGraphicBufferAlloc>& allocator) :
    mDefaultWidth(1),
    mDefaultHeight(1),
    mMaxAcquiredBufferCount(1),
    mDefaultMaxBufferCount(2),
    mOverrideMaxBufferCount(0),
    mSynchronousMode(false),
    mAllowSynchronousMode(allowSynchronousMode),
    mConnectedApi(NO_CONNECTED_API),
    mAbandoned(false),
    mFrameCounter(0),
    mBufferHasBeenQueued(false),
    mDefaultBufferFormat(PIXEL_FORMAT_RGBA_8888),
    mConsumerUsageBits(0),
    mTransformHint(0)
{
    // Choose a name using the PID and a process-unique ID.
    mConsumerName = String8::format("unnamed-%d-%d", getpid(), createProcessUniqueId());

    ST_LOGV("BufferQueue");
    if (allocator == NULL) {
        sp<ISurfaceComposer> composer(ComposerService::getComposerService());
        mGraphicBufferAlloc = composer->createGraphicBufferAlloc();
        if (mGraphicBufferAlloc == 0) {
            ST_LOGE("createGraphicBufferAlloc() failed in BufferQueue()");
        }
    } else {
        mGraphicBufferAlloc = allocator;
    }
}
BufferQueueCoreBF::BufferQueueCoreBF(const sp<IGraphicBufferAlloc>& allocator) :
    mAllocator(allocator),
    mMutex(),
    mIsAbandoned(false),
    mConsumerControlledByApp(false),
    mConsumerName(getUniqueName()),
    mConsumerListener(),
    mConsumerUsageBits(0),
    mConnectedApi(NO_CONNECTED_API),
    mConnectedProducerListener(),
    mSlots(),
    mQueue(),
    mOverrideMaxBufferCount(0),
    mDequeueCondition(),
    mUseAsyncBuffer(true),
    mDequeueBufferCannotBlock(false),
    mDefaultBufferFormat(PIXEL_FORMAT_RGBA_8888),
    mDefaultWidth(1),
    mDefaultHeight(1),
    mDefaultMaxBufferCount(2),
    mMaxAcquiredBufferCount(1),
    mBufferHasBeenQueued(false),
    mFrameCounter(0),
    mTransformHint(0),
    mIsAllocating(false),
    mIsAllocatingCondition()
{
    if (allocator == NULL) {
        sp<ISurfaceComposer> composer(ComposerService::getComposerService());
        mAllocator = composer->createGraphicBufferAlloc();
        if (mAllocator == NULL) {
            BQ_LOGE("createGraphicBufferAlloc failed");
        }
    }
}
void WriteMail::modify(const QMailMessage& previousMessage)
{
    QString recipients = "";

    prepareComposer(previousMessage.messageType(), previousMessage.parentAccountId());
    if (composer().isEmpty())
        return;

    // Record any message properties we should retain
    mail.setId(previousMessage.id());
    mail.setParentFolderId(previousMessage.parentFolderId());
    mail.setContentScheme(previousMessage.contentScheme());
    mail.setContentIdentifier(previousMessage.contentIdentifier());
    mail.setTo(previousMessage.to());
    mail.setFrom(previousMessage.from());
    mail.setCustomFields(previousMessage.customFields());
    mail.setServerUid(previousMessage.serverUid());

    m_composerInterface->compose(QMailMessage::NoResponse, previousMessage);

    // ugh. we need to do this everywhere
    m_hasMessageChanged = false;
    m_precursorId = mail.inResponseTo();
    m_replyAction = mail.responseType();
}
TEST(LayerComposer, MapsLayersToWindows) {
  auto renderer = std::make_shared<MockRenderer>();

  // The default policy will create a dumb window instance when requested
  // from the manager.
  auto platform = platform::create();
  auto app_db = std::make_shared<application::Database>();
  auto wm = std::make_shared<wm::MultiWindowManager>(platform, nullptr, app_db);

  auto first_window = wm::WindowState{
      wm::Display::Id{1},
      true,
      graphics::Rect{0, 0, 1024, 768},
      "org.anbox.foo",
      wm::Task::Id{1},
      wm::Stack::Id::Freeform,
  };

  auto second_window = wm::WindowState{
      wm::Display::Id{1},
      true,
      graphics::Rect{300, 400, 1324, 1168},
      "org.anbox.bar",
      wm::Task::Id{2},
      wm::Stack::Id::Freeform,
  };

  wm->apply_window_state_update({first_window, second_window}, {});

  LayerComposer composer(renderer, std::make_shared<MultiWindowComposerStrategy>(wm));

  // A single renderable which has a different task id then the window we know
  // about
  RenderableList renderables = {
      {"org.anbox.surface.1", 0, {0, 0, 1024, 768}, {0, 0, 1024, 768}},
      {"org.anbox.surface.2", 1, {0, 0, 1024, 768}, {0, 0, 1024, 768}},
  };

  RenderableList first_window_renderables{
      {"org.anbox.surface.1", 0, {0, 0, 1024, 768}, {0, 0, 1024, 768}},
  };

  RenderableList second_window_renderables{
      {"org.anbox.surface.2", 1, {0, 0, 1024, 768}, {0, 0, 1024, 768}},
  };

  EXPECT_CALL(*renderer, draw(_, Rect{0, 0, first_window.frame().width(),
                                      first_window.frame().height()},
                              first_window_renderables))
      .Times(1)
      .WillOnce(Return(true));
  EXPECT_CALL(*renderer, draw(_, Rect{0, 0, second_window.frame().width(),
                                      second_window.frame().height()},
                              second_window_renderables))
      .Times(1)
      .WillOnce(Return(true));

  composer.submit_layers(renderables);
}
void WriteMail::create(const QMailMessage& initMessage)
{
    prepareComposer(initMessage.messageType(), initMessage.parentAccountId());
    if (composer().isEmpty())
        return;

    m_composerInterface->compose(QMailMessage::NoResponse, initMessage);
    m_hasMessageChanged = true;
}
void PrinterWidget::print_composed(QPrinter* printer)
{
    QList<QPixmap*> pixes_to_print = getSelectedPixes();
    PrintCompositor composer(*printer);
    for (QList<QPixmap*>::iterator it = pixes_to_print.begin(); it != pixes_to_print.end(); ++it)
    {
        composer.addPixmap(**it);
    }
    composer.composite();
}
void WriteMail::respond(const QMailMessage& source, QMailMessage::ResponseType type)
{
    prepareComposer(source.messageType(), source.parentAccountId());
    if (composer().isEmpty())
        return;

    m_composerInterface->compose(type, source);
    m_hasMessageChanged = true;
    m_precursorId = source.id();
    m_replyAction = type;
}
TwitterApiSearchTimelineWidget* TwitterApiMicroBlogWidget::addSearchTimelineWidgetToUi(const QString& name,
                                                                                       const SearchInfo &info)
{
    kDebug();
    TwitterApiSearchTimelineWidget *mbw = d->mBlog->createSearchTimelineWidget(currentAccount(), name,
                                                                               info, this);
    if(mbw) {
        mbw->setObjectName(name);
        mSearchTimelines.insert(name, mbw);
        timelines().insert(name, mbw);
        timelinesTabWidget()->addTab(mbw, name);
        timelinesTabWidget()->setTabIcon(timelinesTabWidget()->indexOf(mbw), KIcon("edit-find"));
        connect( mbw, SIGNAL(updateUnreadCount(int)),
                    this, SLOT(slotUpdateUnreadCount(int)) );
        if(composer()) {
            connect( mbw, SIGNAL(forwardResendPost(QString)),
                     composer(), SLOT(setText(QString)) );
            connect( mbw, SIGNAL(forwardReply(QString,QString)),
                     composer(), SLOT(setText(QString,QString)) );
        }
        timelinesTabWidget()->setCurrentWidget(mbw);
    } else {
int SurfaceTextureClient::query(int what, int* value) const {
    ATRACE_CALL();
    ALOGV("SurfaceTextureClient::query");
    { // scope for the lock
        Mutex::Autolock lock(mMutex);
        switch (what) {
            case NATIVE_WINDOW_FORMAT:
                if (mReqFormat) {
                    *value = mReqFormat;
                    return NO_ERROR;
                }
                break;
            case NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER: {
                sp<ISurfaceComposer> composer(
                        ComposerService::getComposerService());
                if (composer->authenticateSurfaceTexture(mSurfaceTexture)) {
                    *value = 1;
                } else {
                    *value = 0;
                }
                return NO_ERROR;
            }
            case NATIVE_WINDOW_CONCRETE_TYPE:
                *value = NATIVE_WINDOW_SURFACE_TEXTURE_CLIENT;
                return NO_ERROR;
            case NATIVE_WINDOW_DEFAULT_WIDTH:
                *value = mUserWidth ? mUserWidth : mDefaultWidth;
                return NO_ERROR;
            case NATIVE_WINDOW_DEFAULT_HEIGHT:
                *value = mUserHeight ? mUserHeight : mDefaultHeight;
                return NO_ERROR;
            case NATIVE_WINDOW_TRANSFORM_HINT:
                *value = mTransformHint;
                return NO_ERROR;
            case NATIVE_WINDOW_CONSUMER_RUNNING_BEHIND: {
                status_t err = NO_ERROR;
                if (!mConsumerRunningBehind) {
                    *value = 0;
                } else {
                    err = mSurfaceTexture->query(what, value);
                    if (err == NO_ERROR) {
                        mConsumerRunningBehind = *value;
                    }
                }
                return err;
            }
        }
    }
    return mSurfaceTexture->query(what, value);
}
TEST(LayerComposer, PopupShouldNotCauseWindowLayerOffset) {
  auto renderer = std::make_shared<MockRenderer>();

  // The default policy will create a dumb window instance when requested
  // from the manager.
  auto platform = platform::create();
  auto app_db = std::make_shared<application::Database>();
  auto wm = std::make_shared<wm::MultiWindowManager>(platform, nullptr, app_db);

  auto window = wm::WindowState{
      wm::Display::Id{1},
      true,
      graphics::Rect{1120, 270, 2144, 1038},
      "org.anbox.foo",
      wm::Task::Id{3},
      wm::Stack::Id::Freeform,
  };

  wm->apply_window_state_update({window}, {});

  LayerComposer composer(renderer, std::make_shared<MultiWindowComposerStrategy>(wm));

  // Having two renderables where the second smaller one overlaps the bigger
  // one and goes a bit offscreen. This should be still placed correctly and
  // the small layer should go offscreen as it is supposed to. This typically
  // happens when a popup window appears which has a shadow attached which goes
  // out of the window area. In our case this is not possible as the area the
  // window has available is static.
  RenderableList renderables = {
    {"org.anbox.surface.3", 0, {1120,270,2144,1038}, {0, 0, 1024, 768}},
    {"org.anbox.surface.3", 1, {1904, 246, 2164, 406}, {0, 0, 260, 160}},
  };

  RenderableList expected_renderables{
    {"org.anbox.surface.3", 0, {0, 0, 1024, 768}, {0, 0, 1024, 768}},
    {"org.anbox.surface.3", 1, {784, -24, 1044, 136}, {0, 0, 260, 160}},
  };

  EXPECT_CALL(*renderer, draw(_, Rect{0, 0,
                                      window.frame().width(),
                                      window.frame().height()},
                              expected_renderables))
      .Times(1)
      .WillOnce(Return(true));

  composer.submit_layers(renderables);
}
Exemple #14
0
QString RDLogLine::resolveWildcards(QString pattern)
{
  pattern.replace("%n",QString().sprintf("%06u",cartNumber()));
  pattern.replace("%h",QString().sprintf("%d",effectiveLength()));
  pattern.replace("%g",groupName());
  pattern.replace("%t",title());
  pattern.replace("%a",artist());
  pattern.replace("%l",album());
  pattern.replace("%y",year().toString("yyyy"));
  pattern.replace("%b",label());
  pattern.replace("%c",client());
  pattern.replace("%e",agency());
  pattern.replace("%m",composer());
  pattern.replace("%p",publisher());
  pattern.replace("%u",userDefined());

  return pattern;
}
TEST(LayerComposer, WindowPartiallyOffscreen) {
  auto renderer = std::make_shared<MockRenderer>();

  // The default policy will create a dumb window instance when requested
  // from the manager.
  auto platform = platform::create();
  auto app_db = std::make_shared<application::Database>();
  auto wm = std::make_shared<wm::MultiWindowManager>(platform, nullptr, app_db);

  auto window = wm::WindowState{
      wm::Display::Id{1},
      true,
      graphics::Rect{-100, -100, 924, 668},
      "org.anbox.foo",
      wm::Task::Id{1},
      wm::Stack::Id::Freeform,
  };

  wm->apply_window_state_update({window}, {});

  LayerComposer composer(renderer, std::make_shared<MultiWindowComposerStrategy>(wm));

  // Window is build out of two layers where one is placed inside the other
  // but the layer covering the whole window is placed with its top left
  // origin outside of the visible display area.
  RenderableList renderables = {
    {"org.anbox.surface.1", 0, {-100, -100, 924, 668}, {0, 0, 1024, 768}},
    {"org.anbox.surface.1", 1, {0, 0, 100, 200}, {0, 0, 100, 200}},
  };

  RenderableList expected_renderables{
    {"org.anbox.surface.1", 0, {0, 0, 1024, 768}, {0, 0, 1024, 768}},
    {"org.anbox.surface.1", 1, {100, 100, 200, 300}, {0, 0, 100, 200}},
  };

  EXPECT_CALL(*renderer, draw(_, Rect{0, 0,
                                      window.frame().width(),
                                      window.frame().height()},
                              expected_renderables))
      .Times(1)
      .WillOnce(Return(true));

  composer.submit_layers(renderables);
}
SurfaceMediaSource::SurfaceMediaSource(uint32_t bufferWidth, uint32_t bufferHeight) :
    mWidth(bufferWidth),
    mHeight(bufferHeight),
    mCurrentSlot(BufferQueue::INVALID_BUFFER_SLOT),
    mNumPendingBuffers(0),
    mCurrentTimestamp(0),
    mFrameRate(30),
    mStarted(false),
    mNumFramesReceived(0),
    mNumFramesEncoded(0),
    mFirstFrameTimestamp(0),
    mMaxAcquiredBufferCount(4),  // XXX double-check the default
    mUseAbsoluteTimestamps(false),
    mBuffersReleased(false) {
    ALOGV("SurfaceMediaSource");

    if (bufferWidth == 0 || bufferHeight == 0) {
        ALOGE("Invalid dimensions %dx%d", bufferWidth, bufferHeight);
    }

    mBufferQueue = new BufferQueue(true);
    mBufferQueue->setDefaultBufferSize(bufferWidth, bufferHeight);
    mBufferQueue->setSynchronousMode(true);
    mBufferQueue->setConsumerUsageBits(GRALLOC_USAGE_HW_VIDEO_ENCODER |
            GRALLOC_USAGE_HW_TEXTURE);

    sp<ISurfaceComposer> composer(ComposerService::getComposerService());

    // Note that we can't create an sp<...>(this) in a ctor that will not keep a
    // reference once the ctor ends, as that would cause the refcount of 'this'
    // dropping to 0 at the end of the ctor.  Since all we need is a wp<...>
    // that's what we create.
    wp<BufferQueue::ConsumerListener> listener;
    sp<BufferQueue::ConsumerListener> proxy;
    listener = static_cast<BufferQueue::ConsumerListener*>(this);
    proxy = new BufferQueue::ProxyConsumerListener(listener);

    status_t err = mBufferQueue->consumerConnect(proxy);
    if (err != NO_ERROR) {
        ALOGE("SurfaceMediaSource: error connecting to BufferQueue: %s (%d)",
                strerror(-err), err);
    }
}
SurfaceMediaSource::SurfaceMediaSource(uint32_t bufW, uint32_t bufH) :
                mDefaultWidth(bufW),
                mDefaultHeight(bufH),
                mPixelFormat(0),
                mBufferCount(MIN_ASYNC_BUFFER_SLOTS),
                mClientBufferCount(0),
                mServerBufferCount(MIN_ASYNC_BUFFER_SLOTS),
                mCurrentSlot(INVALID_BUFFER_SLOT),
                mCurrentTimestamp(0),
                mSynchronousMode(true),
                mConnectedApi(NO_CONNECTED_API),
                mFrameRate(30),
                mStopped(false),
                mNumFramesReceived(0),
                mNumFramesEncoded(0),
                mFirstFrameTimestamp(0) {
    LOGV("SurfaceMediaSource::SurfaceMediaSource");
    sp<ISurfaceComposer> composer(ComposerService::getComposerService());
    mGraphicBufferAlloc = composer->createGraphicBufferAlloc();
}
static jlong android_view_GraphiceBuffer_create(JNIEnv* env, jobject clazz,
        jint width, jint height, jint format, jint usage) {

    sp<ISurfaceComposer> composer(ComposerService::getComposerService());
    sp<IGraphicBufferAlloc> alloc(composer->createGraphicBufferAlloc());
    if (alloc == NULL) {
        GB_LOGW("createGraphicBufferAlloc() failed in GraphicBuffer.create()");
        return NULL;
    }

    status_t error;
    sp<GraphicBuffer> buffer(alloc->createGraphicBuffer(width, height, format, usage, &error));
    if (buffer == NULL) {
        GB_LOGW("createGraphicBuffer() failed in GraphicBuffer.create()");
        return NULL;
    }

    GraphicBufferWrapper* wrapper = new GraphicBufferWrapper(buffer);
    return reinterpret_cast<jlong>(wrapper);
}
Exemple #19
0
int SurfaceTextureClient::query(int what, int* value) const {
    LOGV("SurfaceTextureClient::query");
    { // scope for the lock
        Mutex::Autolock lock(mMutex);
        switch (what) {
            case NATIVE_WINDOW_FORMAT:
                if (mReqFormat) {
                    *value = mReqFormat;
                    return NO_ERROR;
                }
                break;
            case NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER:
                {
                    sp<ISurfaceComposer> composer(
                            ComposerService::getComposerService());
                    if (composer->authenticateSurfaceTexture(mSurfaceTexture)) {
                        *value = 1;
                    } else {
                        *value = 0;
                    }
                }
                return NO_ERROR;
            case NATIVE_WINDOW_CONCRETE_TYPE:
                *value = NATIVE_WINDOW_SURFACE_TEXTURE_CLIENT;
                return NO_ERROR;
            case NATIVE_WINDOW_DEFAULT_WIDTH:
                *value = mDefaultWidth;
                return NO_ERROR;
            case NATIVE_WINDOW_DEFAULT_HEIGHT:
                *value = mDefaultHeight;
                return NO_ERROR;
            case NATIVE_WINDOW_TRANSFORM_HINT:
                if (mSurfaceTexture->query(what, value) != NO_ERROR) {
                    *value = mTransformHint;
                }
                return NO_ERROR;
        }
    }
    return mSurfaceTexture->query(what, value);
}
Exemple #20
0
qint32 cMediaInfo::writeFilename()
{
	QSqlQuery	query;

	query.prepare("SELECT id FROM file WHERE fileName=:fileName AND fileSize=:fileSize AND fileDate=:fileDate;");
	query.bindValue(":fileName", fileName());
	query.bindValue(":fileSize", fileSize());
	query.bindValue(":fileDate", fileDate());

	if(!query.exec())
	{
		myDebug << query.lastError().text();
		return(-1);
	}

	if(query.next())
		query.prepare("UPDATE file SET fileType=:fileType, length=:length, bitrate=:bitrate, sampleRate=:sampleRate, channels=:channels, bitsPerSample=:bitsPerSample, layer=:layer, version=:version, sampleWidth=:sampleWidth, sampleFrames=:sampleFrames, isEncrypted=:isEncrypted, trackGain=:trackGain, albumGain=:albumGain, trackPeak=:trackPeak, albumPeak=:albumPeak, protectionEnabled=:protectionEnabled, channelMode=:channelMode, isCopyrighted=:isCopyrighted, isOriginal=:isOriginal, album=:album, title=:title, copyright=:copyright, trackNumber=:trackNumber, contentGroupDescription=:contentGroupDescription, subTitle=:subTitle, originalAlbum=:originalAlbum, partOfSet=:partOfSet, subTitleOfSet=:subTitleOfSet, internationalStandardRecordingCode=:internationalStandardRecordingCode, leadArtist=:leadArtist, band=:band, conductor=:conductor, interpret=:interpret, originalArtist=:originalArtist, textWriter=:textWriter, originalTextWriter=:originalTextWriter, composer=:composer, encodedBy=:encodedBy, beatsPerMinute=:beatsPerMinute, language=:language, contentType=:contentType, mediaType=:mediaType, mood=:mood, producedNotice=:producedNotice, publisher=:publisher, fileOwner=:fileOwner, internetRadioStationName=:internetRadioStationName, internetRadioStationOwner=:internetRadioStationOwner, originalFilename=:originalFilename, playlistDelay=:playlistDelay, encodingTime=:encodingTime, originalReleaseTime=:originalReleaseTime, recordingTime=:recordingTime, releaseTime=:releaseTime, taggingTime=:taggingTime, swhwSettings=:swhwSettings, albumSortOrder=:albumSortOrder, performerSortOrder=:performerSortOrder, titleSortOrder=:titleSortOrder, synchronizedLyrics=:synchronizedLyrics, unsynchronizedLyrics=:unsynchronizedLyrics WHERE filename=:filename AND filesize=:filesize AND filedate=:filedate;");
	else
		query.prepare("INSERT INTO file (fileName, fileSize, fileDate, fileType, length, bitrate, sampleRate, channels, bitsPerSample, layer, version, sampleWidth, sampleFrames, isEncrypted, trackGain, albumGain, trackPeak, albumPeak, protectionEnabled, channelMode, isCopyrighted, isOriginal, album, title, copyright, trackNumber, contentGroupDescription, subTitle, originalAlbum, partOfSet, subTitleOfSet, internationalStandardRecordingCode, leadArtist, band, conductor, interpret, originalArtist, textWriter, originalTextWriter, composer, encodedBy, beatsPerMinute, language, contentType, mediaType, mood, producedNotice, publisher, fileOwner, internetRadioStationName, internetRadioStationOwner, originalFilename, playlistDelay, encodingTime, originalReleaseTime, recordingTime, releaseTime, taggingTime, swhwSettings, albumSortOrder, performerSortOrder, titleSortOrder, synchronizedLyrics, unsynchronizedLyrics) VALUES (:fileName, :fileSize, :fileDate, :fileType, :length, :bitrate, :sampleRate, :channels, :bitsPerSample, :layer, :version, :sampleWidth, :sampleFrames, :isEncrypted, :trackGain, :albumGain, :trackPeak, :albumPeak, :protectionEnabled, :channelMode, :isCopyrighted, :isOriginal, :album, :title, :copyright, :trackNumber, :contentGroupDescription, :subTitle, :originalAlbum, :partOfSet, :subTitleOfSet, :internationalStandardRecordingCode, :leadArtist, :band, :conductor, :interpret, :originalArtist, :textWriter, :originalTextWriter, :composer, :encodedBy, :beatsPerMinute, :language, :contentType, :mediaType, :mood, :producedNotice, :publisher, :fileOwner, :internetRadioStationName, :internetRadioStationOwner, :originalFilename, :playlistDelay, :encodingTime, :originalReleaseTime, :recordingTime, :releaseTime, :taggingTime, :swhwSettings, :albumSortOrder, :performerSortOrder, :titleSortOrder, :synchronizedLyrics, :unsynchronizedLyrics);");

	query.bindValue(":fileName", fileName());
	query.bindValue(":fileSize", fileSize());
	query.bindValue(":fileDate", fileDate());
	query.bindValue(":fileType", fileType());
	query.bindValue(":length", length());
	query.bindValue(":bitrate", bitrate());
	query.bindValue(":sampleRate", sampleRate());
	query.bindValue(":channels", channels());
	query.bindValue(":bitsPerSample", bitsPerSample());
	query.bindValue(":layer", layer());
	query.bindValue(":version", version());
	query.bindValue(":sampleWidth", sampleWidth());
	query.bindValue(":sampleFrames", sampleFrames());
	query.bindValue(":isEncrypted", isEncrypted());
	query.bindValue(":trackGain", trackGain());
	query.bindValue(":albumGain", albumGain());
	query.bindValue(":trackPeak", trackPeak());
	query.bindValue(":albumPeak", albumPeak());
	query.bindValue(":protectionEnabled", protectionEnabled());
	query.bindValue(":channelMode", channelMode());
	query.bindValue(":isCopyrighted", isCopyrighted());
	query.bindValue(":isOriginal", isOriginal());
	query.bindValue(":album", album());
	query.bindValue(":title", title());
	query.bindValue(":copyright", copyright());
	query.bindValue(":trackNumber", trackNumber());
	query.bindValue(":contentGroupDescription", contentGroupDescription());
	query.bindValue(":subTitle", subTitle());
	query.bindValue(":originalAlbum", originalAlbum());
	query.bindValue(":partOfSet", partOfSet());
	query.bindValue(":subTitleOfSet", subTitleOfSet());
	query.bindValue(":internationalStandardRecordingCode", internationalStandardRecordingCode());
	query.bindValue(":leadArtist", leadArtist());
	query.bindValue(":band", band());
	query.bindValue(":conductor", conductor());
	query.bindValue(":interpret", interpret().join(", "));
	query.bindValue(":originalArtist", originalArtist());
	query.bindValue(":textWriter", textWriter());
	query.bindValue(":originalTextWriter", originalTextWriter());
	query.bindValue(":composer", composer());
	query.bindValue(":encodedBy", encodedBy());
	query.bindValue(":beatsPerMinute", beatsPerMinute());
	query.bindValue(":language", language().join(", "));
	query.bindValue(":contentType", contentType().join(", "));
	query.bindValue(":mediaType", mediaType().join(", "));
	query.bindValue(":mood", mood());
	query.bindValue(":producedNotice", producedNotice());
	query.bindValue(":publisher", publisher());
	query.bindValue(":fileOwner", fileOwner());
	query.bindValue(":internetRadioStationName", internetRadioStationName());
	query.bindValue(":internetRadioStationOwner", internetRadioStationOwner());
	query.bindValue(":originalFilename", originalFilename());
	query.bindValue(":playlistDelay", playlistDelay());
	query.bindValue(":encodingTime", encodingTime());
	query.bindValue(":originalReleaseTime", originalReleaseTime());
	query.bindValue(":recordingTime", recordingTime());
	query.bindValue(":releaseTime", releaseTime());
	query.bindValue(":taggingTime", taggingTime());
	query.bindValue(":swhwSettings", swhwSettings().join(", "));
	query.bindValue(":albumSortOrder", albumSortOrder());
	query.bindValue(":performerSortOrder", performerSortOrder());
	query.bindValue(":titleSortOrder", titleSortOrder());
	query.bindValue(":synchronizedLyrics", synchronizedLyrics().join());
	query.bindValue(":unsynchronizedLyrics", unsynchronizedLyrics().join("||"));

	if(!query.exec())
	{
		myDebug << query.lastError().text();
		return(-1);
	}

	query.prepare("SELECT id FROM file WHERE fileName=:fileName AND fileSize=:fileSize AND fileDate=:fileDate;");
	query.bindValue(":fileName", fileName());
	query.bindValue(":fileSize", fileSize());
	query.bindValue(":fileDate", fileDate());

	if(!query.exec())
	{
		myDebug << query.lastError().text();
		return(-1);
	}

	if(query.next())
		return(query.value("id").toInt());

	return(-1);
}
Exemple #21
0
bool FBO::init(int width, int height, GraphicsContext3D::Attributes attributes)
{
#if !USE(SHARED_TEXTURE_WEBGL)
    // 1. Allocate a graphic buffer
    sp<ISurfaceComposer> composer(ComposerService::getComposerService());
    m_graphicBufferAlloc = composer->createGraphicBufferAlloc();

    status_t error;

    PixelFormat format = attributes.alpha ? HAL_PIXEL_FORMAT_RGBA_8888 : HAL_PIXEL_FORMAT_RGBX_8888;

    m_grBuffer = m_graphicBufferAlloc->createGraphicBuffer(width, height, format,
                 GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_HW_TEXTURE, &error);
    if (error != NO_ERROR) {
        LOGWEBGL(" failed to allocate GraphicBuffer, error = %d", error);
        return false;
    }

    void *addr = 0;
    if (m_grBuffer->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, &addr) != NO_ERROR) {
        LOGWEBGL("  failed to lock the GraphicBuffer");
        return false;
    }
    // WebGL requires all buffers to be initialized to 0.
    memset(addr, 0, width * height * 4);
    m_grBuffer->unlock();

    ANativeWindowBuffer* clientBuf = m_grBuffer->getNativeBuffer();
    if (clientBuf->handle == 0) {
        LOGWEBGL(" empty handle in GraphicBuffer");
        return false;
    }

    // 2. Create an EGLImage from the graphic buffer
    const EGLint attrs[] = {
        EGL_IMAGE_PRESERVED_KHR, EGL_TRUE,
        EGL_NONE,                EGL_NONE
    };

    m_image = eglCreateImageKHR(m_dpy,
                                EGL_NO_CONTEXT,
                                EGL_NATIVE_BUFFER_ANDROID,
                                (EGLClientBuffer)clientBuf,
                                attrs);
    if (GraphicsContext3DInternal::checkEGLError("eglCreateImageKHR") != EGL_SUCCESS) {
        LOGWEBGL("eglCreateImageKHR() failed");
        return false;
    }
#endif
    // 3. Create a texture from the EGLImage
    m_texture = createTexture(m_image, width, height);

    if (m_texture == 0) {
        LOGWEBGL("createTexture() failed");
        return false;
    }

    // 4. Create the Framebuffer Object from the texture
    glGenFramebuffers(1, &m_fbo);

    if (attributes.depth) {
        glGenRenderbuffers(1, &m_depthBuffer);
        glBindRenderbuffer(GL_RENDERBUFFER, m_depthBuffer);
        glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, width, height);
        if (GraphicsContext3DInternal::checkGLError("glRenderbufferStorage") != GL_NO_ERROR)
            return false;
    }

    if (attributes.stencil) {
        glGenRenderbuffers(1, &m_stencilBuffer);
        glBindRenderbuffer(GL_RENDERBUFFER, m_stencilBuffer);
        glRenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8, width, height);
        if (GraphicsContext3DInternal::checkGLError("glRenderbufferStorage") != GL_NO_ERROR)
            return false;
    }

    glBindRenderbuffer(GL_RENDERBUFFER, 0);

    glBindFramebuffer(GL_FRAMEBUFFER, m_fbo);
    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_texture, 0);
    if (GraphicsContext3DInternal::checkGLError("glFramebufferTexture2D") != GL_NO_ERROR)
        return false;

    if (attributes.depth) {
        glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthBuffer);
        if (GraphicsContext3DInternal::checkGLError("glFramebufferRenderbuffer") != GL_NO_ERROR)
            return false;
    }

    if (attributes.stencil) {
        glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, m_stencilBuffer);
        if (GraphicsContext3DInternal::checkGLError("glFramebufferRenderbuffer") != GL_NO_ERROR)
            return false;
    }

    GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
    if (status != GL_FRAMEBUFFER_COMPLETE) {
        LOGWEBGL("Framebuffer incomplete: %d", status);
        return false;
    }

    glBindFramebuffer(GL_FRAMEBUFFER, 0);

    return true;
}
bool WriteMail::prepareComposer(QMailMessage::MessageType type, const QMailAccountId &accountId)
{
    bool success = false;

    // Don't discard mail being composed without user confirmation
    if (changed()) {
        if (QMessageBox::question(qApp->activeWindow(),
                                  tr("Compose new message"),
                                  tr("A message is currently being composed. Do you wish to save the message in drafts?"),
                                  QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
            draft();
        } else {
            return false;
        }
    }
    
    reset();

    if (type == QMailMessage::AnyType) {
        bool displaySelector(true);

        // If we have no options, prompt to set up an account
        if (m_selectComposerWidget->availableTypes().isEmpty()) {
            displaySelector = false;

            if (QMessageBox::question(qApp->activeWindow(),
                                      tr("No accounts configured"),
                                      tr("No accounts are configured to send messages with. Do you wish to configure one now?"),
                                      QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
                emit editAccounts();
            }
        }

        // If there's just one composer option, select it immediately
        QString key = m_selectComposerWidget->singularKey();
        if (!key.isEmpty()) {
            displaySelector = false;
            success = composerSelected(qMakePair(key, QMailComposerFactory::messageTypes(key).first()));
        }

        if (displaySelector) {
            m_selectComposerWidget->setSelected(composer(), QMailMessage::AnyType);
            setWindowTitle( tr("Select type") );
            m_widgetStack->setCurrentWidget(m_selectComposerWidget);
            success = true;
        }
    } else {
        QString key = QMailComposerFactory::defaultKey(type);
        if (!key.isEmpty()) {
            success = composerSelected(qMakePair(key, type));
        } else {
            qWarning() << "Cannot edit message of type:" << type;
        }
    }

    updateAccountSelection(type, accountId);
    if(m_composerInterface)
        m_composerInterface->setSendingAccountId(accountId);

    return success;
}
Exemple #23
0
void init_logging()
{
    //[ example_sinks_event_log_create_backend
    // Create an event log sink
    boost::shared_ptr< sinks::event_log_backend > backend(
        new sinks::event_log_backend((
            keywords::message_file = "%SystemDir%\\event_log_messages.dll",
            keywords::log_name = "My Application",
            keywords::log_source = "My Source"
        ))
    );
    //]

    //[ example_sinks_event_log_event_composer
    // Create an event composer. It is initialized with the event identifier mapping.
    sinks::event_log::event_composer composer(
        sinks::event_log::direct_event_id_mapping< int >("EventID"));

    // For each event described in the message file, set up the insertion string formatters
    composer[LOW_DISK_SPACE_MSG]
        // the first placeholder in the message
        // will be replaced with contents of the "Drive" attribute
        % fmt::attr< std::string >("Drive")
        // the second placeholder in the message
        // will be replaced with contents of the "Size" attribute
        % fmt::attr< boost::uintmax_t >("Size");

    composer[DEVICE_INACCESSIBLE_MSG]
        % fmt::attr< std::string >("Drive");

    composer[SUCCEEDED_MSG]
        % fmt::attr< unsigned int >("Duration");

    // Then put the composer to the backend
    backend->set_event_composer(composer);
    //]

    //[ example_sinks_event_log_mappings
    // We'll have to map our custom levels to the event log event types
    sinks::event_log::custom_event_type_mapping< severity_level > type_mapping("Severity");
    type_mapping[normal] = sinks::event_log::make_event_type(MY_SEVERITY_INFO);
    type_mapping[warning] = sinks::event_log::make_event_type(MY_SEVERITY_WARNING);
    type_mapping[error] = sinks::event_log::make_event_type(MY_SEVERITY_ERROR);

    backend->set_event_type_mapper(type_mapping);

    // Same for event categories.
    // Usually event categories can be restored by the event identifier.
    sinks::event_log::custom_event_category_mapping< int > cat_mapping("EventID");
    cat_mapping[LOW_DISK_SPACE_MSG] = sinks::event_log::make_event_category(MY_CATEGORY_1);
    cat_mapping[DEVICE_INACCESSIBLE_MSG] = sinks::event_log::make_event_category(MY_CATEGORY_2);
    cat_mapping[SUCCEEDED_MSG] = sinks::event_log::make_event_category(MY_CATEGORY_3);

    backend->set_event_category_mapper(cat_mapping);
    //]

    //[ example_sinks_event_log_register_sink
    // Create the frontend for the sink
    boost::shared_ptr< sinks::synchronous_sink< sinks::event_log_backend > > sink(
        new sinks::synchronous_sink< sinks::event_log_backend >(backend));

    // Set up filter to pass only records that have the necessary attribute
    sink->set_filter(flt::has_attr< int >("EventID"));

    logging::core::get()->add_sink(sink);
    //]
}
ErrorStack execute(
  Engine* engine,
  storage::StorageId id,
  double* elapsed_ms,
  std::vector<std::string>* papi_results) {
  storage::Composer composer(engine, id);
  cache::SnapshotFileSet dummy_files(engine);
  CHECK_ERROR(dummy_files.initialize());

  LOG(INFO) << "Allocating memories...";
  debugging::StopWatch alloc_watch;
  memory::AlignedMemory::AllocType kAlloc = memory::AlignedMemory::kNumaAllocOnnode;
  memory::AlignedMemory work_memory(1ULL << 23, 1U << 21, kAlloc, 0);
  memory::AlignedMemory root_page_memory(1ULL << 12, 1U << 12, kAlloc, 0);
  uint64_t full_size = kRecords * kPayloadSize * 2ULL;
  memory::AlignedMemory page_memory(full_size, 1U << 21, kAlloc, 0);
  memory::AlignedMemory intermediate_memory(1ULL << 24, 1U << 21, kAlloc, 0);
  memory::AlignedMemory log_memory(full_size, 1U << 21, kAlloc, 0);
  alloc_watch.stop();
  LOG(INFO) << "Allocated memories in " << alloc_watch.elapsed_ms() << "ms";

  LOG(INFO) << "Populating logs to process...";
  debugging::StopWatch log_watch;
  char* log_buffer = reinterpret_cast<char*>(log_memory.get_block());
  uint64_t log_size = 0;
  populate_logs(id, log_buffer, &log_size);
  InMemorySortedBuffer buffer(log_buffer, log_size);
  uint16_t key_len = sizeof(storage::array::ArrayOffset);
  buffer.set_current_block(id, kRecords, 0, log_size, key_len, key_len);
  log_watch.stop();
  LOG(INFO) << "Populated logs to process in " << log_watch.elapsed_ms() << "ms";

  // we need at least a dummy partitioning information because array composer uses it.
  storage::PartitionerMetadata* metadata = storage::PartitionerMetadata::get_metadata(engine, id);
  make_dummy_partitions(engine, id, metadata);

  SnapshotWriter writer(engine, 0, kSnapshotId, &page_memory, &intermediate_memory);
  CHECK_ERROR(writer.open());

  storage::Page* root_page = reinterpret_cast<storage::Page*>(root_page_memory.get_block());
  snapshot::SortedBuffer* log_array[1];
  log_array[0] = &buffer;
  storage::Composer::ComposeArguments args = {
    &writer,
    &dummy_files,
    log_array,
    1,
    &work_memory,
    Epoch(1),
    root_page
  };

  if (FLAGS_profile) {
    COERCE_ERROR(engine->get_debug()->start_profile("compose_experiment.prof"));
    engine->get_debug()->start_papi_counters();
  }

  LOG(INFO) << "experiment's main part has started";
  debugging::StopWatch watch;
  CHECK_ERROR(composer.compose(args));
  watch.stop();
  *elapsed_ms = watch.elapsed_ms();
  LOG(INFO) << "experiment's main part has ended. Took " << *elapsed_ms << "ms";

  if (FLAGS_profile) {
    engine->get_debug()->stop_profile();
    engine->get_debug()->stop_papi_counters();
    if (FLAGS_papi) {
      *papi_results = debugging::DebuggingSupports::describe_papi_counters(
        engine->get_debug()->get_papi_counters());
    }
  }

  writer.close();
  CHECK_ERROR(dummy_files.uninitialize());
  return kRetOk;
}
Exemple #25
0
int Surface::query(int what, int* value) const {
    ATRACE_CALL();
    ALOGV("Surface::query");
    {   // scope for the lock
        Mutex::Autolock lock(mMutex);
        switch (what) {
        case NATIVE_WINDOW_FORMAT:
            if (mReqFormat) {
                *value = mReqFormat;
                return NO_ERROR;
            }
            break;
        case NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER: {
#ifdef SURFACE_SKIP_FIRST_DEQUEUE
            if (!mDequeuedOnce) {
                *value = 0;
            } else
#endif
            {
                sp<ISurfaceComposer> composer(
                    ComposerService::getComposerService());
                if (composer->authenticateSurfaceTexture(mGraphicBufferProducer)) {
                    *value = 1;
                } else {
                    *value = 0;
                }
            }
            return NO_ERROR;
        }
        case NATIVE_WINDOW_CONCRETE_TYPE:
            *value = NATIVE_WINDOW_SURFACE;
            return NO_ERROR;
        case NATIVE_WINDOW_DEFAULT_WIDTH:
            *value = mUserWidth ? mUserWidth : mDefaultWidth;
            return NO_ERROR;
        case NATIVE_WINDOW_DEFAULT_HEIGHT:
            *value = mUserHeight ? mUserHeight : mDefaultHeight;
            return NO_ERROR;
        case NATIVE_WINDOW_TRANSFORM_HINT:
            *value = mTransformHint;
            return NO_ERROR;
        case NATIVE_WINDOW_CONSUMER_RUNNING_BEHIND: {
            status_t err = NO_ERROR;
            if (!mConsumerRunningBehind) {
                *value = 0;
            } else {
                err = mGraphicBufferProducer->query(what, value);
                if (err == NO_ERROR) {
                    mConsumerRunningBehind = *value;
                }
            }
            return err;
        }
#ifdef USE_K3V2OEM1

#else
        case NATIVE_WINDOW_CONSUMER_USAGE_BITS: {
            status_t err = NO_ERROR;
            err = mGraphicBufferProducer->query(what, value);
            if(err == NO_ERROR) {
                *value |= mReqUsage;
                return NO_ERROR;
            } else {
                return err;
            }
        }
#endif
        }
    }
    return mGraphicBufferProducer->query(what, value);
}
Exemple #26
0
QString RDLogLine::xml(int line) const
{
  QString ret;
#ifndef WIN32
  ret+="  <logLine>\n";
  ret+="    "+RDXmlField("line",line);
  ret+="    "+RDXmlField("id",id());
  ret+="    "+RDXmlField("type",RDLogLine::typeText(type()));
  ret+="    "+RDXmlField("cartType",RDCart::typeText(cartType()));
  ret+="    "+RDXmlField("cartNumber",cartNumber());
  ret+="    "+RDXmlField("cutNumber",cutNumber());
  ret+="    "+RDXmlField("groupName",groupName());
  ret+="    "+RDXmlField("groupColor",groupColor().name());
  ret+="    "+RDXmlField("title",title());
  ret+="    "+RDXmlField("artist",artist());
  ret+="    "+RDXmlField("publisher",publisher());
  ret+="    "+RDXmlField("composer",composer());
  ret+="    "+RDXmlField("album",album());
  ret+="    "+RDXmlField("label",label());
  if(year().isValid()) {
    ret+="    "+RDXmlField("year",year().year());
  }
  else {
    ret+="    "+RDXmlField("year");
  }
  ret+="    "+RDXmlField("client",client());
  ret+="    "+RDXmlField("agency",agency());
  ret+="    "+RDXmlField("userDefined",userDefined());
  ret+="    "+RDXmlField("usageCode",usageCode());
  ret+="    "+RDXmlField("enforceLength",enforceLength());
  ret+="    "+RDXmlField("forcedLength",RDGetTimeLength(forcedLength(),true));
  ret+="    "+RDXmlField("evergreen",evergreen());
  ret+="    "+RDXmlField("source",RDLogLine::sourceText(source()));
  ret+="    "+RDXmlField("timeType",RDLogLine::timeTypeText(timeType()));
  if(startTime(RDLogLine::Logged).isValid()&&
     (!startTime(RDLogLine::Logged).isNull())) {
    ret+="    "+RDXmlField("startTime",startTime(RDLogLine::Logged).
			   toString("hh:mm:ss.zzz"));
  }
  else {
    ret+="    "+RDXmlField("startTime");
  }
  ret+="    "+RDXmlField("transitionType",RDLogLine::transText(transType()));
  ret+="    "+RDXmlField("cutQuantity",cutQuantity());
  ret+="    "+RDXmlField("lastCutPlayed",lastCutPlayed());
  ret+="    "+RDXmlField("markerComment",markerComment());
  ret+="    "+RDXmlField("markerLabel",markerLabel());

  ret+="    "+RDXmlField("originUser",originUser());
  ret+="    "+RDXmlField("originDateTime",originDateTime());
  ret+="    "+RDXmlField("startPoint",startPoint(RDLogLine::CartPointer),
			 "src=\"cart\"");
  ret+="    "+RDXmlField("startPoint",startPoint(RDLogLine::LogPointer),
			 "src=\"log\"");
  ret+="    "+RDXmlField("endPoint",endPoint(RDLogLine::CartPointer),
			 "src=\"cart\"");
  ret+="    "+RDXmlField("endPoint",endPoint(RDLogLine::LogPointer),
			 "src=\"log\"");
  ret+="    "+RDXmlField("segueStartPoint",
			 segueStartPoint(RDLogLine::CartPointer),
			 "src=\"cart\"");
  ret+="    "+RDXmlField("segueStartPoint",
			 segueStartPoint(RDLogLine::LogPointer),"src=\"log\"");
  ret+="    "+RDXmlField("segueEndPoint",
			 segueEndPoint(RDLogLine::CartPointer),
			 "src=\"cart\"");
  ret+="    "+RDXmlField("segueEndPoint",
			 segueEndPoint(RDLogLine::LogPointer),"src=\"log\"");
  ret+="    "+RDXmlField("segueGain",segueGain());
  ret+="    "+RDXmlField("fadeupPoint",
			 fadeupPoint(RDLogLine::CartPointer),"src=\"cart\"");
  ret+="    "+RDXmlField("fadeupPoint",
			 fadeupPoint(RDLogLine::LogPointer),"src=\"log\"");
  ret+="    "+RDXmlField("fadeupGain",fadeupGain());
  ret+="    "+RDXmlField("fadedownPoint",
			 fadedownPoint(RDLogLine::CartPointer),"src=\"cart\"");
  ret+="    "+RDXmlField("fadedownPoint",
			 fadedownPoint(RDLogLine::LogPointer),"src=\"log\"");
  ret+="    "+RDXmlField("duckUpGain",duckUpGain());
  ret+="    "+RDXmlField("duckDownGain",duckDownGain());
  ret+="    "+RDXmlField("talkStartPoint",talkStartPoint());
  ret+="    "+RDXmlField("talkEndPoint",talkEndPoint());
  ret+="    "+RDXmlField("hookMode",hookMode());
  ret+="    "+RDXmlField("hookStartPoint",hookStartPoint());
  ret+="    "+RDXmlField("hookEndPoint",hookEndPoint());

  ret+="  </logLine>\n";
#endif  // WIN32
  return ret;
}