예제 #1
0
파일: Frame.cpp 프로젝트: rawbenny/QtAV
QByteArray Frame::data(int plane) const
{
    if (plane < 0 || plane >= planeCount()) {
        qWarning("Invalid plane! Valid range is [0, %d)", planeCount());
        return QByteArray();
    }
    return QByteArray((char*)d_func()->planes[plane], bytesPerLine(plane));
}
예제 #2
0
파일: Frame.cpp 프로젝트: rawbenny/QtAV
const uchar* Frame::bits(int plane) const
{
    if (plane < 0 || plane >= planeCount()) {
        qWarning("Invalid plane! Valid range is [0, %d)", planeCount());
        return 0;
    }
    return d_func()->planes[plane];
}
예제 #3
0
파일: Frame.cpp 프로젝트: rawbenny/QtAV
int Frame::bytesPerLine(int plane) const
{
    if (plane < 0 || plane >= planeCount()) {
        qWarning("Invalid plane! Valid range is [0, %d)", planeCount());
        return 0;
    }
    return d_func()->line_sizes[plane];
}
예제 #4
0
void* VideoFrame::createInteropHandle(void* handle, SurfaceType type, int plane)
{
    Q_D(VideoFrame);
    const QVariant v = d->metadata.value(QStringLiteral("surface_interop"));
    if (!v.isValid())
        return 0;
    d->surface_interop = v.value<VideoSurfaceInteropPtr>();
    if (!d->surface_interop)
        return 0;
    if (plane > planeCount())
        return 0;
    return d->surface_interop->createHandle(handle, type, format(), plane, planeWidth(plane), planeHeight(plane));
}
예제 #5
0
void *VideoFrame::map(SurfaceType type, void *handle, int plane)
{
    Q_D(VideoFrame);
    const QVariant v = d->metadata.value(QStringLiteral("surface_interop"));
    if (!v.isValid())
        return 0;
    d->surface_interop = v.value<VideoSurfaceInteropPtr>();
    if (!d->surface_interop)
        return 0;
    if (plane > planeCount())
        return 0;
    return d->surface_interop->map(type, format(), handle, plane);
}
예제 #6
0
파일: AudioFrame.cpp 프로젝트: nbuxrr/QtAV
AudioFrame AudioFrame::clone() const
{
    Q_D(const AudioFrame);
    if (d->format.sampleFormatFFmpeg() == AV_SAMPLE_FMT_NONE
            || d->format.channels() <= 0)
        return AudioFrame();
    if (d->samples_per_ch <= 0 || bytesPerLine(0) <= 0)
        return AudioFrame(format());
    QByteArray buf(bytesPerLine()*planeCount(), 0);
    AudioFrame f(buf, d->format);
    f.setSamplesPerChannel(samplesPerChannel());
    char *dst = buf.data(); //must before buf is shared, otherwise data will be detached.
    for (int i = 0; i < f.planeCount(); ++i) {
        const int plane_size = f.bytesPerLine(i);
        memcpy(dst, f.constBits(i), plane_size);
        dst += plane_size;
    }
    f.setTimestamp(timestamp());
    // meta data?
    return f;
}
예제 #7
0
파일: Frame.cpp 프로젝트: rawbenny/QtAV
void Frame::setBits(quint8 *slice[])
{
    for (int i = 0; i < planeCount(); ++i ) {
        setBits(slice[i], i);
    }
}
예제 #8
0
파일: Frame.cpp 프로젝트: rawbenny/QtAV
void Frame::setBytesPerLine(int stride[])
{
    for (int i = 0; i < planeCount(); ++i ) {
        setBytesPerLine(stride[i], i);
    }
}