summaryrefslogtreecommitdiff
path: root/modules/avcodec
diff options
context:
space:
mode:
Diffstat (limited to 'modules/avcodec')
-rw-r--r--modules/avcodec/avcodec.c14
-rw-r--r--modules/avcodec/avcodec.h10
-rw-r--r--modules/avcodec/decode.c4
-rw-r--r--modules/avcodec/encode.c18
4 files changed, 26 insertions, 20 deletions
diff --git a/modules/avcodec/avcodec.c b/modules/avcodec/avcodec.c
index d6ce3de..1fb1415 100644
--- a/modules/avcodec/avcodec.c
+++ b/modules/avcodec/avcodec.c
@@ -17,13 +17,13 @@
int avcodec_resolve_codecid(const char *s)
{
if (0 == str_casecmp(s, "H263"))
- return CODEC_ID_H263;
+ return AV_CODEC_ID_H263;
else if (0 == str_casecmp(s, "H264"))
- return CODEC_ID_H264;
+ return AV_CODEC_ID_H264;
else if (0 == str_casecmp(s, "MP4V-ES"))
- return CODEC_ID_MPEG4;
+ return AV_CODEC_ID_MPEG4;
else
- return CODEC_ID_NONE;
+ return AV_CODEC_ID_NONE;
}
@@ -145,13 +145,13 @@ static int module_init(void)
avcodec_register_all();
- if (avcodec_find_decoder(CODEC_ID_H264))
+ if (avcodec_find_decoder(AV_CODEC_ID_H264))
vidcodec_register(&h264);
- if (avcodec_find_decoder(CODEC_ID_H263))
+ if (avcodec_find_decoder(AV_CODEC_ID_H263))
vidcodec_register(&h263);
- if (avcodec_find_decoder(CODEC_ID_MPEG4))
+ if (avcodec_find_decoder(AV_CODEC_ID_MPEG4))
vidcodec_register(&mpg4);
return 0;
diff --git a/modules/avcodec/avcodec.h b/modules/avcodec/avcodec.h
index bbd022a..1d91b27 100644
--- a/modules/avcodec/avcodec.h
+++ b/modules/avcodec/avcodec.h
@@ -5,8 +5,14 @@
*/
-#if LIBAVCODEC_VERSION_INT >= ((54<<16)+(25<<8)+0)
-#define CodecID AVCodecID
+#if LIBAVCODEC_VERSION_INT < ((54<<16)+(25<<8)+0)
+#define AVCodecID CodecID
+
+#define AV_CODEC_ID_NONE CODEC_ID_NONE
+#define AV_CODEC_ID_H263 CODEC_ID_H263
+#define AV_CODEC_ID_H264 CODEC_ID_H264
+#define AV_CODEC_ID_MPEG4 CODEC_ID_MPEG4
+
#endif
diff --git a/modules/avcodec/decode.c b/modules/avcodec/decode.c
index 36550a7..289d5a8 100644
--- a/modules/avcodec/decode.c
+++ b/modules/avcodec/decode.c
@@ -40,10 +40,10 @@ static void destructor(void *arg)
static int init_decoder(struct viddec_state *st, const char *name)
{
- enum CodecID codec_id;
+ enum AVCodecID codec_id;
codec_id = avcodec_resolve_codecid(name);
- if (codec_id == CODEC_ID_NONE)
+ if (codec_id == AV_CODEC_ID_NONE)
return EINVAL;
st->codec = avcodec_find_decoder(codec_id);
diff --git a/modules/avcodec/encode.c b/modules/avcodec/encode.c
index 559c53e..adbec93 100644
--- a/modules/avcodec/encode.c
+++ b/modules/avcodec/encode.c
@@ -36,7 +36,7 @@ struct videnc_state {
struct mbuf *mb_frag;
struct videnc_param encprm;
struct vidsz encsize;
- enum CodecID codec_id;
+ enum AVCodecID codec_id;
union {
struct {
@@ -174,7 +174,7 @@ static int open_encoder(struct videnc_state *st,
st->ctx->time_base.den = prm->fps;
/* params to avoid ffmpeg/x264 default preset error */
- if (st->codec_id == CODEC_ID_H264) {
+ if (st->codec_id == AV_CODEC_ID_H264) {
st->ctx->me_method = ME_UMH;
st->ctx->me_range = 16;
st->ctx->qmin = 10;
@@ -256,9 +256,9 @@ static void param_handler(const struct pl *name, const struct pl *val,
{
struct videnc_state *st = arg;
- if (st->codec_id == CODEC_ID_H263)
+ if (st->codec_id == AV_CODEC_ID_H263)
(void)decode_sdpparam_h263(st, name, val);
- else if (st->codec_id == CODEC_ID_H264)
+ else if (st->codec_id == AV_CODEC_ID_H264)
(void)decode_sdpparam_h264(st, name, val);
}
@@ -426,7 +426,7 @@ int encode_update(struct videnc_state **vesp, const struct vidcodec *vc,
st->encprm = *prm;
st->codec_id = avcodec_resolve_codecid(vc->name);
- if (st->codec_id == CODEC_ID_NONE) {
+ if (st->codec_id == AV_CODEC_ID_NONE) {
err = EINVAL;
goto out;
}
@@ -440,7 +440,7 @@ int encode_update(struct videnc_state **vesp, const struct vidcodec *vc,
st->sz_max = st->mb->size;
- if (st->codec_id == CODEC_ID_H264) {
+ if (st->codec_id == AV_CODEC_ID_H264) {
#ifndef USE_X264
err = init_encoder(st);
#endif
@@ -625,15 +625,15 @@ int encode(struct videnc_state *st, bool update, const struct vidframe *frame,
switch (st->codec_id) {
- case CODEC_ID_H263:
+ case AV_CODEC_ID_H263:
err = h263_packetize(st, st->mb, pkth, arg);
break;
- case CODEC_ID_H264:
+ case AV_CODEC_ID_H264:
err = h264_packetize(st->mb, st->encprm.pktsize, pkth, arg);
break;
- case CODEC_ID_MPEG4:
+ case AV_CODEC_ID_MPEG4:
err = general_packetize(st->mb, st->encprm.pktsize, pkth, arg);
break;