Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2015-12-18 16:27:41 +0300
committerHendrik Leppkes <h.leppkes@gmail.com>2015-12-18 16:27:41 +0300
commit2630f7f709049113dc03d6b999efad6acc423d67 (patch)
treed7a217a844f6b7939d3f08da45c027caa9e6761c /libavcodec/sunrastenc.c
parentec1b95dda4a856ae532a0a27aa6213040e712d68 (diff)
parentbe00ec832c519427cd92218abac77dafdc1d5487 (diff)
Merge commit 'be00ec832c519427cd92218abac77dafdc1d5487'
* commit 'be00ec832c519427cd92218abac77dafdc1d5487': lavc: Deprecate coder_type and its symbols Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
Diffstat (limited to 'libavcodec/sunrastenc.c')
-rw-r--r--libavcodec/sunrastenc.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/libavcodec/sunrastenc.c b/libavcodec/sunrastenc.c
index d83a42dd0f..05db5cfb49 100644
--- a/libavcodec/sunrastenc.c
+++ b/libavcodec/sunrastenc.c
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/opt.h"
+
#include "avcodec.h"
#include "bytestream.h"
#include "internal.h"
@@ -136,6 +138,8 @@ static av_cold int sunrast_encode_init(AVCodecContext *avctx)
{
SUNRASTContext *s = avctx->priv_data;
+#if FF_API_CODER_TYPE
+FF_DISABLE_DEPRECATION_WARNINGS
switch (avctx->coder_type) {
case FF_CODER_TYPE_RLE:
s->type = RT_BYTE_ENCODED;
@@ -147,6 +151,11 @@ static av_cold int sunrast_encode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_ERROR, "invalid coder_type\n");
return AVERROR(EINVAL);
}
+FF_ENABLE_DEPRECATION_WARNINGS
+ if (s->type != RT_BYTE_ENCODED && s->type != RT_STANDARD)
+#endif
+ // adjust boolean option to RT equivalent
+ s->type++;
s->maptype = RMT_NONE;
s->maplength = 0;
@@ -169,8 +178,7 @@ static av_cold int sunrast_encode_init(AVCodecContext *avctx)
return AVERROR_BUG;
}
s->length = avctx->height * (FFALIGN(avctx->width * s->depth, 16) >> 3);
- s->size = 32 + s->maplength +
- s->length * (s->type == RT_BYTE_ENCODED ? 2 : 1);
+ s->size = 32 + s->maplength + s->length * s->type;
return 0;
}
@@ -199,10 +207,27 @@ static int sunrast_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
return 0;
}
+#define OFFSET(x) offsetof(SUNRASTContext, x)
+#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
+static const AVOption options[] = {
+ { "rle", "Use run-length compression", OFFSET(type), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, VE },
+
+ { NULL },
+};
+
+static const AVClass utvideo_class = {
+ .class_name = "sunrast",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+#if FF_API_CODER_TYPE
static const AVCodecDefault sunrast_defaults[] = {
{ "coder", "rle" },
{ NULL },
};
+#endif
AVCodec ff_sunrast_encoder = {
.name = "sunrast",
@@ -212,7 +237,9 @@ AVCodec ff_sunrast_encoder = {
.priv_data_size = sizeof(SUNRASTContext),
.init = sunrast_encode_init,
.encode2 = sunrast_encode_frame,
+#if FF_API_CODER_TYPE
.defaults = sunrast_defaults,
+#endif
.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_BGR24,
AV_PIX_FMT_PAL8,
AV_PIX_FMT_GRAY8,