代码拉取完成,页面将自动刷新
#pragma once
#include "libde265/de265.h"
#include "libde265/image.h"
class Libde265 : public VideoDecoder
{
public:
de265_PTS pts;
de265_decoder_context *h265DecContext;
Libde265()
{
h265DecContext = de265_new_decoder();
emscripten_log(0, "H265 init");
}
~Libde265()
{
de265_free_decoder(h265DecContext);
}
void _decode(IOBuffer data) override
{
de265_push_NAL(h265DecContext, (const unsigned char *)data, data.length, 0, nullptr);
int more = 1;
while (more)
{
more = 0;
auto err = de265_decode(h265DecContext, &more);
if (err != DE265_OK)
{
if (err != DE265_ERROR_WAITING_FOR_INPUT_DATA)
emscripten_log(0, "de265_decode:%d", err);
break;
}
const de265_image *img = de265_get_next_picture(h265DecContext);
if (img)
{
//emscripten_log(0, "%d", img);
int out_stride;
for (int i = 0; i < 3; i++)
p_yuv[i] = (u32)de265_get_image_plane(img, i, &out_stride);
if (videoWidth == 0)
decodeVideoSize(de265_get_image_width(img, 0), de265_get_image_height(img, 0));
decodeYUV420();
}
}
}
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。