mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-26 15:02:58 +02:00
generic-pc: fix build with newer ffmpeg
This commit is contained in:
@@ -387,9 +387,9 @@ void ADec::run()
|
||||
lt_info("%s: avcodec_open2() failed\n", __func__);
|
||||
goto out;
|
||||
}
|
||||
frame = avcodec_alloc_frame();
|
||||
frame = av_frame_alloc();
|
||||
if (!frame) {
|
||||
lt_info("%s: avcodec_alloc_frame failed\n", __func__);
|
||||
lt_info("%s: av_frame_alloc failed\n", __func__);
|
||||
goto out2;
|
||||
}
|
||||
/* output sample rate, channels, layout could be set here if necessary */
|
||||
@@ -466,7 +466,7 @@ void ADec::run()
|
||||
av_free(obuf);
|
||||
swr_free(&swr);
|
||||
out3:
|
||||
avcodec_free_frame(&frame);
|
||||
av_frame_free(&frame);
|
||||
out2:
|
||||
avcodec_close(c);
|
||||
c = NULL;
|
||||
|
@@ -297,8 +297,8 @@ void VDec::ShowPicture(const char *fname)
|
||||
lt_info("%s: Could not find/open the codec, id 0x%x\n", __func__, c->codec_id);
|
||||
goto out_close;
|
||||
}
|
||||
frame = avcodec_alloc_frame();
|
||||
rgbframe = avcodec_alloc_frame();
|
||||
frame = av_frame_alloc();
|
||||
rgbframe = av_frame_alloc();
|
||||
if (!frame || !rgbframe) {
|
||||
lt_info("%s: Could not allocate video frame\n", __func__);
|
||||
goto out_free;
|
||||
@@ -317,9 +317,9 @@ void VDec::ShowPicture(const char *fname)
|
||||
if (avpkt.size > len)
|
||||
lt_info("%s: WARN: pkt->size %d != len %d\n", __func__, avpkt.size, len);
|
||||
if (got_frame) {
|
||||
unsigned int need = avpicture_get_size(PIX_FMT_RGB32, c->width, c->height);
|
||||
unsigned int need = avpicture_get_size(AV_PIX_FMT_RGB32, c->width, c->height);
|
||||
struct SwsContext *convert = sws_getContext(c->width, c->height, c->pix_fmt,
|
||||
c->width, c->height, PIX_FMT_RGB32,
|
||||
c->width, c->height, AV_PIX_FMT_RGB32,
|
||||
SWS_BICUBIC, 0, 0, 0);
|
||||
if (!convert)
|
||||
lt_info("%s: ERROR setting up SWS context\n", __func__);
|
||||
@@ -328,7 +328,7 @@ void VDec::ShowPicture(const char *fname)
|
||||
SWFramebuffer *f = &buffers[buf_in];
|
||||
if (f->size() < need)
|
||||
f->resize(need);
|
||||
avpicture_fill((AVPicture *)rgbframe, &(*f)[0], PIX_FMT_RGB32,
|
||||
avpicture_fill((AVPicture *)rgbframe, &(*f)[0], AV_PIX_FMT_RGB32,
|
||||
c->width, c->height);
|
||||
sws_scale(convert, frame->data, frame->linesize, 0, c->height,
|
||||
rgbframe->data, rgbframe->linesize);
|
||||
@@ -353,8 +353,8 @@ void VDec::ShowPicture(const char *fname)
|
||||
av_free_packet(&avpkt);
|
||||
out_free:
|
||||
avcodec_close(c);
|
||||
avcodec_free_frame(&frame);
|
||||
avcodec_free_frame(&rgbframe);
|
||||
av_frame_free(&frame);
|
||||
av_frame_free(&rgbframe);
|
||||
out_close:
|
||||
avformat_close_input(&avfc);
|
||||
lt_debug("%s(%s) end\n", __func__, fname);
|
||||
@@ -514,8 +514,8 @@ void VDec::run(void)
|
||||
lt_info("%s: Could not open codec\n", __func__);
|
||||
goto out;
|
||||
}
|
||||
frame = avcodec_alloc_frame();
|
||||
rgbframe = avcodec_alloc_frame();
|
||||
frame = av_frame_alloc();
|
||||
rgbframe = av_frame_alloc();
|
||||
if (!frame || !rgbframe) {
|
||||
lt_info("%s: Could not allocate video frame\n", __func__);
|
||||
goto out2;
|
||||
@@ -543,10 +543,10 @@ void VDec::run(void)
|
||||
if (avpkt.size > len)
|
||||
lt_info("%s: WARN: pkt->size %d != len %d\n", __func__, avpkt.size, len);
|
||||
if (got_frame) {
|
||||
unsigned int need = avpicture_get_size(PIX_FMT_RGB32, c->width, c->height);
|
||||
unsigned int need = avpicture_get_size(AV_PIX_FMT_RGB32, c->width, c->height);
|
||||
convert = sws_getCachedContext(convert,
|
||||
c->width, c->height, c->pix_fmt,
|
||||
c->width, c->height, PIX_FMT_RGB32,
|
||||
c->width, c->height, AV_PIX_FMT_RGB32,
|
||||
SWS_BICUBIC, 0, 0, 0);
|
||||
if (!convert)
|
||||
lt_info("%s: ERROR setting up SWS context\n", __func__);
|
||||
@@ -555,7 +555,7 @@ void VDec::run(void)
|
||||
SWFramebuffer *f = &buffers[buf_in];
|
||||
if (f->size() < need)
|
||||
f->resize(need);
|
||||
avpicture_fill((AVPicture *)rgbframe, &(*f)[0], PIX_FMT_RGB32,
|
||||
avpicture_fill((AVPicture *)rgbframe, &(*f)[0], AV_PIX_FMT_RGB32,
|
||||
c->width, c->height);
|
||||
sws_scale(convert, frame->data, frame->linesize, 0, c->height,
|
||||
rgbframe->data, rgbframe->linesize);
|
||||
@@ -598,8 +598,8 @@ void VDec::run(void)
|
||||
sws_freeContext(convert);
|
||||
out2:
|
||||
avcodec_close(c);
|
||||
avcodec_free_frame(&frame);
|
||||
avcodec_free_frame(&rgbframe);
|
||||
av_frame_free(&frame);
|
||||
av_frame_free(&rgbframe);
|
||||
out:
|
||||
avformat_close_input(&avfc);
|
||||
av_free(pIOCtx->buffer);
|
||||
@@ -617,23 +617,23 @@ static bool swscale(unsigned char *src, unsigned char *dst, int sw, int sh, int
|
||||
bool ret = false;
|
||||
struct SwsContext *scale = NULL;
|
||||
AVFrame *sframe, *dframe;
|
||||
scale = sws_getCachedContext(scale, sw, sh, PIX_FMT_RGB32, dw, dh, PIX_FMT_RGB32, SWS_BICUBIC, 0, 0, 0);
|
||||
scale = sws_getCachedContext(scale, sw, sh, AV_PIX_FMT_RGB32, dw, dh, AV_PIX_FMT_RGB32, SWS_BICUBIC, 0, 0, 0);
|
||||
if (!scale) {
|
||||
lt_info_c("%s: ERROR setting up SWS context\n", __func__);
|
||||
return false;
|
||||
}
|
||||
sframe = avcodec_alloc_frame();
|
||||
dframe = avcodec_alloc_frame();
|
||||
sframe = av_frame_alloc();
|
||||
dframe = av_frame_alloc();
|
||||
if (!sframe || !dframe) {
|
||||
lt_info_c("%s: could not alloc sframe (%p) or dframe (%p)\n", __func__, sframe, dframe);
|
||||
goto out;
|
||||
}
|
||||
avpicture_fill((AVPicture *)sframe, &(src[0]), PIX_FMT_RGB32, sw, sh);
|
||||
avpicture_fill((AVPicture *)dframe, &(dst[0]), PIX_FMT_RGB32, dw, dh);
|
||||
avpicture_fill((AVPicture *)sframe, &(src[0]), AV_PIX_FMT_RGB32, sw, sh);
|
||||
avpicture_fill((AVPicture *)dframe, &(dst[0]), AV_PIX_FMT_RGB32, dw, dh);
|
||||
sws_scale(scale, sframe->data, sframe->linesize, 0, sh, dframe->data, dframe->linesize);
|
||||
out:
|
||||
avcodec_free_frame(&sframe);
|
||||
avcodec_free_frame(&dframe);
|
||||
av_frame_free(&sframe);
|
||||
av_frame_free(&dframe);
|
||||
sws_freeContext(scale);
|
||||
return ret;
|
||||
}
|
||||
@@ -667,7 +667,7 @@ bool VDec::GetScreenImage(unsigned char * &data, int &xres, int &yres, bool get_
|
||||
}
|
||||
if (get_osd)
|
||||
osd = glfb_priv->getOSDBuffer();
|
||||
unsigned int need = avpicture_get_size(PIX_FMT_RGB32, xres, yres);
|
||||
unsigned int need = avpicture_get_size(AV_PIX_FMT_RGB32, xres, yres);
|
||||
data = (unsigned char *)realloc(data, need); /* will be freed by caller */
|
||||
if (data == NULL) /* out of memory? */
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user