File ffmpeg-libopenjpeg.patch of Package A_tw-ffmpeg-3
580
1
--- a/configure
2
+++ b/configure
3
4
machine_ioctl_meteor_h
5
malloc_h
6
opencv2_core_core_c_h
7
- openjpeg_2_3_openjpeg_h
8
- openjpeg_2_2_openjpeg_h
9
- openjpeg_2_1_openjpeg_h
10
- openjpeg_2_0_openjpeg_h
11
- openjpeg_1_5_openjpeg_h
12
OpenGL_gl3_h
13
poll_h
14
soundcard_h
15
16
require opencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; } ||
17
require_pkg_config libopencv opencv opencv/cxcore.h cvCreateImageHeader; }
18
enabled libopenh264 && require_pkg_config libopenh264 openh264 wels/codec_api.h WelsGetCodecVersion
19
-enabled libopenjpeg && { { check_lib libopenjpeg openjpeg-2.3/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
20
- check_lib libopenjpeg openjpeg-2.3/openjpeg.h opj_version -lopenjp2 ||
21
- { check_lib libopenjpeg openjpeg-2.2/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
22
- check_lib libopenjpeg openjpeg-2.2/openjpeg.h opj_version -lopenjp2 ||
23
- { check_lib libopenjpeg openjpeg-2.1/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
24
- check_lib libopenjpeg openjpeg-2.1/openjpeg.h opj_version -lopenjp2 ||
25
- { check_lib libopenjpeg openjpeg-2.0/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
26
- { check_lib libopenjpeg openjpeg-1.5/openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
27
- { check_lib libopenjpeg openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
28
- die "ERROR: libopenjpeg not found"; }
29
+enabled libopenjpeg && { use_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version ||
30
+ { require_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } }
31
enabled libopenmpt && require_pkg_config libopenmpt "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create
32
enabled libopus && {
33
enabled libopus_decoder && {
34
--- a/libavcodec/libopenjpegdec.c
35
+++ b/libavcodec/libopenjpegdec.c
36
37
#include "internal.h"
38
#include "thread.h"
39
40
-#if HAVE_OPENJPEG_2_3_OPENJPEG_H
41
-# include <openjpeg-2.3/openjpeg.h>
42
-#elif HAVE_OPENJPEG_2_2_OPENJPEG_H
43
-# include <openjpeg-2.2/openjpeg.h>
44
-#elif HAVE_OPENJPEG_2_1_OPENJPEG_H
45
-# include <openjpeg-2.1/openjpeg.h>
46
-#elif HAVE_OPENJPEG_2_0_OPENJPEG_H
47
-# include <openjpeg-2.0/openjpeg.h>
48
-#elif HAVE_OPENJPEG_1_5_OPENJPEG_H
49
-# include <openjpeg-1.5/openjpeg.h>
50
-#else
51
-# include <openjpeg.h>
52
-#endif
53
-
54
-#if HAVE_OPENJPEG_2_3_OPENJPEG_H || HAVE_OPENJPEG_2_2_OPENJPEG_H || HAVE_OPENJPEG_2_1_OPENJPEG_H || HAVE_OPENJPEG_2_0_OPENJPEG_H
55
-# define OPENJPEG_MAJOR_VERSION 2
56
-# define OPJ(x) OPJ_##x
57
-#else
58
-# define OPENJPEG_MAJOR_VERSION 1
59
-# define OPJ(x) x
60
-#endif
61
+#include <openjpeg.h>
62
63
#define JP2_SIG_TYPE 0x6A502020
64
#define JP2_SIG_VALUE 0x0D0A870A
65
66
typedef struct LibOpenJPEGContext {
67
AVClass *class;
68
opj_dparameters_t dec_params;
69
-#if OPENJPEG_MAJOR_VERSION == 1
70
- opj_event_mgr_t event_mgr;
71
-#endif // OPENJPEG_MAJOR_VERSION == 1
72
int lowqual;
73
} LibOpenJPEGContext;
74
75
76
av_log(data, AV_LOG_DEBUG, "%s", msg);
77
}
78
79
-#if OPENJPEG_MAJOR_VERSION == 2
80
typedef struct BufferReader {
81
int pos;
82
int size;
83
84
reader->pos = (int)nb_bytes;
85
return OPJ_TRUE;
86
}
87
-#endif // OPENJPEG_MAJOR_VERSION == 2
88
89
static inline int libopenjpeg_matches_pix_fmt(const opj_image_t *image, enum AVPixelFormat pix_fmt)
90
{
91
92
int possible_fmts_nb = 0;
93
94
switch (image->color_space) {
95
- case OPJ(CLRSPC_SRGB):
96
+ case OPJ_CLRSPC_SRGB:
97
possible_fmts = libopenjpeg_rgb_pix_fmts;
98
possible_fmts_nb = FF_ARRAY_ELEMS(libopenjpeg_rgb_pix_fmts);
99
break;
100
- case OPJ(CLRSPC_GRAY):
101
+ case OPJ_CLRSPC_GRAY:
102
possible_fmts = libopenjpeg_gray_pix_fmts;
103
possible_fmts_nb = FF_ARRAY_ELEMS(libopenjpeg_gray_pix_fmts);
104
break;
105
- case OPJ(CLRSPC_SYCC):
106
+ case OPJ_CLRSPC_SYCC:
107
possible_fmts = libopenjpeg_yuv_pix_fmts;
108
possible_fmts_nb = FF_ARRAY_ELEMS(libopenjpeg_yuv_pix_fmts);
109
break;
110
111
int ispacked = 0;
112
int i;
113
opj_image_t *image = NULL;
114
-#if OPENJPEG_MAJOR_VERSION == 1
115
- opj_dinfo_t *dec = NULL;
116
- opj_cio_t *stream = NULL;
117
-#else // OPENJPEG_MAJOR_VERSION == 2
118
BufferReader reader = {0, avpkt->size, avpkt->data};
119
opj_codec_t *dec = NULL;
120
opj_stream_t *stream = NULL;
121
-#endif // OPENJPEG_MAJOR_VERSION == 1
122
123
*got_frame = 0;
124
125
126
if ((AV_RB32(buf) == 12) &&
127
(AV_RB32(buf + 4) == JP2_SIG_TYPE) &&
128
(AV_RB32(buf + 8) == JP2_SIG_VALUE)) {
129
- dec = opj_create_decompress(OPJ(CODEC_JP2));
130
+ dec = opj_create_decompress(OPJ_CODEC_JP2);
131
} else {
132
/* If the AVPacket contains a jp2c box, then skip to
133
* the starting byte of the codestream. */
134
if (AV_RB32(buf + 4) == AV_RB32("jp2c"))
135
buf += 8;
136
- dec = opj_create_decompress(OPJ(CODEC_J2K));
137
+ dec = opj_create_decompress(OPJ_CODEC_J2K);
138
}
139
140
if (!dec) {
141
142
goto done;
143
}
144
145
-#if OPENJPEG_MAJOR_VERSION == 1
146
- memset(&ctx->event_mgr, 0, sizeof(ctx->event_mgr));
147
- ctx->event_mgr.info_handler = info_callback;
148
- ctx->event_mgr.error_handler = error_callback;
149
- ctx->event_mgr.warning_handler = warning_callback;
150
- opj_set_event_mgr((opj_common_ptr) dec, &ctx->event_mgr, avctx);
151
- ctx->dec_params.cp_limit_decoding = LIMIT_TO_MAIN_HEADER;
152
- ctx->dec_params.cp_layer = ctx->lowqual;
153
-#else // OPENJPEG_MAJOR_VERSION == 2
154
if (!opj_set_error_handler(dec, error_callback, avctx) ||
155
!opj_set_warning_handler(dec, warning_callback, avctx) ||
156
!opj_set_info_handler(dec, info_callback, avctx)) {
157
158
159
ctx->dec_params.cp_layer = ctx->lowqual;
160
ctx->dec_params.cp_reduce = avctx->lowres;
161
-#endif // OPENJPEG_MAJOR_VERSION == 1
162
163
// Tie decoder with decoding parameters
164
opj_setup_decoder(dec, &ctx->dec_params);
165
166
-#if OPENJPEG_MAJOR_VERSION == 1
167
- stream = opj_cio_open((opj_common_ptr) dec, buf, buf_size);
168
-#else // OPENJPEG_MAJOR_VERSION == 2
169
stream = opj_stream_default_create(OPJ_STREAM_READ);
170
-#endif // OPENJPEG_MAJOR_VERSION == 1
171
172
if (!stream) {
173
av_log(avctx, AV_LOG_ERROR,
174
175
goto done;
176
}
177
178
-#if OPENJPEG_MAJOR_VERSION == 1
179
- // Decode the header only.
180
- image = opj_decode_with_info(dec, stream, NULL);
181
- opj_cio_close(stream);
182
- stream = NULL;
183
- ret = !image;
184
-#else // OPENJPEG_MAJOR_VERSION == 2
185
opj_stream_set_read_function(stream, stream_read);
186
opj_stream_set_skip_function(stream, stream_skip);
187
opj_stream_set_seek_function(stream, stream_seek);
188
-#if HAVE_OPENJPEG_2_3_OPENJPEG_H || HAVE_OPENJPEG_2_2_OPENJPEG_H || HAVE_OPENJPEG_2_1_OPENJPEG_H
189
opj_stream_set_user_data(stream, &reader, NULL);
190
-#elif HAVE_OPENJPEG_2_0_OPENJPEG_H
191
- opj_stream_set_user_data(stream, &reader);
192
-#else
193
-#error Missing call to opj_stream_set_user_data
194
-#endif
195
opj_stream_set_user_data_length(stream, avpkt->size);
196
// Decode the header only.
197
ret = !opj_read_header(stream, dec, &image);
198
-#endif // OPENJPEG_MAJOR_VERSION == 1
199
200
if (ret) {
201
av_log(avctx, AV_LOG_ERROR, "Error decoding codestream header.\n");
202
203
if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
204
goto done;
205
206
-#if OPENJPEG_MAJOR_VERSION == 1
207
- ctx->dec_params.cp_limit_decoding = NO_LIMITATION;
208
- ctx->dec_params.cp_reduce = avctx->lowres;
209
- // Tie decoder with decoding parameters.
210
- opj_setup_decoder(dec, &ctx->dec_params);
211
- stream = opj_cio_open((opj_common_ptr) dec, buf, buf_size);
212
- if (!stream) {
213
- av_log(avctx, AV_LOG_ERROR,
214
- "Codestream could not be opened for reading.\n");
215
- ret = AVERROR_EXTERNAL;
216
- goto done;
217
- }
218
- opj_image_destroy(image);
219
- // Decode the codestream
220
- image = opj_decode_with_info(dec, stream, NULL);
221
- ret = !image;
222
-#else // OPENJPEG_MAJOR_VERSION == 2
223
ret = !opj_decode(dec, stream, image);
224
-#endif // OPENJPEG_MAJOR_VERSION == 1
225
226
if (ret) {
227
av_log(avctx, AV_LOG_ERROR, "Error decoding codestream.\n");
228
229
230
done:
231
opj_image_destroy(image);
232
-#if OPENJPEG_MAJOR_VERSION == 2
233
opj_stream_destroy(stream);
234
opj_destroy_codec(dec);
235
-#else
236
- opj_cio_close(stream);
237
- opj_destroy_decompress(dec);
238
-#endif
239
return ret;
240
}
241
242
-static av_cold void libopenjpeg_static_init(AVCodec *codec)
243
-{
244
- const char *version = opj_version();
245
- int major, minor;
246
-
247
- if (sscanf(version, "%d.%d", &major, &minor) == 2 && 1000*major + minor <= 1003)
248
- codec->capabilities |= AV_CODEC_CAP_EXPERIMENTAL;
249
-}
250
-
251
#define OFFSET(x) offsetof(LibOpenJPEGContext, x)
252
#define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
253
254
255
.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS,
256
.max_lowres = 31,
257
.priv_class = &openjpeg_class,
258
- .init_static_data = libopenjpeg_static_init,
259
};
260
--- a/libavcodec/libopenjpegenc.c
261
+++ b/libavcodec/libopenjpegenc.c
262
263
#include "libavutil/opt.h"
264
#include "avcodec.h"
265
#include "internal.h"
266
-
267
-#if HAVE_OPENJPEG_2_3_OPENJPEG_H
268
-# include <openjpeg-2.3/openjpeg.h>
269
-#elif HAVE_OPENJPEG_2_2_OPENJPEG_H
270
-# include <openjpeg-2.2/openjpeg.h>
271
-#elif HAVE_OPENJPEG_2_1_OPENJPEG_H
272
-# include <openjpeg-2.1/openjpeg.h>
273
-#elif HAVE_OPENJPEG_2_0_OPENJPEG_H
274
-# include <openjpeg-2.0/openjpeg.h>
275
-#elif HAVE_OPENJPEG_1_5_OPENJPEG_H
276
-# include <openjpeg-1.5/openjpeg.h>
277
-#else
278
-# include <openjpeg.h>
279
-#endif
280
-
281
-#if HAVE_OPENJPEG_2_3_OPENJPEG_H || HAVE_OPENJPEG_2_2_OPENJPEG_H || HAVE_OPENJPEG_2_1_OPENJPEG_H || HAVE_OPENJPEG_2_0_OPENJPEG_H
282
-# define OPENJPEG_MAJOR_VERSION 2
283
-# define OPJ(x) OPJ_##x
284
-#else
285
-# define OPENJPEG_MAJOR_VERSION 1
286
-# define OPJ(x) x
287
-#endif
288
+#include <openjpeg.h>
289
290
typedef struct LibOpenJPEGContext {
291
AVClass *avclass;
292
-#if OPENJPEG_MAJOR_VERSION == 1
293
- opj_image_t *image;
294
-#endif // OPENJPEG_MAJOR_VERSION == 1
295
opj_cparameters_t enc_params;
296
-#if OPENJPEG_MAJOR_VERSION == 1
297
- opj_event_mgr_t event_mgr;
298
-#endif // OPENJPEG_MAJOR_VERSION == 1
299
int format;
300
int profile;
301
int prog_order;
302
303
av_log(data, AV_LOG_DEBUG, "%s\n", msg);
304
}
305
306
-#if OPENJPEG_MAJOR_VERSION == 2
307
typedef struct PacketWriter {
308
int pos;
309
AVPacket *packet;
310
311
writer->pos = (int)nb_bytes;
312
return OPJ_TRUE;
313
}
314
-#endif // OPENJPEG_MAJOR_VERSION == 2
315
316
static void cinema_parameters(opj_cparameters_t *p)
317
{
318
319
p->csty |= 0x01;
320
321
/* The progression order shall be CPRL */
322
- p->prog_order = OPJ(CPRL);
323
+ p->prog_order = OPJ_CPRL;
324
325
/* No ROI */
326
p->roi_compno = -1;
327
328
int sub_dx[4];
329
int sub_dy[4];
330
int numcomps;
331
- OPJ_COLOR_SPACE color_space = OPJ(CLRSPC_UNKNOWN);
332
+ OPJ_COLOR_SPACE color_space = OPJ_CLRSPC_UNKNOWN;
333
334
sub_dx[0] = sub_dx[3] = 1;
335
sub_dy[0] = sub_dy[3] = 1;
336
337
case AV_PIX_FMT_YA8:
338
case AV_PIX_FMT_GRAY16:
339
case AV_PIX_FMT_YA16:
340
- color_space = OPJ(CLRSPC_GRAY);
341
+ color_space = OPJ_CLRSPC_GRAY;
342
break;
343
case AV_PIX_FMT_RGB24:
344
case AV_PIX_FMT_RGBA:
345
346
case AV_PIX_FMT_GBRP14:
347
case AV_PIX_FMT_GBRP16:
348
case AV_PIX_FMT_XYZ12:
349
- color_space = OPJ(CLRSPC_SRGB);
350
+ color_space = OPJ_CLRSPC_SRGB;
351
break;
352
case AV_PIX_FMT_YUV410P:
353
case AV_PIX_FMT_YUV411P:
354
355
case AV_PIX_FMT_YUVA420P16:
356
case AV_PIX_FMT_YUVA422P16:
357
case AV_PIX_FMT_YUVA444P16:
358
- color_space = OPJ(CLRSPC_SYCC);
359
+ color_space = OPJ_CLRSPC_SYCC;
360
break;
361
default:
362
av_log(avctx, AV_LOG_ERROR,
363
364
365
opj_set_default_encoder_parameters(&ctx->enc_params);
366
367
-#if HAVE_OPENJPEG_2_3_OPENJPEG_H || HAVE_OPENJPEG_2_2_OPENJPEG_H || HAVE_OPENJPEG_2_1_OPENJPEG_H
368
switch (ctx->cinema_mode) {
369
case OPJ_CINEMA2K_24:
370
ctx->enc_params.rsiz = OPJ_PROFILE_CINEMA_2K;
371
372
if (err) {
373
av_log(avctx, AV_LOG_ERROR,
374
"Invalid parameter pairing: cinema_mode and profile conflict.\n");
375
- goto fail;
376
+ return err;
377
}
378
-#else
379
- ctx->enc_params.cp_rsiz = ctx->profile;
380
- ctx->enc_params.cp_cinema = ctx->cinema_mode;
381
-#endif
382
383
if (!ctx->numresolution) {
384
ctx->numresolution = 6;
385
386
cinema_parameters(&ctx->enc_params);
387
}
388
389
-#if OPENJPEG_MAJOR_VERSION == 1
390
- ctx->image = mj2_create_image(avctx, &ctx->enc_params);
391
- if (!ctx->image) {
392
- av_log(avctx, AV_LOG_ERROR, "Error creating the mj2 image\n");
393
- err = AVERROR(EINVAL);
394
- goto fail;
395
- }
396
-#endif // OPENJPEG_MAJOR_VERSION == 1
397
-
398
return 0;
399
-
400
-fail:
401
-#if OPENJPEG_MAJOR_VERSION == 1
402
- opj_image_destroy(ctx->image);
403
- ctx->image = NULL;
404
-#endif // OPENJPEG_MAJOR_VERSION == 1
405
- return err;
406
}
407
408
static int libopenjpeg_copy_packed8(AVCodecContext *avctx, const AVFrame *frame, opj_image_t *image)
409
410
int ret;
411
AVFrame *gbrframe;
412
int cpyresult = 0;
413
-#if OPENJPEG_MAJOR_VERSION == 1
414
- opj_image_t *image = ctx->image;
415
- opj_cinfo_t *compress = NULL;
416
- opj_cio_t *stream = NULL;
417
- int len;
418
-#else // OPENJPEG_MAJOR_VERSION == 2
419
PacketWriter writer = { 0 };
420
opj_codec_t *compress = NULL;
421
opj_stream_t *stream = NULL;
422
423
ret = AVERROR(EINVAL);
424
goto done;
425
}
426
-#endif // OPENJPEG_MAJOR_VERSION == 1
427
428
switch (avctx->pix_fmt) {
429
case AV_PIX_FMT_RGB24:
430
431
goto done;
432
}
433
434
-#if OPENJPEG_MAJOR_VERSION == 2
435
if ((ret = ff_alloc_packet2(avctx, pkt, 1024, 0)) < 0) {
436
goto done;
437
}
438
-#endif // OPENJPEG_MAJOR_VERSION == 2
439
440
compress = opj_create_compress(ctx->format);
441
if (!compress) {
442
443
goto done;
444
}
445
446
-#if OPENJPEG_MAJOR_VERSION == 1
447
- opj_setup_encoder(compress, &ctx->enc_params, image);
448
- stream = opj_cio_open((opj_common_ptr) compress, NULL, 0);
449
-#else // OPENJPEG_MAJOR_VERSION == 2
450
if (!opj_set_error_handler(compress, error_callback, avctx) ||
451
!opj_set_warning_handler(compress, warning_callback, avctx) ||
452
!opj_set_info_handler(compress, info_callback, avctx)) {
453
454
goto done;
455
}
456
stream = opj_stream_default_create(OPJ_STREAM_WRITE);
457
-#endif // OPENJPEG_MAJOR_VERSION == 1
458
459
if (!stream) {
460
av_log(avctx, AV_LOG_ERROR, "Error creating the cio stream\n");
461
ret = AVERROR(ENOMEM);
462
goto done;
463
}
464
-#if OPENJPEG_MAJOR_VERSION == 1
465
- memset(&ctx->event_mgr, 0, sizeof(ctx->event_mgr));
466
- ctx->event_mgr.info_handler = info_callback;
467
- ctx->event_mgr.error_handler = error_callback;
468
- ctx->event_mgr.warning_handler = warning_callback;
469
- opj_set_event_mgr((opj_common_ptr) compress, &ctx->event_mgr, avctx);
470
- if (!opj_encode(compress, stream, image, NULL)) {
471
- av_log(avctx, AV_LOG_ERROR, "Error during the opj encode\n");
472
- ret = AVERROR_EXTERNAL;
473
- goto done;
474
- }
475
476
- len = cio_tell(stream);
477
- if ((ret = ff_alloc_packet2(avctx, pkt, len, 0)) < 0) {
478
- goto done;
479
- }
480
-
481
- memcpy(pkt->data, stream->buffer, len);
482
-#else // OPENJPEG_MAJOR_VERSION == 2
483
writer.packet = pkt;
484
opj_stream_set_write_function(stream, stream_write);
485
opj_stream_set_skip_function(stream, stream_skip);
486
opj_stream_set_seek_function(stream, stream_seek);
487
-#if HAVE_OPENJPEG_2_3_OPENJPEG_H || HAVE_OPENJPEG_2_2_OPENJPEG_H || HAVE_OPENJPEG_2_1_OPENJPEG_H
488
opj_stream_set_user_data(stream, &writer, NULL);
489
-#elif HAVE_OPENJPEG_2_0_OPENJPEG_H
490
- opj_stream_set_user_data(stream, &writer);
491
-#else
492
-#error Missing call to opj_stream_set_user_data
493
-#endif
494
495
if (!opj_start_compress(compress, image, stream) ||
496
!opj_encode(compress, stream) ||
497
498
}
499
500
av_shrink_packet(pkt, writer.pos);
501
-#endif // OPENJPEG_MAJOR_VERSION == 1
502
503
pkt->flags |= AV_PKT_FLAG_KEY;
504
*got_packet = 1;
505
ret = 0;
506
507
done:
508
-#if OPENJPEG_MAJOR_VERSION == 2
509
opj_stream_destroy(stream);
510
opj_destroy_codec(compress);
511
opj_image_destroy(image);
512
-#else
513
- opj_cio_close(stream);
514
- opj_destroy_compress(compress);
515
-#endif
516
return ret;
517
}
518
519
-static av_cold int libopenjpeg_encode_close(AVCodecContext *avctx)
520
-{
521
-#if OPENJPEG_MAJOR_VERSION == 1
522
- LibOpenJPEGContext *ctx = avctx->priv_data;
523
-
524
- opj_image_destroy(ctx->image);
525
- ctx->image = NULL;
526
-#endif // OPENJPEG_MAJOR_VERSION == 1
527
- return 0;
528
-}
529
-
530
#define OFFSET(x) offsetof(LibOpenJPEGContext, x)
531
#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
532
static const AVOption options[] = {
533
- { "format", "Codec Format", OFFSET(format), AV_OPT_TYPE_INT, { .i64 = OPJ(CODEC_JP2) }, OPJ(CODEC_J2K), OPJ(CODEC_JP2), VE, "format" },
534
- { "j2k", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ(CODEC_J2K) }, 0, 0, VE, "format" },
535
- { "jp2", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ(CODEC_JP2) }, 0, 0, VE, "format" },
536
- { "profile", NULL, OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = OPJ(STD_RSIZ) }, OPJ(STD_RSIZ), OPJ(CINEMA4K), VE, "profile" },
537
- { "jpeg2000", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ(STD_RSIZ) }, 0, 0, VE, "profile" },
538
- { "cinema2k", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ(CINEMA2K) }, 0, 0, VE, "profile" },
539
- { "cinema4k", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ(CINEMA4K) }, 0, 0, VE, "profile" },
540
- { "cinema_mode", "Digital Cinema", OFFSET(cinema_mode), AV_OPT_TYPE_INT, { .i64 = OPJ(OFF) }, OPJ(OFF), OPJ(CINEMA4K_24), VE, "cinema_mode" },
541
- { "off", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ(OFF) }, 0, 0, VE, "cinema_mode" },
542
- { "2k_24", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ(CINEMA2K_24) }, 0, 0, VE, "cinema_mode" },
543
- { "2k_48", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ(CINEMA2K_48) }, 0, 0, VE, "cinema_mode" },
544
- { "4k_24", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ(CINEMA4K_24) }, 0, 0, VE, "cinema_mode" },
545
- { "prog_order", "Progression Order", OFFSET(prog_order), AV_OPT_TYPE_INT, { .i64 = OPJ(LRCP) }, OPJ(LRCP), OPJ(CPRL), VE, "prog_order" },
546
- { "lrcp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ(LRCP) }, 0, 0, VE, "prog_order" },
547
- { "rlcp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ(RLCP) }, 0, 0, VE, "prog_order" },
548
- { "rpcl", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ(RPCL) }, 0, 0, VE, "prog_order" },
549
- { "pcrl", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ(PCRL) }, 0, 0, VE, "prog_order" },
550
- { "cprl", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ(CPRL) }, 0, 0, VE, "prog_order" },
551
+ { "format", "Codec Format", OFFSET(format), AV_OPT_TYPE_INT, { .i64 = OPJ_CODEC_JP2 }, OPJ_CODEC_J2K, OPJ_CODEC_JP2, VE, "format" },
552
+ { "j2k", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ_CODEC_J2K }, 0, 0, VE, "format" },
553
+ { "jp2", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ_CODEC_JP2 }, 0, 0, VE, "format" },
554
+ { "profile", NULL, OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = OPJ_STD_RSIZ }, OPJ_STD_RSIZ, OPJ_CINEMA4K, VE, "profile" },
555
+ { "jpeg2000", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ_STD_RSIZ }, 0, 0, VE, "profile" },
556
+ { "cinema2k", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ_CINEMA2K }, 0, 0, VE, "profile" },
557
+ { "cinema4k", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ_CINEMA4K }, 0, 0, VE, "profile" },
558
+ { "cinema_mode", "Digital Cinema", OFFSET(cinema_mode), AV_OPT_TYPE_INT, { .i64 = OPJ_OFF }, OPJ_OFF, OPJ_CINEMA4K_24, VE, "cinema_mode" },
559
+ { "off", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ_OFF }, 0, 0, VE, "cinema_mode" },
560
+ { "2k_24", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ_CINEMA2K_24 }, 0, 0, VE, "cinema_mode" },
561
+ { "2k_48", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ_CINEMA2K_48 }, 0, 0, VE, "cinema_mode" },
562
+ { "4k_24", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ_CINEMA4K_24 }, 0, 0, VE, "cinema_mode" },
563
+ { "prog_order", "Progression Order", OFFSET(prog_order), AV_OPT_TYPE_INT, { .i64 = OPJ_LRCP }, OPJ_LRCP, OPJ_CPRL, VE, "prog_order" },
564
+ { "lrcp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ_LRCP }, 0, 0, VE, "prog_order" },
565
+ { "rlcp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ_RLCP }, 0, 0, VE, "prog_order" },
566
+ { "rpcl", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ_RPCL }, 0, 0, VE, "prog_order" },
567
+ { "pcrl", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ_PCRL }, 0, 0, VE, "prog_order" },
568
+ { "cprl", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ_CPRL }, 0, 0, VE, "prog_order" },
569
{ "numresolution", NULL, OFFSET(numresolution), AV_OPT_TYPE_INT, { .i64 = 6 }, 0, 33, VE },
570
{ "irreversible", NULL, OFFSET(irreversible), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },
571
{ "disto_alloc", NULL, OFFSET(disto_alloc), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, VE },
572
573
.priv_data_size = sizeof(LibOpenJPEGContext),
574
.init = libopenjpeg_encode_init,
575
.encode2 = libopenjpeg_encode_frame,
576
- .close = libopenjpeg_encode_close,
577
.capabilities = AV_CODEC_CAP_FRAME_THREADS | AV_CODEC_CAP_INTRA_ONLY,
578
.pix_fmts = (const enum AVPixelFormat[]) {
579
AV_PIX_FMT_RGB24, AV_PIX_FMT_RGBA, AV_PIX_FMT_RGB48,
580