Ejemplo n.º 1
0
bool VaApiMixer::upload(const VideoFrame &frame, bool deint) {
	if (!m_glSurface)
		return false;
	static const int specs[MP_CSP_COUNT] = {
		0,					//MP_CSP_AUTO,
		VA_SRC_BT601,		//MP_CSP_BT_601,
		VA_SRC_BT709,		//MP_CSP_BT_709,
		VA_SRC_SMPTE_240,	//MP_CSP_SMPTE_240M,
		0,					//MP_CSP_RGB,
		0,					//MP_CSP_XYZ,
		0,					//MP_CSP_YCGCO,
	};
	static const int field[] = {
		// Picture = 0,   Top = 1,      Bottom = 2
		VA_FRAME_PICTURE, VA_TOP_FIELD, VA_BOTTOM_FIELD, VA_FRAME_PICTURE
	};
	const auto id = (VASurfaceID)(quintptr)frame.data(3);
	int flags = specs[frame.format().colorspace()];
	if (deint)
		flags |= field[frame.field() & VideoFrame::Interlaced];
	if (!check(vaCopySurfaceGLX(VaApi::glx(), m_glSurface, id,  flags), "Cannot copy OpenGL surface."))
		return false;
	if (!check(vaSyncSurface(VaApi::glx(), id), "Cannot sync video surface."))
		return false;
	return true;
}
Ejemplo n.º 2
0
bool VaApiPostProcessor::process(const VideoFrame &in, QLinkedList<VideoFrame> &queue) {
	if (!d->pipeline)
		return false;
	auto surface = VaApiSurfacePool::getSurface(in.mpi());
	if (!surface)
		return false;
	mp_image *out1 = nullptr, *out2 = nullptr;
	out1 = d->pipeline->render(in, d->setupDeint(in.mpi()->fields, true));
	if (d->deint.doubler && d->deint.method != DeintMethod::None)
		out2 = d->pipeline->render(in, d->setupDeint(in.mpi()->fields, false));
	if (out1)
		queue.push_back(VideoFrame(true, out1, nextPTS(), in.field() & ~VideoFrame::Interlaced));
	if (out2)
		queue.push_back(VideoFrame(true, out2, nextPTS(), in.field() & ~VideoFrame::Interlaced));
	return out1 || out2;
}
Ejemplo n.º 3
0
	void push(mp_image *mpi) {
		mpi->colorspace = in->format().colorspace();
		mpi->levels = in->format().range();
		mpi->display_w = in->format().displaySize().width();
		mpi->display_h = in->format().displaySize().height();
		mpi->pts = p->nextPTS();
		queue->push_back(VideoFrame(true, mpi, in->field()));
		++pushed;
	}
Ejemplo n.º 4
0
	void push(int field) {
		queue->push_back(VideoFrame(false, in->mpi(), p->nextPTS(), field | (in->field() & ~VideoFrame::Interlaced)));
		++pushed;
	}
Ejemplo n.º 5
0
	void copyInterlaced(const VideoFrame &frame) { d->field = (d->field & ~Interlaced) | (frame.field() & Interlaced); }