Exemplo n.º 1
0
VideoFrame::VideoFrame(const QImage& image)
    : Frame(*new VideoFramePrivate(image.width(), image.height(), VideoFormat(image.format())))
{
    // TODO: call const image.bits()?
    setBits((uchar*)image.bits(), 0);
    setBytesPerLine(image.bytesPerLine(), 0);
}
Exemplo n.º 2
0
void setviewtotile(short tilenume, int32_t tileWidth, int32_t tileHeight)
{
    int32_t i, j;
    
    /* DRAWROOMS TO TILE BACKUP&SET CODE */
    tiles[tilenume].dim.width = tileWidth;
    tiles[tilenume].dim.height = tileHeight;
    bakxsiz[setviewcnt] = tileWidth;
    bakysiz[setviewcnt] = tileHeight;
    bakvidoption[setviewcnt] = vidoption;
    vidoption = 2;
    bakframeplace[setviewcnt] = frameplace;
    frameplace = tiles[tilenume].data;
    bakwindowx1[setviewcnt] = windowx1;
    bakwindowy1[setviewcnt] = windowy1;
    bakwindowx2[setviewcnt] = windowx2;
    bakwindowy2[setviewcnt] = windowy2;
    copybufbyte(&startumost[windowx1],&bakumost[windowx1],(windowx2-windowx1+1)*sizeof(bakumost[0]));
    copybufbyte(&startdmost[windowx1],&bakdmost[windowx1],(windowx2-windowx1+1)*sizeof(bakdmost[0]));
    setview(0,0,tileHeight-1,tileWidth-1);
    setaspect(65536,65536);
    j = 0;
    for(i=0; i<=tileWidth; i++) {
        ylookup[i] = j;
        j += tileWidth;
    }
    setBytesPerLine(tileHeight);
    setviewcnt++;
}
Exemplo n.º 3
0
VideoFrame::VideoFrame(const QImage& image)
    : Frame(new VideoFramePrivate(image.width(), image.height(), VideoFormat(image.format())))
{
    setBits((uchar*)image.constBits(), 0);
    setBytesPerLine(image.bytesPerLine(), 0);
    d_func()->qt_image.reset(new QImage(image));
}
Exemplo n.º 4
0
void VideoFrame::init()
{
    Q_D(VideoFrame);
    AVPicture picture;
    AVPixelFormat fff = (AVPixelFormat)d->format.pixelFormatFFmpeg();
    //int bytes = avpicture_get_size(fff, width(), height());
    //d->data.resize(bytes);
    avpicture_fill(&picture, (uint8_t*)d->data.constData(), fff, width(), height());
    setBits(picture.data);
    setBytesPerLine(picture.linesize);
}
Exemplo n.º 5
0
// TODO: alignment. use av_samples_fill_arrays
void AudioFrame::init()
{
    Q_D(AudioFrame);
    const int nb_planes = d->format.planeCount();
    d->line_sizes.resize(nb_planes);
    d->planes.resize(nb_planes);
    if (d->data.isEmpty())
        return;
    const int bpl(d->data.size()/nb_planes);
    for (int i = 0; i < nb_planes; ++i) {
        setBytesPerLine(bpl, i);
        setBits((uchar*)d->data.constData() + i*bpl, i);
    }
}
Exemplo n.º 6
0
AudioFrame::AudioFrame(const QByteArray &data, const AudioFormat &format)
    : Frame(new AudioFramePrivate(format))
{
    Q_D(AudioFrame);
    d->format = format;
    d->data = data;
    d->samples_per_ch = data.size() / d->format.channels() / d->format.bytesPerSample();
    if (!d->format.isValid())
        return;
    if (d->data.isEmpty())
        return;
    const int nb_planes(d->format.planeCount());
    const int bpl(d->data.size()/nb_planes);
    for (int i = 0; i < nb_planes; ++i) {
        setBytesPerLine(bpl, i);
        setBits((uchar*)d->data.constData() + i*bpl, i);
    }
    //init();
}
Exemplo n.º 7
0
void QHexEdit::resizeEvent(QResizeEvent *)
{
    if (_dynamicBytesPerLine)
    {
        int pxFixGaps = 0;
        if (_addressArea)
            pxFixGaps = addressWidth() * _pxCharWidth + _pxGapAdr;
        pxFixGaps += _pxGapAdrHex;
        if (_asciiArea)
            pxFixGaps += _pxGapHexAscii;

        // +1 because the last hex value do not have space. so it is effective one char more
        int charWidth = (viewport()->width() - pxFixGaps ) / _pxCharWidth + 1;

        // 2 hex alfa-digits 1 space 1 ascii per byte = 4; if ascii is disabled then 3
        // to prevent devision by zero use the min value 1
        setBytesPerLine(std::max(charWidth / (_asciiArea ? 4 : 3),1));
    }
    adjust();
}
Exemplo n.º 8
0
void AudioFrame::setSamplesPerChannel(int samples)
{
    Q_D(AudioFrame);
    if (!d->format.isValid()) {
        qWarning() << "can not set spc for an invalid format: " << d->format;
        return;
    }
    d->samples_per_ch = samples;
    const int nb_planes = d->format.planeCount();
    const int bpl(d->line_sizes[0] > 0 ? d->line_sizes[0] : d->samples_per_ch*d->format.bytesPerSample() * (d->format.isPlanar() ? 1 : d->format.channels()));
    for (int i = 0; i < nb_planes; ++i) {
        setBytesPerLine(bpl, i);
    }
    if (d->data.isEmpty())
        return;
    if (!constBits(0)) {
        setBits((quint8*)d->data.constData(), 0);
    }
    for (int i = 1; i < nb_planes; ++i) {
        if (!constBits(i)) {
            setBits((uchar*)constBits(i-1) + bpl, i);
        }
    }
}
Exemplo n.º 9
0
void Frame::setBytesPerLine(int stride[])
{
    for (int i = 0; i < planeCount(); ++i ) {
        setBytesPerLine(stride[i], i);
    }
}
Exemplo n.º 10
0
ViewConfigController::ViewConfigController( KXMLGUIClient* guiClient )
 : mByteArrayView( 0 )
{
    KActionCollection* actionCollection = guiClient->actionCollection();

    // Offset coding
    mOffsetCodingAction = actionCollection->add<KSelectAction>( QStringLiteral("view_offsetcoding") );
    mOffsetCodingAction->setText( i18nc("@title:menu","&Offset Coding") );
    QStringList list;
    list.append( i18nc("@item:inmenu offset in the hexadecimal format",
                       "&Hexadecimal") );
    list.append( i18nc("@item:inmenu offset in the decimal format",
                       "&Decimal") );
    mOffsetCodingAction->setItems( list );
    connect( mOffsetCodingAction, static_cast<void (KSelectAction::*)(int)>(&KSelectAction::triggered), this, &ViewConfigController::setOffsetCoding );

    // value valueCoding
    mCodingAction = actionCollection->add<KSelectAction>( QStringLiteral("view_valuecoding") );
    mCodingAction->setText( i18nc("@title:menu","&Value Coding") );
    list.clear();
    list.append( i18nc("@item:inmenu encoding of the bytes as values in the hexadecimal format",
                       "&Hexadecimal") );
    list.append( i18nc("@item:inmenu encoding of the bytes as values in the decimal format",
                       "&Decimal") );
    list.append( i18nc("@item:inmenu encoding of the bytes as values in the octal format",
                       "&Octal") );
    list.append( i18nc("@item:inmenu encoding of the bytes as values in the binary format",
                       "&Binary") );
    mCodingAction->setItems( list );
    connect( mCodingAction, static_cast<void (KSelectAction::*)(int)>(&KSelectAction::triggered), this, &ViewConfigController::setValueCoding );

    // char valueCoding
    mEncodingAction = actionCollection->add<KSelectAction>( QStringLiteral("view_charencoding") );
    mEncodingAction->setText( i18nc("@title:menu","&Char Coding") );
    mEncodingAction->setItems( Okteta::CharCodec::codecNames() );
    connect( mEncodingAction, static_cast<void (KSelectAction::*)(int)>(&KSelectAction::triggered), this, &ViewConfigController::setCharCoding );

    mShowsNonprintingAction = actionCollection->add<KToggleAction>( QStringLiteral("view_showsnonprinting") );
    mShowsNonprintingAction->setText( i18nc("@option:check","Show &Non-printing Chars") );
    connect( mShowsNonprintingAction, &KToggleAction::triggered, this, &ViewConfigController::setShowsNonprinting );

    // bytes per line
    mSetBytesPerLineAction = actionCollection->addAction( QStringLiteral("view_bytesperline"),
                                                          this, SLOT(setBytesPerLine()) );
    mSetBytesPerLineAction->setText( i18nc("@action:inmenu","Set Bytes per Line...") );

    // byte groups size
    mSetBytesPerGroupAction = actionCollection->addAction( QStringLiteral("view_bytespergroup"),
                                                           this, SLOT(setBytesPerGroup()) );
    mSetBytesPerGroupAction->setText( i18nc("@action:inmenu","Set Bytes per Group...") );

    // resize style
    mResizeStyleAction = actionCollection->add<KSelectAction>( QStringLiteral("resizestyle") );
    mResizeStyleAction->setText( i18nc("@title:menu","&Dynamic Layout") );
    list.clear();
    list.append( i18nc("@item:inmenu  The layout will not change on size changes.",
                       "&Off") );
    list.append( i18nc("@item:inmenu  The layout will adapt to the size, but only with complete groups of bytes.",
                       "&Wrap Only Complete Byte Groups") );
    list.append( i18nc("@item:inmenu  The layout will adapt to the size and fit in as much bytes per line as possible.",
                       "&On") );
    mResizeStyleAction->setItems( list );
    connect( mResizeStyleAction, static_cast<void (KSelectAction::*)(int)>(&KSelectAction::triggered), this, &ViewConfigController::setLayoutStyle );

    mShowOffsetColumnAction = actionCollection->add<KToggleAction>( QStringLiteral("view_lineoffset") );
    mShowOffsetColumnAction->setText( i18nc("@option:check","Show &Line Offset") );
    actionCollection->setDefaultShortcut( mShowOffsetColumnAction, Qt::Key_F11 );
    connect( mShowOffsetColumnAction, &KToggleAction::triggered, this, &ViewConfigController::toggleOffsetColumn );

    // show buffer columns
    mToggleColumnsAction = actionCollection->add<KSelectAction>( QStringLiteral("togglecolumns") );
    mToggleColumnsAction->setText( i18nc("@title:menu","&Show Values or Chars") );
    list.clear();
    list.append( i18nc("@item:inmenu","&Values") );
    list.append( i18nc("@item:inmenu","&Chars") );
    list.append( i18nc("@item:inmenu","Values && Chars") );
    mToggleColumnsAction->setItems( list );
    connect( mToggleColumnsAction, static_cast<void (KSelectAction::*)(int)>(&KSelectAction::triggered), this, &ViewConfigController::toggleValueCharColumns );

    setTargetModel( 0 );
}