summaryrefslogtreecommitdiff
path: root/src/codec/ffmpeg/common.c
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2026-07-10 15:17:41 -0400
committerAndrew Opalach <andrew@akon.city> 2026-07-10 15:17:41 -0400
commitda9bddc70ff8544f3294b880d719c4605e87ad97 (patch)
tree578f1554d992840aad4618ad0ce657868fcadc16 /src/codec/ffmpeg/common.c
parent566c022572bbff8bb7ff105b9adbe74500b2c716 (diff)
downloadcamu-da9bddc70ff8544f3294b880d719c4605e87ad97.tar.gz
camu-da9bddc70ff8544f3294b880d719c4605e87ad97.tar.bz2
camu-da9bddc70ff8544f3294b880d719c4605e87ad97.zip
Handle rotation from codecHEADmaster
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'src/codec/ffmpeg/common.c')
-rw-r--r--src/codec/ffmpeg/common.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/codec/ffmpeg/common.c b/src/codec/ffmpeg/common.c
index 59f59b7..5e10bcb 100644
--- a/src/codec/ffmpeg/common.c
+++ b/src/codec/ffmpeg/common.c
@@ -7,7 +7,7 @@
#include "common.h"
-s64 camu_ff_frame_duration(AVFrame *frame)
+s64 camu_ff_get_frame_duration(AVFrame *frame)
{
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 30, 100)
return frame->duration;
@@ -16,6 +16,25 @@ s64 camu_ff_frame_duration(AVFrame *frame)
#endif
}
+// https://code.videolan.org/videolan/libplacebo/-/blob/a7a18af88ff0a17c04840dcb3246047bb6b46df3/src/include/libplacebo/utils/libav_internal.h#L854
+const u8 *camu_ff_get_stream_side_data(const AVStream *stream, enum AVPacketSideDataType type)
+{
+#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(60, 15, 100)
+ AVCodecParameters *codecpar = stream->codecpar;
+ const AVPacketSideData *side_data = av_packet_side_data_get(codecpar->coded_side_data,
+ codecpar->nb_coded_side_data, type);
+ return side_data ? side_data->data : NULL;
+#else
+ return av_stream_get_side_data(stream, type, NULL);
+#endif
+}
+
+const u8 *camu_ff_get_frame_side_data(AVFrame *frame, enum AVFrameSideDataType type)
+{
+ AVFrameSideData *side_data = av_frame_get_side_data(frame, type);
+ return side_data ? side_data->data : NULL;
+}
+
static __thread struct {
char buf[AL_LOG_MESSAGE_SIZE];
size_t pos;