Skip to content

Commit

Permalink
[float / sample] minor build fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed Jan 24, 2024
1 parent 07dabd4 commit 488c549
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/plugins/score-plugin-gfx/Gfx/Libav/LibavEncoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ int LibavEncoder::start()
ret = avio_open(&m_formatContext->pb, filename.c_str(), AVIO_FLAG_WRITE);
if(ret < 0)
{
qDebug() << "Could not open" << filename.c_str() << ":" << av_err2str(ret));
qDebug() << "Could not open" << filename.c_str() << ":" << av_to_string(ret));
avformat_free_context(m_formatContext);
m_formatContext = nullptr;
return 1;
Expand Down
5 changes: 5 additions & 0 deletions src/plugins/score-plugin-gfx/Gfx/Libav/LibavOutputStream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ struct OutputStream
const LibavOutputSettings& set, AVFormatContext* oc, const AVCodec* codec,
AVDictionary* opt_arg)
{
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 24, 100)
AVDictionary* opt = nullptr;

av_dict_copy(&opt, opt_arg, 0);
Expand All @@ -222,6 +223,7 @@ struct OutputStream
nb_samples = enc->frame_size;
qDebug() << "Forcing frame_size: " << nb_samples;
}

cache_input_frame = alloc_audio_frame(
enc->sample_fmt, &enc->ch_layout, enc->sample_rate, nb_samples);

Expand Down Expand Up @@ -285,8 +287,10 @@ struct OutputStream
break;
}
}
#endif
}

#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 24, 100)
static AVFrame* alloc_audio_frame(
enum AVSampleFormat sample_fmt, const AVChannelLayout* channel_layout,
int sample_rate, int nb_samples)
Expand Down Expand Up @@ -315,6 +319,7 @@ struct OutputStream

return frame;
}
#endif

static AVFrame* alloc_video_frame(enum AVPixelFormat pix_fmt, int width, int height)
{
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/score-plugin-media/Media/Libav.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ extern "C" int av_strerror(int errnum, char* errbuf, size_t errbuf_size);

static inline QString av_to_string(int errnum)
{
thread_local char err[512];
char err[512];
av_strerror(errnum, err, 512);
return QString::fromUtf8(err);
}
Expand Down

0 comments on commit 488c549

Please sign in to comment.