Switch Controller
Loading...
Searching...
No Matches
FFmpegDecoder.h
Go to the documentation of this file.
1#pragma once
2
3#include "FFmpegFrameSink.h"
4
5#include "pch.h"
6
7extern "C" {
8#include <libavformat/avformat.h>
9}
10
12private:
13 AVFormatContext *formatContext;
14 struct CodecContextDeleter {
15 void operator()(AVCodecContext *s) { avcodec_free_context(&s); }
16 };
17 std::unique_ptr<AVCodecContext, CodecContextDeleter> decoderContext;
18 FFmpegFrameSink *sink;
19 int streamIndex;
20
21public:
22 FFmpegDecoder(AVFormatContext *formatContext,
23 std::unique_ptr<FFmpegFrameSink> &sink);
24
25 void decodePacket(const AVPacket *packet, AVFrame *frame);
26 int getStreamIndex() const { return streamIndex; }
27
28private:
29 void openCodecContext();
30};
Definition: FFmpegDecoder.h:11
int getStreamIndex() const
Definition: FFmpegDecoder.h:26
void decodePacket(const AVPacket *packet, AVFrame *frame)
Definition: FFmpegDecoder.cpp:69
Definition: FFmpegFrameSink.h:23