3 #include <Media/Libav.hpp>
6 #include <libavcodec/avcodec.h>
7 #include <libavformat/avformat.h>
8 #include <libavutil/pixdesc.h>
15 explicit ACodecInfo(
const AVCodec* codec) noexcept
19 const AVCodec* codec{};
23 explicit VCodecInfo(
const AVCodec* codec) noexcept
27 const AVCodec* codec{};
31 explicit DemuxerInfo(
const AVInputFormat* format) noexcept
35 const AVInputFormat* format{};
39 explicit MuxerInfo(
const AVOutputFormat* format) noexcept
43 const AVOutputFormat* format{};
44 ossia::small_vector<const ACodecInfo*, 4> acodecs;
45 ossia::small_vector<const VCodecInfo*, 4> vcodecs;
50 std::vector<VCodecInfo> vcodecs;
51 std::vector<ACodecInfo> acodecs;
53 std::vector<MuxerInfo> muxers;
54 std::vector<DemuxerInfo> demuxers;
61 demuxers.reserve(200);
63 void* opaque =
nullptr;
64 while(
auto codec = av_codec_iterate(&opaque))
66 if(!av_codec_is_encoder(codec))
69 if(codec->type == AVMediaType::AVMEDIA_TYPE_AUDIO)
70 acodecs.emplace_back(codec);
71 if(codec->type == AVMediaType::AVMEDIA_TYPE_VIDEO)
72 vcodecs.emplace_back(codec);
76 while(
auto format = av_muxer_iterate(&opaque))
79 for(
const auto& codec : vcodecs)
81 if(avformat_query_codec(format, codec.codec->id, FF_COMPLIANCE_STRICT) == 1)
83 fmt.vcodecs.push_back(&codec);
86 for(
const auto& codec : acodecs)
88 if(avformat_query_codec(format, codec.codec->id, FF_COMPLIANCE_STRICT) == 1)
90 fmt.acodecs.push_back(&codec);
93 if(fmt.vcodecs.empty() && fmt.acodecs.empty())
95 muxers.push_back(std::move(fmt));
99 while(
auto format = av_demuxer_iterate(&opaque))
106 findMuxer(
const QString& name,
const QString& long_name)
const noexcept
108 for(
auto& obj : muxers)
110 if(obj.format->long_name)
112 if(obj.format->name == name && obj.format->long_name == long_name)
116 for(
auto& obj : muxers)
118 if(obj.format->name == name)
125 findDemuxer(
const QString& name,
const QString& long_name)
const noexcept
127 for(
auto& obj : demuxers)
129 if(obj.format->long_name)
131 if(obj.format->name == name && obj.format->long_name == long_name)
135 for(
auto& obj : demuxers)
137 if(obj.format->name == name)
144 findVideoCodec(
const QString& name,
const QString& long_name)
const noexcept
146 for(
auto& obj : vcodecs)
148 if(obj.codec->long_name)
150 if(obj.codec->name == name && obj.codec->long_name == long_name)
154 for(
auto& obj : vcodecs)
156 if(obj.codec->name == name)
163 findAudioCodec(
const QString& name,
const QString& long_name)
const noexcept
165 for(
auto& obj : acodecs)
167 if(obj.codec->long_name)
169 if(obj.codec->name == name && obj.codec->long_name == long_name)
173 for(
auto& obj : acodecs)
175 if(obj.codec->name == name)
Binds the rendering pipeline to ossia processes.
Definition: CameraDevice.cpp:28
Definition: LibavIntrospection.hpp:14
Definition: LibavIntrospection.hpp:30
Definition: LibavIntrospection.hpp:49
Definition: LibavIntrospection.hpp:38
Definition: LibavIntrospection.hpp:22