fix generic-pc: ffmpeg is deprecated

This commit is contained in:
max10
2015-04-22 14:26:19 +02:00
parent b7bb43a670
commit 1bca61569e
2 changed files with 14 additions and 14 deletions

View File

@@ -369,7 +369,7 @@ void cAudio::run()
lt_info("%s: avcodec_open2() failed\n", __func__); lt_info("%s: avcodec_open2() failed\n", __func__);
goto out; goto out;
} }
frame = avcodec_alloc_frame(); frame = av_frame_alloc();
if (!frame) { if (!frame) {
lt_info("%s: avcodec_alloc_frame failed\n", __func__); lt_info("%s: avcodec_alloc_frame failed\n", __func__);
goto out2; goto out2;
@@ -448,7 +448,7 @@ void cAudio::run()
av_free(obuf); av_free(obuf);
swr_free(&swr); swr_free(&swr);
out3: out3:
avcodec_free_frame(&frame); av_frame_free(&frame);
out2: out2:
avcodec_close(c); avcodec_close(c);
c = NULL; c = NULL;

View File

@@ -250,8 +250,8 @@ void cVideo::ShowPicture(const char *fname, const char *)
lt_info("%s: Could not find/open the codec, id 0x%x\n", __func__, c->codec_id); lt_info("%s: Could not find/open the codec, id 0x%x\n", __func__, c->codec_id);
goto out_close; goto out_close;
} }
frame = avcodec_alloc_frame(); frame = av_frame_alloc();
rgbframe = avcodec_alloc_frame(); rgbframe = av_frame_alloc();
if (!frame || !rgbframe) { if (!frame || !rgbframe) {
lt_info("%s: Could not allocate video frame\n", __func__); lt_info("%s: Could not allocate video frame\n", __func__);
goto out_free; goto out_free;
@@ -306,8 +306,8 @@ void cVideo::ShowPicture(const char *fname, const char *)
av_free_packet(&avpkt); av_free_packet(&avpkt);
out_free: out_free:
avcodec_close(c); avcodec_close(c);
avcodec_free_frame(&frame); av_frame_free(&frame);
avcodec_free_frame(&rgbframe); av_frame_free(&rgbframe);
out_close: out_close:
avformat_close_input(&avfc); avformat_close_input(&avfc);
lt_debug("%s(%s) end\n", __func__, fname); lt_debug("%s(%s) end\n", __func__, fname);
@@ -452,8 +452,8 @@ void cVideo::run(void)
lt_info("%s: Could not open codec\n", __func__); lt_info("%s: Could not open codec\n", __func__);
goto out; goto out;
} }
frame = avcodec_alloc_frame(); frame = av_frame_alloc();
rgbframe = avcodec_alloc_frame(); rgbframe = av_frame_alloc();
if (!frame || !rgbframe) { if (!frame || !rgbframe) {
lt_info("%s: Could not allocate video frame\n", __func__); lt_info("%s: Could not allocate video frame\n", __func__);
goto out2; goto out2;
@@ -533,8 +533,8 @@ void cVideo::run(void)
sws_freeContext(convert); sws_freeContext(convert);
out2: out2:
avcodec_close(c); avcodec_close(c);
avcodec_free_frame(&frame); av_frame_free(&frame);
avcodec_free_frame(&rgbframe); av_frame_free(&rgbframe);
out: out:
avformat_close_input(&avfc); avformat_close_input(&avfc);
av_free(pIOCtx->buffer); av_free(pIOCtx->buffer);
@@ -557,8 +557,8 @@ static bool swscale(unsigned char *src, unsigned char *dst, int sw, int sh, int
lt_info_c("%s: ERROR setting up SWS context\n", __func__); lt_info_c("%s: ERROR setting up SWS context\n", __func__);
return false; return false;
} }
sframe = avcodec_alloc_frame(); sframe = av_frame_alloc();
dframe = avcodec_alloc_frame(); dframe = av_frame_alloc();
if (!sframe || !dframe) { if (!sframe || !dframe) {
lt_info_c("%s: could not alloc sframe (%p) or dframe (%p)\n", __func__, sframe, dframe); lt_info_c("%s: could not alloc sframe (%p) or dframe (%p)\n", __func__, sframe, dframe);
goto out; goto out;
@@ -567,8 +567,8 @@ static bool swscale(unsigned char *src, unsigned char *dst, int sw, int sh, int
avpicture_fill((AVPicture *)dframe, &(dst[0]), PIX_FMT_RGB32, dw, dh); avpicture_fill((AVPicture *)dframe, &(dst[0]), PIX_FMT_RGB32, dw, dh);
sws_scale(scale, sframe->data, sframe->linesize, 0, sh, dframe->data, dframe->linesize); sws_scale(scale, sframe->data, sframe->linesize, 0, sh, dframe->data, dframe->linesize);
out: out:
avcodec_free_frame(&sframe); av_frame_free(&sframe);
avcodec_free_frame(&dframe); av_frame_free(&dframe);
sws_freeContext(scale); sws_freeContext(scale);
return ret; return ret;
} }