mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-24 23:31:36 +08:00
win-dshow: Support HEVC decode
This commit is contained in:
@@ -18,6 +18,9 @@
|
||||
#include "ffmpeg-decode.h"
|
||||
#include "obs-ffmpeg-compat.h"
|
||||
#include <obs-avc.h>
|
||||
#ifdef ENABLE_HEVC
|
||||
#include <obs-hevc.h>
|
||||
#endif
|
||||
|
||||
#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(58, 4, 100)
|
||||
#define USE_NEW_HARDWARE_CODEC_METHOD
|
||||
@@ -333,9 +336,17 @@ bool ffmpeg_decode_video(struct ffmpeg_decode *decode, uint8_t *data,
|
||||
packet->size = (int)size;
|
||||
packet->pts = *ts;
|
||||
|
||||
if (decode->codec->id == AV_CODEC_ID_H264 &&
|
||||
obs_avc_keyframe(data, size))
|
||||
packet->flags |= AV_PKT_FLAG_KEY;
|
||||
switch (decode->codec->id) {
|
||||
case AV_CODEC_ID_H264:
|
||||
if (obs_avc_keyframe(data, size))
|
||||
packet->flags |= AV_PKT_FLAG_KEY;
|
||||
#ifdef ENABLE_HEVC
|
||||
break;
|
||||
case AV_CODEC_ID_HEVC:
|
||||
if (obs_hevc_keyframe(data, size))
|
||||
packet->flags |= AV_PKT_FLAG_KEY;
|
||||
#endif
|
||||
}
|
||||
|
||||
ret = avcodec_send_packet(decode->decoder, packet);
|
||||
if (ret == 0) {
|
||||
|
||||
Submodule plugins/win-dshow/libdshowcapture updated: 456a0575c3...ed02c3541e
@@ -542,6 +542,13 @@ void DShowInput::OnVideoData(const VideoConfig &config, unsigned char *data,
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_HEVC
|
||||
if (videoConfig.format == VideoFormat::HEVC) {
|
||||
OnEncodedVideoData(AV_CODEC_ID_HEVC, data, size, startTime);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (videoConfig.format == VideoFormat::MJPEG) {
|
||||
OnEncodedVideoData(AV_CODEC_ID_MJPEG, data, size, startTime);
|
||||
return;
|
||||
@@ -1404,6 +1411,9 @@ static const VideoFormatName videoFormatNames[] = {
|
||||
/* encoded formats */
|
||||
{VideoFormat::MJPEG, "MJPEG"},
|
||||
{VideoFormat::H264, "H264"},
|
||||
#ifdef ENABLE_HEVC
|
||||
{VideoFormat::HEVC, "HEVC"},
|
||||
#endif
|
||||
};
|
||||
|
||||
static bool ResTypeChanged(obs_properties_t *props, obs_property_t *p,
|
||||
|
||||
Reference in New Issue
Block a user