win-dshow: Support HEVC decode

This commit is contained in:
jpark37
2022-04-28 08:59:53 -07:00
committed by Jim
parent a82bbb416f
commit 7e8b1d90e9
3 changed files with 25 additions and 4 deletions
+14 -3
View File
@@ -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) {
+10
View File
@@ -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,