--- /dev/null
+/*
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_VERSION_H
+#define AVCODEC_VERSION_H
+
+#define LIBAVCODEC_VERSION_MAJOR 53
+#define LIBAVCODEC_VERSION_MINOR 5
+#define LIBAVCODEC_VERSION_MICRO 0
+
+#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
+ LIBAVCODEC_VERSION_MINOR, \
+ LIBAVCODEC_VERSION_MICRO)
+#define LIBAVCODEC_VERSION AV_VERSION(LIBAVCODEC_VERSION_MAJOR, \
+ LIBAVCODEC_VERSION_MINOR, \
+ LIBAVCODEC_VERSION_MICRO)
+#define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT
+
+#define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION)
+
+/**
+ * Those FF_API_* defines are not part of public API.
+ * They may change, break or disappear at any time.
+ */
+#ifndef FF_API_PALETTE_CONTROL
+#define FF_API_PALETTE_CONTROL (LIBAVCODEC_VERSION_MAJOR < 54)
+#endif
+#ifndef FF_API_OLD_SAMPLE_FMT
+#define FF_API_OLD_SAMPLE_FMT (LIBAVCODEC_VERSION_MAJOR < 54)
+#endif
+#ifndef FF_API_OLD_AUDIOCONVERT
+#define FF_API_OLD_AUDIOCONVERT (LIBAVCODEC_VERSION_MAJOR < 54)
+#endif
+#ifndef FF_API_ANTIALIAS_ALGO
+#define FF_API_ANTIALIAS_ALGO (LIBAVCODEC_VERSION_MAJOR < 54)
+#endif
+#ifndef FF_API_REQUEST_CHANNELS
+#define FF_API_REQUEST_CHANNELS (LIBAVCODEC_VERSION_MAJOR < 54)
+#endif
+#ifndef FF_API_OPT_H
+#define FF_API_OPT_H (LIBAVCODEC_VERSION_MAJOR < 54)
+#endif
+#ifndef FF_API_THREAD_INIT
+#define FF_API_THREAD_INIT (LIBAVCODEC_VERSION_MAJOR < 54)
+#endif
+#ifndef FF_API_OLD_FF_PICT_TYPES
+#define FF_API_OLD_FF_PICT_TYPES (LIBAVCODEC_VERSION_MAJOR < 54)
+#endif
+#ifndef FF_API_FLAC_GLOBAL_OPTS
+#define FF_API_FLAC_GLOBAL_OPTS (LIBAVCODEC_VERSION_MAJOR < 54)
+#endif
+#ifndef FF_API_GET_PIX_FMT_NAME
+#define FF_API_GET_PIX_FMT_NAME (LIBAVCODEC_VERSION_MAJOR < 54)
+#endif
+
+#endif /* AVCODEC_VERSION_H */
--- /dev/null
+/*
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_VERSION_H
+#define AVCODEC_VERSION_H
+
+#define LIBAVCODEC_VERSION_MAJOR 53
+#define LIBAVCODEC_VERSION_MINOR 5
+#define LIBAVCODEC_VERSION_MICRO 0
+
+#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
+ LIBAVCODEC_VERSION_MINOR, \
+ LIBAVCODEC_VERSION_MICRO)
+#define LIBAVCODEC_VERSION AV_VERSION(LIBAVCODEC_VERSION_MAJOR, \
+ LIBAVCODEC_VERSION_MINOR, \
+ LIBAVCODEC_VERSION_MICRO)
+#define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT
+
+#define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION)
+
+/**
+ * Those FF_API_* defines are not part of public API.
+ * They may change, break or disappear at any time.
+ */
+#ifndef FF_API_PALETTE_CONTROL
+#define FF_API_PALETTE_CONTROL (LIBAVCODEC_VERSION_MAJOR < 54)
+#endif
+#ifndef FF_API_OLD_SAMPLE_FMT
+#define FF_API_OLD_SAMPLE_FMT (LIBAVCODEC_VERSION_MAJOR < 54)
+#endif
+#ifndef FF_API_OLD_AUDIOCONVERT
+#define FF_API_OLD_AUDIOCONVERT (LIBAVCODEC_VERSION_MAJOR < 54)
+#endif
+#ifndef FF_API_ANTIALIAS_ALGO
+#define FF_API_ANTIALIAS_ALGO (LIBAVCODEC_VERSION_MAJOR < 54)
+#endif
+#ifndef FF_API_REQUEST_CHANNELS
+#define FF_API_REQUEST_CHANNELS (LIBAVCODEC_VERSION_MAJOR < 54)
+#endif
+#ifndef FF_API_OPT_H
+#define FF_API_OPT_H (LIBAVCODEC_VERSION_MAJOR < 54)
+#endif
+#ifndef FF_API_THREAD_INIT
+#define FF_API_THREAD_INIT (LIBAVCODEC_VERSION_MAJOR < 54)
+#endif
+#ifndef FF_API_OLD_FF_PICT_TYPES
+#define FF_API_OLD_FF_PICT_TYPES (LIBAVCODEC_VERSION_MAJOR < 54)
+#endif
+#ifndef FF_API_FLAC_GLOBAL_OPTS
+#define FF_API_FLAC_GLOBAL_OPTS (LIBAVCODEC_VERSION_MAJOR < 54)
+#endif
+#ifndef FF_API_GET_PIX_FMT_NAME
+#define FF_API_GET_PIX_FMT_NAME (LIBAVCODEC_VERSION_MAJOR < 54)
+#endif
+
+#endif /* AVCODEC_VERSION_H */
*/
#include "maru_codec.h"
-#include <pthread.h>
-#define QEMU_DEV_NAME "codec"
-#define MARU_CODEC_VERSION "1.0"
+#define MARU_CODEC_DEV_NAME "codec"
+#define MARU_CODEC_VERSION "1.0"
/* Needs 16M to support 1920x1080 video resolution.
* Output size for encoding has to be greater than (width * height * 6)
#define MARU_ROUND_UP_16(num) (((num) + 15) & ~15)
-#define CODEC_DUMMY
-
/* define debug channel */
MULTI_DEBUG_CHANNEL(qemu, marucodec);
int ctxIndex = 0;
TRACE("[%s] Enter\n", __func__);
-
pthread_mutex_lock(&s->codec_mutex);
for (i = 0; i < CODEC_MAX_CONTEXT; i++) {
break;
}
}
-
TRACE("[%s] Close %d context\n", __func__, ctxIndex);
s->ctxArr[ctxIndex].bUsed = false;
qemu_parser_init(s, ctxIndex);
pthread_mutex_unlock(&s->codec_mutex);
-
TRACE("[%s] Leave\n", __func__);
}
-static void qemu_restore_context (AVCodecContext *dst, AVCodecContext *src) {
+static void qemu_restore_context (AVCodecContext *dst, AVCodecContext *src)
+{
TRACE("[%s] Enter\n", __func__);
dst->av_class = src->av_class;
TRACE("[%s] Leave\n", __func__);
}
+void qemu_get_codec_ver (SVCodecState *s, int ctxIndex)
+{
+ char codec_ver[32];
+ off_t offset;
+
+ offset = s->codecParam.mmapOffset;
+
+ memset(codec_ver, 0x00, 32);
+ strncpy(codec_ver, MARU_CODEC_VERSION, strlen(MARU_CODEC_VERSION));
+ printf("codec_version:%s\n", codec_ver);
+ memcpy((uint8_t*)s->vaddr + offset, codec_ver, 32);
+}
+
/* void av_register_all() */
static void qemu_av_register_all (void)
{
static int qemu_avcodec_open (SVCodecState *s, int ctxIndex)
{
AVCodecContext *avctx;
+#ifndef CODEC_COPY_DATA
AVCodecContext tempCtx;
+#endif
AVCodec *codec;
enum CodecID codec_id;
off_t offset;
TRACE("[%s] Context Index:%d, offset:%d\n", __func__, ctxIndex, offset);
-#ifndef CODEC_DUMMY
+#ifndef CODEC_COPY_DATA
size = sizeof(AVCodecContext);
memcpy(&tempCtx, avctx, size);
memcpy(avctx, (uint8_t*)s->vaddr + offset, size);
avctx->sample_rate, avctx->channels);
}
-#ifndef CODEC_DUMMY
+#ifndef CODEC_COPY_DATA
memcpy((uint8_t*)s->vaddr + offset, avctx, sizeof(AVCodecContext));
memcpy((uint8_t*)s->vaddr + offset + sizeof(AVCodecContext), &ret, sizeof(int));
#else
TRACE("[%s] There is no frame\n", __func__);
}
-#ifndef CODEC_DUMMY
+#ifndef CODEC_COPY_DATA
size = sizeof(AVCodecContext);
memcpy((uint8_t*)s->vaddr + offset, avctx, size);
#else
ret = avcodec_decode_audio3(avctx, samples, &frame_size_ptr, &avpkt);
TRACE("After decoding audio!, ret:%d\n", ret);
-#ifndef CODEC_DUMMY
+#ifndef CODEC_COPY_DATA
size = sizeof(AVCodecContext);
memcpy((uint8_t*)s->vaddr + offset, avctx, size);
#else
}
TRACE("[%s] inbuf : %p, outbuf : %p\n", __func__, inbuf, poutbuf);
-#ifndef CODEC_DUMMY
+#ifndef CODEC_COPY_DATA
// memcpy((uint8_t*)s->vaddr + offset, parserctx, sizeof(AVCodecParserContext));
// size = sizeof(AVCodecParserContext);
memcpy((uint8_t*)s->vaddr + offset, &parserctx->pts, sizeof(int64_t));
}
av_parser_close(parserctx);
pthread_mutex_unlock(&s->codec_mutex);
-
}
static int codec_operate (uint32_t apiIndex, uint32_t ctxIndex, SVCodecState *state)
case EMUL_AV_PARSER_CLOSE:
qemu_av_parser_close(state, ctxIndex);
break;
+ case EMUL_GET_CODEC_VER:
+ qemu_get_codec_ver(state, ctxIndex);
+ break;
default:
WARN("The api index does not exsit!. api index:%d\n", apiIndex);
}
{
switch (addr) {
default:
- ERR("There is no avaiable command for %s\n", QEMU_DEV_NAME);
+ ERR("There is no avaiable command for %s\n", MARU_CODEC_DEV_NAME);
}
return 0;
}
qemu_codec_close(state, value);
break;
default:
- ERR("There is no avaiable command for %s\n", QEMU_DEV_NAME);
+ ERR("There is no avaiable command for %s\n", MARU_CODEC_DEV_NAME);
}
}
int codec_init (PCIBus *bus)
{
INFO("[%s] device create\n", __func__);
- pci_create_simple (bus, -1, QEMU_DEV_NAME);
+ pci_create_simple (bus, -1, MARU_CODEC_DEV_NAME);
return 0;
}
static PCIDeviceInfo codec_info = {
- .qdev.name = QEMU_DEV_NAME,
+ .qdev.name = MARU_CODEC_DEV_NAME,
.qdev.desc = "Virtual Codec device for Tizen emulator",
.qdev.size = sizeof (SVCodecState),
.init = codec_initfn,
#include <libavformat/avformat.h>
#define CODEC_MAX_CONTEXT 10
+#define CODEC_COPY_DATA
/*
* Codec Device Structures
EMUL_AV_PARSER_INIT,
EMUL_AV_PARSER_PARSE,
EMUL_AV_PARSER_CLOSE,
+ EMUL_GET_CODEC_VER = 50,
};