From 1884fea349fc4a551f1a0b37abe5b3cd71ab697d Mon Sep 17 00:00:00 2001 From: jp9000 Date: Thu, 18 Dec 2014 12:41:53 -0800 Subject: [PATCH] win-dshow: Use obs_avc_keyframe instead of own --- plugins/win-dshow/ffmpeg-decode.c | 31 ++----------------------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/plugins/win-dshow/ffmpeg-decode.c b/plugins/win-dshow/ffmpeg-decode.c index cf2bddcb8..395494bf3 100644 --- a/plugins/win-dshow/ffmpeg-decode.c +++ b/plugins/win-dshow/ffmpeg-decode.c @@ -154,34 +154,6 @@ int ffmpeg_decode_audio(struct ffmpeg_decode *decode, return len; } -#define NAL_SLICE 1 -#define NAL_SLICE_IDR 5 - -static bool avc_keyframe(const uint8_t *data, size_t size) -{ - const uint8_t *nal_start, *nal_end; - const uint8_t *end = data + size; - int type; - - nal_start = obs_avc_find_startcode(data, end); - while (true) { - while (nal_start < end && !*(nal_start++)); - - if (nal_start == end) - break; - - type = nal_start[0] & 0x1F; - - if (type == NAL_SLICE_IDR || type == NAL_SLICE) - return (type == NAL_SLICE_IDR); - - nal_end = obs_avc_find_startcode(nal_start, end); - nal_start = nal_end; - } - - return false; -} - int ffmpeg_decode_video(struct ffmpeg_decode *decode, uint8_t *data, size_t size, long long *ts, struct obs_source_frame *frame, @@ -201,7 +173,8 @@ int ffmpeg_decode_video(struct ffmpeg_decode *decode, packet.size = (int)size; packet.pts = *ts; - if (decode->codec->id == AV_CODEC_ID_H264 && avc_keyframe(data, size)) + if (decode->codec->id == AV_CODEC_ID_H264 && + obs_avc_keyframe(data, size)) packet.flags |= AV_PKT_FLAG_KEY; if (!decode->frame) { -- GitLab