diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-07-18 01:27:19 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-07-18 01:27:19 +0200 |
commit | 56ae5926f739bd26a5aa4add98604b7cd3c2d6ca (patch) | |
tree | bd21824c32a6018f28d2e3c2c1d810ad77a3d1c5 /libavcodec | |
parent | d4838675253513504c4e0d0ed92489b3c4e6cf8d (diff) | |
parent | 453c02f971fc7865dea396731accbcd7ab6d3728 (diff) | |
download | ffmpeg-56ae5926f739bd26a5aa4add98604b7cd3c2d6ca.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
libopenjpeg: introduce encoding support
libopenjpeg: rename decoder source file.
RTMPTS protocol support
RTMPS protocol support
avconv: print an error message when demuxing fails.
tscc2: DCT output should not be clipped
rtmp: Rename rtmphttp to ffrtmphttp
Conflicts:
Changelog
configure
doc/general.texi
libavcodec/libopenjpegenc.c
libavcodec/version.h
libavformat/version.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/libopenjpegenc.c | 46 | ||||
-rw-r--r-- | libavcodec/tscc2.c | 2 | ||||
-rw-r--r-- | libavcodec/version.h | 2 |
3 files changed, 33 insertions, 17 deletions
diff --git a/libavcodec/libopenjpegenc.c b/libavcodec/libopenjpegenc.c index 96cca283b8..bd741df985 100644 --- a/libavcodec/libopenjpegenc.c +++ b/libavcodec/libopenjpegenc.c @@ -24,14 +24,15 @@ * JPEG 2000 encoder using libopenjpeg */ +#define OPJ_STATIC +#include <openjpeg.h> + #include "libavutil/opt.h" #include "libavutil/imgutils.h" #include "libavutil/avassert.h" #include "avcodec.h" #include "libavutil/intreadwrite.h" #include "internal.h" -#define OPJ_STATIC -#include <openjpeg.h> typedef struct { AVClass *avclass; @@ -41,8 +42,8 @@ typedef struct { opj_event_mgr_t event_mgr; int format; int profile; - int cinema_mode; int prog_order; + int cinema_mode; int numresolution; int numlayers; int disto_alloc; @@ -52,12 +53,17 @@ typedef struct { static void error_callback(const char *msg, void *data) { - av_log((AVCodecContext*)data, AV_LOG_ERROR, "libopenjpeg: %s\n", msg); + av_log(data, AV_LOG_ERROR, "%s\n", msg); } static void warning_callback(const char *msg, void *data) { - av_log((AVCodecContext*)data, AV_LOG_WARNING, "libopenjpeg: %s\n", msg); + av_log(data, AV_LOG_WARNING, "%s\n", msg); +} + +static void info_callback(const char *msg, void *data) +{ + av_log(data, AV_LOG_DEBUG, "%s\n", msg); } static opj_image_t *mj2_create_image(AVCodecContext *avctx, opj_cparameters_t *parameters) @@ -116,11 +122,13 @@ static opj_image_t *mj2_create_image(AVCodecContext *avctx, opj_cparameters_t *p color_space = CLRSPC_SYCC; break; default: - av_log(avctx, AV_LOG_ERROR, "The requested pixel format '%s' is not supported\n", av_get_pix_fmt_name(avctx->pix_fmt)); + av_log(avctx, AV_LOG_ERROR, + "The requested pixel format '%s' is not supported\n", + av_get_pix_fmt_name(avctx->pix_fmt)); return NULL; } - cmptparm = av_mallocz(numcomps * sizeof(opj_image_cmptparm_t)); + cmptparm = av_mallocz(numcomps * sizeof(*cmptparm)); if (!cmptparm) { av_log(avctx, AV_LOG_ERROR, "Not enough memory"); return NULL; @@ -143,8 +151,10 @@ static opj_image_t *mj2_create_image(AVCodecContext *avctx, opj_cparameters_t *p static av_cold int libopenjpeg_encode_init(AVCodecContext *avctx) { LibOpenJPEGContext *ctx = avctx->priv_data; + int err = AVERROR(ENOMEM); opj_set_default_encoder_parameters(&ctx->enc_params); + ctx->enc_params.cp_rsiz = ctx->profile; ctx->enc_params.mode = !!avctx->global_quality; ctx->enc_params.cp_cinema = ctx->cinema_mode; @@ -164,26 +174,29 @@ static av_cold int libopenjpeg_encode_init(AVCodecContext *avctx) avctx->coded_frame = avcodec_alloc_frame(); if (!avctx->coded_frame) { - av_freep(&ctx->compress); av_log(avctx, AV_LOG_ERROR, "Error allocating coded frame\n"); - return AVERROR(ENOMEM); + goto fail; } ctx->image = mj2_create_image(avctx, &ctx->enc_params); if (!ctx->image) { - av_freep(&ctx->compress); - av_freep(&avctx->coded_frame); av_log(avctx, AV_LOG_ERROR, "Error creating the mj2 image\n"); - return AVERROR(EINVAL); + err = AVERROR(EINVAL); + goto fail; } memset(&ctx->event_mgr, 0, sizeof(opj_event_mgr_t)); + ctx->event_mgr.info_handler = info_callback; ctx->event_mgr.error_handler = error_callback; ctx->event_mgr.warning_handler = warning_callback; - ctx->event_mgr.info_handler = NULL; opj_set_event_mgr((opj_common_ptr)ctx->compress, &ctx->event_mgr, avctx); return 0; + +fail: + av_freep(&ctx->compress); + av_freep(&avctx->coded_frame); + return err; } static int libopenjpeg_copy_packed8(AVCodecContext *avctx, const AVFrame *frame, opj_image_t *image) @@ -373,13 +386,16 @@ static int libopenjpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt, cpyresult = libopenjpeg_copy_unpacked16(avctx, frame, image); break; default: - av_log(avctx, AV_LOG_ERROR, "The frame's pixel format '%s' is not supported\n", av_get_pix_fmt_name(avctx->pix_fmt)); + av_log(avctx, AV_LOG_ERROR, + "The frame's pixel format '%s' is not supported\n", + av_get_pix_fmt_name(avctx->pix_fmt)); return AVERROR(EINVAL); break; } if (!cpyresult) { - av_log(avctx, AV_LOG_ERROR, "Could not copy the frame data to the internal image buffer\n"); + av_log(avctx, AV_LOG_ERROR, + "Could not copy the frame data to the internal image buffer\n"); return -1; } diff --git a/libavcodec/tscc2.c b/libavcodec/tscc2.c index 5e36a0e307..9c8d2341ce 100644 --- a/libavcodec/tscc2.c +++ b/libavcodec/tscc2.c @@ -95,7 +95,7 @@ static av_cold int init_vlcs(TSCC2Context *c) OP(d3, 5 * ((s0) - (s1) + (s2)) - 2 * (s3)); \ #define COL_OP(a, b) a = b -#define ROW_OP(a, b) a = av_clip_uint8((((b) + 0x20) >> 6) + 0x80) +#define ROW_OP(a, b) a = (((b) + 0x20) >> 6) + 0x80 static void tscc2_idct4_put(int *in, int q[3], uint8_t *dst, int stride) { diff --git a/libavcodec/version.h b/libavcodec/version.h index b146635f84..7538125714 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -27,7 +27,7 @@ */ #define LIBAVCODEC_VERSION_MAJOR 54 -#define LIBAVCODEC_VERSION_MINOR 40 +#define LIBAVCODEC_VERSION_MINOR 41 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |