minor refactoring
This commit is contained in:
@@ -189,6 +189,17 @@ util::buffer_t<std::uint8_t> read_sps(const AVPacket *packet, int codec_id) {
|
|||||||
return write(*p, (AVCodecID)codec_id);
|
return write(*p, (AVCodecID)codec_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
util::buffer_t<std::uint8_t> make_sps(const AVCodecContext *ctx, int format) {
|
||||||
|
switch(format) {
|
||||||
|
case 0:
|
||||||
|
return make_sps_h264(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_LOG(warning) << "make_sps: video format ["sv << format << "] not supported"sv;
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
bool validate_sps(const AVPacket *packet, int codec_id) {
|
bool validate_sps(const AVPacket *packet, int codec_id) {
|
||||||
cbs::ctx_t ctx;
|
cbs::ctx_t ctx;
|
||||||
if(ff_cbs_init(&ctx, (AVCodecID)codec_id, nullptr)) {
|
if(ff_cbs_init(&ctx, (AVCodecID)codec_id, nullptr)) {
|
||||||
|
|||||||
+1
-2
@@ -8,8 +8,7 @@ struct AVCodecContext;
|
|||||||
namespace cbs {
|
namespace cbs {
|
||||||
|
|
||||||
util::buffer_t<std::uint8_t> read_sps(const AVPacket *packet, int codec_id);
|
util::buffer_t<std::uint8_t> read_sps(const AVPacket *packet, int codec_id);
|
||||||
util::buffer_t<std::uint8_t> make_sps_h264(const AVCodecContext *ctx);
|
util::buffer_t<std::uint8_t> make_sps(const AVCodecContext *ctx, int video_format);
|
||||||
util::buffer_t<std::uint8_t> make_sps_hevc(const AVCodecContext *ctx);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if SPS->VUI is present
|
* Check if SPS->VUI is present
|
||||||
|
|||||||
+1
-1
@@ -937,7 +937,7 @@ std::optional<session_t> make_session(const encoder_t &encoder, const config_t &
|
|||||||
return std::make_optional<session_t>(
|
return std::make_optional<session_t>(
|
||||||
std::move(ctx),
|
std::move(ctx),
|
||||||
std::move(device),
|
std::move(device),
|
||||||
cbs::make_sps_h264(ctx.get()));
|
cbs::make_sps(ctx.get(), config.videoFormat));
|
||||||
}
|
}
|
||||||
|
|
||||||
void encode_run(
|
void encode_run(
|
||||||
|
|||||||
Reference in New Issue
Block a user