Skip to content

Commit 296fd7a

Browse files
committed
Merge pull-request "Compatibility with FFMPEG"
Request at johmathe#16 Replace deprecated methods, use new names of av-specific constants
1 parent 2cf15c3 commit 296fd7a

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

src/film.cc

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -382,22 +382,22 @@ int film::process() {
382382
/*
383383
* Allocate current and previous video frames
384384
*/
385-
pFrame = avcodec_alloc_frame();
385+
pFrame = av_frame_alloc();
386386
// RGB:
387-
pFrameRGB = avcodec_alloc_frame(); // current frame
388-
pFrameRGBprev = avcodec_alloc_frame(); // previous frame
387+
pFrameRGB = av_frame_alloc(); // current frame
388+
pFrameRGBprev = av_frame_alloc(); // previous frame
389389
// YUV:
390-
pFrameYUV = avcodec_alloc_frame(); // current frame
390+
pFrameYUV = av_frame_alloc(); // current frame
391391

392392
/*
393393
* Allocate memory for the pixels of a picture and setup the AVPicture
394394
* fields for it
395395
*/
396396
// RGB:
397-
avpicture_alloc((AVPicture *)pFrameRGB, PIX_FMT_RGB24, width, height);
398-
avpicture_alloc((AVPicture *)pFrameRGBprev, PIX_FMT_RGB24, width, height);
397+
avpicture_alloc((AVPicture *)pFrameRGB, AV_PIX_FMT_RGB24, width, height);
398+
avpicture_alloc((AVPicture *)pFrameRGBprev, AV_PIX_FMT_RGB24, width, height);
399399
// YUV:
400-
avpicture_alloc((AVPicture *)pFrameYUV, PIX_FMT_YUV444P, width, height);
400+
avpicture_alloc((AVPicture *)pFrameYUV, AV_PIX_FMT_YUV444P, width, height);
401401

402402
/*
403403
* Mise en place du premier plan
@@ -460,7 +460,7 @@ int film::process() {
460460
if (!img_ctx) {
461461
img_ctx =
462462
sws_getContext(width, height, pCodecCtx->pix_fmt, width, height,
463-
PIX_FMT_YUV444P, SWS_BICUBIC, NULL, NULL, NULL);
463+
AV_PIX_FMT_YUV444P, SWS_BICUBIC, NULL, NULL, NULL);
464464
if (!img_ctx) {
465465
fprintf(stderr,
466466
"Cannot initialize the converted YUV image context!\n");
@@ -472,7 +472,7 @@ int film::process() {
472472
if (!img_convert_ctx) {
473473
img_convert_ctx =
474474
sws_getContext(width, height, pCodecCtx->pix_fmt, width, height,
475-
PIX_FMT_RGB24, SWS_BICUBIC, NULL, NULL, NULL);
475+
AV_PIX_FMT_RGB24, SWS_BICUBIC, NULL, NULL, NULL);
476476
if (!img_convert_ctx) {
477477
fprintf(stderr,
478478
"Cannot initialize the converted RGB image context!\n");
@@ -524,7 +524,7 @@ int film::process() {
524524
}
525525
/* Copy current frame as "previous" for next round */
526526
av_picture_copy((AVPicture *)pFrameRGBprev, (AVPicture *)pFrameRGB,
527-
PIX_FMT_RGB24, width, height);
527+
AV_PIX_FMT_RGB24, width, height);
528528

529529
if (display) do_stats(pCodecCtx->frame_number);
530530
}
@@ -621,7 +621,7 @@ void film::process_audio() {
621621
len = packet.size;
622622

623623
while (len > 0) {
624-
this->audio_buf = avcodec_alloc_frame();
624+
this->audio_buf = av_frame_alloc();
625625
// (short *) av_fast_realloc (this->audio_buf, &samples_size, FFMAX
626626
// (packet.size, AVCODEC_MAX_AUDIO_FRAME_SIZE));
627627
data_size = samples_size;

0 commit comments

Comments
 (0)