Skip to content

Commit 1ac3f05

Browse files
authored
[FIX] Regression bug failing to compile with ENABLE_FFMPEG (#1728)
* Fix hardsubx_decoder.c compilation with ENABLE_FFMPEG Fix unresolved function reference when compiling with ENABLE_FFMPEG * Fix regression compilation ffmpeg_intgr.c to support ffmpeg 5 Fix regression bug for compiling with ENABLE_FFMPEG and ffmpeg 5, introduced in #1418 * Update CHANGES.TXT * Update ffmpeg_intgr.c Update for changes to FFMPEG 5 API
1 parent 39e051b commit 1ac3f05

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

docs/CHANGES.TXT

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
- Fix: Resolve compile-time error about implicit declarations (#1646)
4949
- Fix: fatal out of memory error extracting from a VOB PS
5050
- Fix: Unit Test Rust failing due to changes in Rust Version 1.86.0
51+
- Fix: Build with ENABLE_FFMPEG to support ffmpeg 5
5152

5253
0.94 (2021-12-14)
5354
-----------------

src/lib_ccx/ffmpeg_intgr.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ void *init_ffmpeg(const char *path)
6565
int stream_index = 0;
6666
struct ffmpeg_ctx *ctx;
6767
AVCodec *dec = NULL;
68-
avcodec_register_all();
6968

7069
if (ccx_options.debug_mask & CCX_DMT_VERBOSE)
7170
av_log_set_level(AV_LOG_INFO);
@@ -105,7 +104,7 @@ void *init_ffmpeg(const char *path)
105104
goto fail;
106105
}
107106
stream_index = ret;
108-
ctx->dec_ctx = ctx->ifmt->streams[stream_index]->codec;
107+
ctx->dec_ctx = ctx->ifmt->streams[stream_index]->codecpar;
109108
ctx->stream_index = stream_index;
110109
ret = avcodec_open2(ctx->dec_ctx, dec, NULL);
111110
if (ret < 0)
@@ -149,7 +148,7 @@ int ff_get_ccframe(void *arg, unsigned char *data, int maxlen)
149148
return AVERROR(EAGAIN);
150149
}
151150

152-
avcodec_send_packet(ctx->codec_ctx, &ctx->packet);
151+
avcodec_send_packet(ctx->dec_ctx, &packet);
153152
ret = avcodec_receive_frame(ctx->dec_ctx, ctx->frame);
154153
if (ret < 0)
155154
{
@@ -159,15 +158,15 @@ int ff_get_ccframe(void *arg, unsigned char *data, int maxlen)
159158
{
160159
return AVERROR(EAGAIN);
161160
}
162-
// current_pts = av_frame_get_best_effort_timestamp(ctx->frame);
161+
// current_pts = ctx->frame->best_effort_timestamp;
163162
// if(!pts_set)
164163
// pts_set = 1;
165164
// set_fts();
166165
for (int i = 0; i < ctx->frame->nb_side_data; i++)
167166
{
168167
if (ctx->frame->side_data[i]->type == AV_FRAME_DATA_A53_CC)
169168
{
170-
ctx->frame->pts = av_frame_get_best_effort_timestamp(ctx->frame);
169+
ctx->frame->pts = ctx->frame->best_effort_timestamp;
171170
if (ctx->frame->side_data[i]->size > maxlen)
172171
av_log(NULL, AV_LOG_ERROR, "Please consider increasing length of data\n");
173172
else

src/lib_ccx/hardsubx_decoder.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
#include <leptonica/allheaders.h>
1111
#include <tesseract/capi.h>
1212
#include "hardsubx.h"
13+
#ifdef ENABLE_FFMPEG
14+
#include "ffmpeg_intgr.h"
15+
#endif
1316

1417
#ifdef DISABLE_RUST
1518
char *_process_frame_white_basic(struct lib_hardsubx_ctx *ctx, AVFrame *frame, int width, int height, int index)

0 commit comments

Comments
 (0)