mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-15 10:00:51 -04:00
Fix build with libavcodec < 55
This commit is contained in:
parent
7385dd12ac
commit
efc057e128
1 changed files with 12 additions and 0 deletions
|
@ -536,12 +536,24 @@ bool FFmpegVideo::encodeData(const QImage& image, uint32_t target_encoding_bitra
|
||||||
|
|
||||||
AVPacket pkt ;
|
AVPacket pkt ;
|
||||||
av_init_packet(&pkt);
|
av_init_packet(&pkt);
|
||||||
|
#if LIBAVCODEC_VERSION_MAJOR < 55
|
||||||
|
pkt.size = avpicture_get_size(encoding_context->pix_fmt, encoding_context->width, encoding_context->height);
|
||||||
|
pkt.data = (uint8_t*)av_malloc(pkt.size);
|
||||||
|
|
||||||
|
// do
|
||||||
|
// {
|
||||||
|
int ret = avcodec_encode_video(encoding_context, pkt.data, pkt.size, frame) ;
|
||||||
|
if (ret > 0) {
|
||||||
|
got_output = ret;
|
||||||
|
}
|
||||||
|
#else
|
||||||
pkt.data = NULL; // packet data will be allocated by the encoder
|
pkt.data = NULL; // packet data will be allocated by the encoder
|
||||||
pkt.size = 0;
|
pkt.size = 0;
|
||||||
|
|
||||||
// do
|
// do
|
||||||
// {
|
// {
|
||||||
int ret = avcodec_encode_video2(encoding_context, &pkt, frame, &got_output) ;
|
int ret = avcodec_encode_video2(encoding_context, &pkt, frame, &got_output) ;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue