mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-27 04:35:34 +08:00
Use SDL2 to display BGRA frame
This commit is contained in:
@@ -127,24 +127,24 @@ int ScreenCaptureWgc::Stop() {
|
||||
|
||||
void ScreenCaptureWgc::OnFrame(const WgcSession::wgc_session_frame &frame) {
|
||||
std::cout << "onframe" << std::endl;
|
||||
AVFrame *av_frame = av_frame_alloc();
|
||||
// AVFrame *av_frame = av_frame_alloc();
|
||||
|
||||
av_frame->pts = av_gettime_relative();
|
||||
av_frame->pkt_dts = av_frame->pts;
|
||||
// av_frame->pkt_pts = av_frame->pts;
|
||||
// av_frame->pts = av_gettime_relative();
|
||||
// av_frame->pkt_dts = av_frame->pts;
|
||||
// // av_frame->pkt_pts = av_frame->pts;
|
||||
|
||||
av_frame->width = frame.width;
|
||||
av_frame->height = frame.height;
|
||||
av_frame->format = AV_PIX_FMT_BGRA;
|
||||
av_frame->pict_type = AV_PICTURE_TYPE_NONE;
|
||||
av_frame->pkt_size = frame.width * frame.height * 4;
|
||||
// av_frame->width = frame.width;
|
||||
// av_frame->height = frame.height;
|
||||
// av_frame->format = AV_PIX_FMT_BGRA;
|
||||
// av_frame->pict_type = AV_PICTURE_TYPE_NONE;
|
||||
// av_frame->pkt_size = frame.width * frame.height * 4;
|
||||
|
||||
av_image_fill_arrays(av_frame->data, av_frame->linesize, frame.data,
|
||||
AV_PIX_FMT_BGRA, frame.width, frame.height, 1);
|
||||
// av_image_fill_arrays(av_frame->data, av_frame->linesize, frame.data,
|
||||
// AV_PIX_FMT_BGRA, frame.width, frame.height, 1);
|
||||
|
||||
if (_on_data)
|
||||
_on_data((unsigned char *)av_frame->data, av_frame->pkt_size, frame.width,
|
||||
frame.height);
|
||||
_on_data((unsigned char *)frame.data, frame.width * frame.height * 4,
|
||||
frame.width, frame.height);
|
||||
|
||||
// av_frame_free(&av_frame);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user