From: kt920.kim Date: Thu, 8 Dec 2011 10:20:52 +0000 (+0900) Subject: [Title] Add some libraries which are dependent with ffmpeg static library. X-Git-Tag: TizenStudio_2.0_p2.3~1694^2~180^2^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bad633e020fb07ce06fc2df6369d87334a93a458;p=sdk%2Femulator%2Fqemu.git [Title] Add some libraries which are dependent with ffmpeg static library. [Type] bug fix [Module] codec & qemu build [Priority] [CQ#] [Redmine#] [Problem] [Cause] [Solution] [TestCase] --- diff --git a/.gitignore b/.gitignore index 247739c..5cf2758 100644 --- a/.gitignore +++ b/.gitignore @@ -83,3 +83,34 @@ tizen/src/Makefile tags tizen/tags tizen/src/tags +/tizen/distrib/ffmpeg/shared/libavcodec.a +/tizen/distrib/ffmpeg/shared/libavcodec.so +/tizen/distrib/ffmpeg/shared/libavcodec.so.52 +/tizen/distrib/ffmpeg/shared/libavcodec.so.52.72.2 +/tizen/distrib/ffmpeg/shared/libavdevice.a +/tizen/distrib/ffmpeg/shared/libavdevice.so +/tizen/distrib/ffmpeg/shared/libavdevice.so.52 +/tizen/distrib/ffmpeg/shared/libavdevice.so.52.2.0 +/tizen/distrib/ffmpeg/shared/libavfilter.a +/tizen/distrib/ffmpeg/shared/libavfilter.so +/tizen/distrib/ffmpeg/shared/libavfilter.so.1 +/tizen/distrib/ffmpeg/shared/libavfilter.so.1.19.0 +/tizen/distrib/ffmpeg/shared/libavformat.a +/tizen/distrib/ffmpeg/shared/libavformat.so +/tizen/distrib/ffmpeg/shared/libavformat.so.52 +/tizen/distrib/ffmpeg/shared/libavformat.so.52.64.2 +/tizen/distrib/ffmpeg/shared/libavutil.a +/tizen/distrib/ffmpeg/shared/libavutil.so +/tizen/distrib/ffmpeg/shared/libavutil.so.50 +/tizen/distrib/ffmpeg/shared/libavutil.so.50.15.1 +/tizen/distrib/ffmpeg/shared/libswscale.a +/tizen/distrib/ffmpeg/shared/libswscale.so +/tizen/distrib/ffmpeg/shared/libswscale.so.0 +/tizen/distrib/ffmpeg/shared/libswscale.so.0.11.0 +/tizen/distrib/ffmpeg/shared/pkgconfig/libavcodec.pc +/tizen/distrib/ffmpeg/shared/pkgconfig/libavdevice.pc +/tizen/distrib/ffmpeg/shared/pkgconfig/libavfilter.pc +/tizen/distrib/ffmpeg/shared/pkgconfig/libavformat.pc +/tizen/distrib/ffmpeg/shared/pkgconfig/libavutil.pc +/tizen/distrib/ffmpeg/shared/pkgconfig/libswscale.pc +/tizen/aa diff --git a/configure b/configure index b74a994..fdbe3d9 100755 --- a/configure +++ b/configure @@ -1404,7 +1404,7 @@ int main(void) { AVFormatContext *pFormatCtx = NULL; av_find_stream_info(pFormat EOF ffmpeg_cflags="-I$source_path/tizen/$ffmpeg_inc/include" if test "$linux" = "yes" ; then - ffmpeg_libs="-lavformat -lavcodec -lavutil" + ffmpeg_libs="-lavformat -lavcodec -lavutil -lm -lpthread -lz" elif test "$mingw32" = "yes" ; then ffmpeg_libs="-lavformat.dll -lavcodec.dll -lavutil.dll" fi @@ -1416,6 +1416,7 @@ EOF else if test "$ffmpeg" = "yes" ; then feature_not_found "ffmpeg" + exit 1; fi ffmpeg=no fi diff --git a/qemu_configure.sh b/qemu_configure.sh index 5a23c63..47957eb 100755 --- a/qemu_configure.sh +++ b/qemu_configure.sh @@ -12,9 +12,8 @@ exec ./configure \ --enable-mixemu \ --disable-vnc-tls \ --enable-tcg-x86-opt \ - --enable-v4l2 -# --extra-ldflags="-Xlinker -rpath -Xlinker ./lib" -# --enable-ffmpeg + --enable-v4l2 \ + --enable-ffmpeg # --enable-debug \ # --enable-profiler \ # --enable-gles2 --gles2dir=/usr diff --git a/tizen/distrib/ffmpeg/lib/libavdevice.a b/tizen/distrib/ffmpeg/lib/libavdevice.a index 3c8a144..d27ba03 100644 Binary files a/tizen/distrib/ffmpeg/lib/libavdevice.a and b/tizen/distrib/ffmpeg/lib/libavdevice.a differ diff --git a/tizen/distrib/ffmpeg/lib/libavfilter.a b/tizen/distrib/ffmpeg/lib/libavfilter.a index c846f7d..fc14f38 100644 Binary files a/tizen/distrib/ffmpeg/lib/libavfilter.a and b/tizen/distrib/ffmpeg/lib/libavfilter.a differ diff --git a/tizen/distrib/ffmpeg/lib/libavutil.a b/tizen/distrib/ffmpeg/lib/libavutil.a index 2885e45..f6d6ef3 100644 Binary files a/tizen/distrib/ffmpeg/lib/libavutil.a and b/tizen/distrib/ffmpeg/lib/libavutil.a differ diff --git a/tizen/hw/tizen-codec.c b/tizen/hw/tizen-codec.c index c70fbb3..0c9cacc 100644 --- a/tizen/hw/tizen-codec.c +++ b/tizen/hw/tizen-codec.c @@ -21,8 +21,6 @@ #define SVCODEC_MEM_SIZE (4 * 1024 * 1024) #define SVCODEC_REG_SIZE (256) -#define CODEC_THREAD - /* define debug channel */ MULTI_DEBUG_CHANNEL(qemu, svcodec); @@ -34,8 +32,6 @@ enum { COPY_RESULT_DATA = 0x10, }; -static int codec_operate(uint32_t value, SVCodecState *opaque); - SVCodecParam *target_param; static int thread_cnt = 0; @@ -314,7 +310,7 @@ int qemu_avcodec_decode_video (SVCodecState *s) avctx = gAVCtx; picture = gFrame; - if (avctx == NULL | picture == NULL) { + if (avctx == NULL || picture == NULL) { ERR("AVCodecContext or AVFrame is NULL!! avctx:0x%x, picture:0x%x\n", avctx, picture); return -1; } @@ -437,13 +433,17 @@ int qemu_avcodec_encode_video (SVCodecState *s) ERR("Failed to copy AVFrame\n"); } - ret = avpicture_fill(pict, inputBuf, avctx->pix_fmt, avctx->width, avctx->height); + ret = avpicture_fill((AVPicture*)pict, inputBuf, avctx->pix_fmt, + avctx->width, avctx->height); if (ret < 0) { ERR("after avpicture_fill, ret:%d\n", ret); } - TRACE("before encode video, ticks_per_frame:%d, pts:%d\n", avctx->ticks_per_frame, pict->pts); + TRACE("before encode video, ticks_per_frame:%d, pts:%d\n", + avctx->ticks_per_frame, pict->pts); + ret = avcodec_encode_video (avctx, outputBuf, outputBufSize, pict); + if (ret < 0) { ERR("Failed to encode video, ret:%d, pts:%d\n", ret, pict->pts); } @@ -538,223 +538,6 @@ void qemu_av_parser_close (void) // av_parser_close(s); } - -#if 0 - -/* - * THEORA API - */ - -th_dec_ctx * _gDec; -th_info* _gInfo; -th_setup_info* _gSetup; -th_comment* _gTC; - -/* int th_decode_ctl (th_dec_ctx* _dec, int _req, - * void* _buf, size_t _buf_sz) - */ -int qemu_th_decode_ctl (void) - -{ - th_dec_ctx* dec; - int req; - void* buf; - size_t buf_size; - int ret; - - TRACE("Enter\n"); - - if (_gDec) { - dec = _gDec; - } else { - ERR("Failed to get th_dec_ctx pointer\n"); - } - cpu_memory_rw_debug(cpu_single_env, target_param->in_args[1], &req, sizeof(int), 0); - cpu_memory_rw_debug(cpu_single_env, target_param->in_args[3], &buf_size, sizeof(size_t), 0); - if (buf_size > 0) { - buf = malloc(buf_size); - cpu_memory_rw_debug(cpu_single_env, target_param->in_args[2], buf, buf_size, 0); - } - ret = th_decode_ctl(dec, req, buf, buf_size); - -// cpu_meory_rw_debug(cpu_single_env, target_param->in_args[0], dec, sizeof(th_dec_ctx), 1); - - _gDec = dec; - - TRACE("Leave : ret(%d)\n", ret); - return ret; -} - -/* th_dec_ctx* th_decode_alloc (const th_info* _info, - * const th_setup_info* _setup) - */ -th_dec_ctx* qemu_th_decode_alloc (void) -{ - th_info info; - th_setup_info* setup; - th_dec_ctx *ctx; - - TRACE("Enter\n"); - - if (_gSetup) { - setup = _gSetup; - } - - cpu_memory_rw_debug(cpu_single_env, target_param->in_args[0], &info, sizeof(th_info), 0); - - ctx = th_decode_alloc(&info, setup); - if (ctx) { - _gDec = ctx; - } else { - ERR("Failed to alloc theora decoder\n"); - } - - TRACE("Leave\n"); - - return ctx; -} - -/* int th_decode_headerin (th_info* _info, th_comment* _tc, - * th_setup_info** _setup, ogg_packet* _op) - */ -int qemu_th_decode_headerin (void) -{ - th_info info; - th_comment tc; - th_setup_info *setup; - ogg_packet op; - long bytes; - char *packet; - int ret; - - TRACE("Enter\n"); - -// setup = _gSetup; - cpu_memory_rw_debug(cpu_single_env, target_param->in_args[0], &info, sizeof(th_info), 0); - cpu_memory_rw_debug(cpu_single_env, target_param->in_args[1], &tc, sizeof(th_comment), 0); - cpu_memory_rw_debug(cpu_single_env, target_param->in_args[3], &op, sizeof(ogg_packet), 0); - bytes = op.bytes; - if (bytes > 0) { - packet = (char*)malloc(bytes * sizeof(char)); - cpu_memory_rw_debug(cpu_single_env, target_param->in_args[4], packet, bytes, 0); - } - op.packet = packet; - ret = th_decode_headerin(&info, &tc, &setup, &op); - _gSetup = setup; - - cpu_memory_rw_debug(cpu_single_env, target_param->in_args[0], &info, sizeof(th_info), 1); - cpu_memory_rw_debug(cpu_single_env, target_param->in_args[1], &tc, sizeof(th_comment), 1); -// cpu_memory_rw_debug(cpu_single_env, target_param->in_args[2], setup, sizeof(th_setup_info), 1); - - free(packet); - - TRACE("Leave : ret(%d)\n", ret); - return ret; -} - -/* int th_decode_packetin (th_dec_ctx* _dec, - * const ogg_packet* _op, - * ogg_int64_t* _granpos) - */ -int qemu_th_decode_packetin (void) -{ - th_dec_ctx* dec; - ogg_packet op; - ogg_int64_t granpos; - char *packet; - long bytes; - int ret; - - TRACE("Enter\n"); - - if (_gDec) { - dec = _gDec; - } - cpu_memory_rw_debug(cpu_single_env, target_param->in_args[1], &op, sizeof(ogg_packet), 0); - cpu_memory_rw_debug(cpu_single_env, target_param->in_args[3], &granpos, sizeof(ogg_int64_t), 0); - bytes = op.bytes; - if (bytes > 0) { - packet = (char*)malloc(bytes * sizeof(char)); - cpu_memory_rw_debug(cpu_single_env, target_param->in_args[2], packet, bytes, 0); - } - op.packet = packet; - - ret = th_decode_packetin(dec, &op, &granpos); - - TRACE("Leave : ret(%d)\n", ret); - return ret; -} - -/* int th_decode_ycbcr_out (th_dec_ctx* _dec, - * th_ycbcr_buffer _ycbcr) - */ -int qemu_th_decode_ycbcr_out (void) -{ - th_dec_ctx* dec; - th_ycbcr_buffer ycbcr; - int ret, size; - - TRACE("Enter\n"); - - if (_gDec) { - dec = _gDec; - } - size = sizeof(th_dec_ctx); - ret = th_decode_ycbcr_out(dec, ycbcr); - - TRACE("Leave : ret(%d)\n", ret); - return ret; -} - -/* void th_info_clear (th_info* _info) */ -void qemu_th_info_clear (void) -{ - th_info* info; - - TRACE("Enter\n"); - - th_info_clear(info); - - TRACE("Leave\n"); -} - -/* void th_comment_clear (th_comment* _tc) */ -void qemu_th_comment_clear (void) -{ - th_comment* tc; - - TRACE("Enter\n"); - - th_comment_clear(tc); - - TRACE("Leave\n"); -} - -/* void th_setup_free (th_setup_info* _setup) */ -void qemu_th_setup_free (void) -{ - th_setup_info* setup; - - TRACE("Enter\n"); - - th_setup_free(setup); - - TRACE("Leave\n"); -} - -/* void th_decode_free (th_dec_ctx* _dec) */ -void qemu_th_decode_free (void) -{ - th_dec_ctx* dec; - - TRACE("Enter\n"); - - th_decode_free(dec); - - TRACE("Leave\n"); -} -#endif - static int abcd = 0; static int codec_operate (uint32_t apiIndex, SVCodecState *state) @@ -856,32 +639,8 @@ static int codec_operate (uint32_t apiIndex, SVCodecState *state) } /* - * Virtual Codec Device Define + * Codec Device APIs */ -static int codec_copy_info (SVCodecState *s) -{ - int i = 0; - int paramSize = 0; - uint8_t paramMax; - - if (!s) { - ERR("SVCodecState is NULL\n"); - return -1; - } - - paramMax = s->codecInfo.num; - - for (; i < paramMax; i++) { - memcpy((uint8_t*)s->vaddr + paramSize, - s->codecInfo.param[i], - s->codecInfo.param_size[i]); - paramSize += s->codecInfo.param_size[i]; - } - - - return 0; -} - static uint32_t codec_read (void *opaque, target_phys_addr_t addr) { int ret = -1; @@ -920,9 +679,11 @@ static void codec_write (void *opaque, target_phys_addr_t addr, uint32_t value) case RET_STR: target_param->ret_args = value; case COPY_RESULT_DATA: - codec_copy_info (state); +#ifndef CODEC_THREAD + codec_copy_info(state); sleep_codec_wrkthread(state); qemu_irq_lower(state->dev.irq[1]); +#endif break; } } @@ -955,7 +716,33 @@ static void codec_mmio_map (PCIDevice *dev, int region_num, s->mmio_addr = addr; } -void wake_codec_wrkthread(SVCodecState *s) +#ifndef CODEC_THREAD +static int codec_copy_info (SVCodecState *s) +{ + int i = 0; + int paramSize = 0; + uint8_t paramMax; + + if (!s) { + ERR("SVCodecState is NULL\n"); + return -1; + } + + paramMax = s->codecInfo.num; + + for (; i < paramMax; i++) { + memcpy((uint8_t*)s->vaddr + paramSize, + (uint8_t*)s->codecInfo.param[i], + s->codecInfo.param_size[i]); + paramSize += s->codecInfo.param_size[i]; + } + + + return 0; +} + + +static void wake_codec_wrkthread(SVCodecState *s) { pthread_mutex_lock(&s->thInfo.lock); s->bstart = true; @@ -967,7 +754,7 @@ void wake_codec_wrkthread(SVCodecState *s) pthread_mutex_unlock(&s->thInfo.lock); } -void sleep_codec_wrkthread(SVCodecState *s) +static void sleep_codec_wrkthread(SVCodecState *s) { pthread_mutex_lock(&s->thInfo.lock); s->bstart = false; @@ -999,7 +786,7 @@ static int codec_thread_init(void *opaque) return ret; } -void codec_thread_destroy(void *opaque) +static void codec_thread_destroy(void *opaque) { SVCodecState *s = (SVCodecState*)opaque; @@ -1031,6 +818,7 @@ static void* codec_worker_thread(void *opaque) // pthread_exit(NULL); } +#endif static int codec_initfn (PCIDevice *dev) { diff --git a/tizen/hw/tizen-codec.h b/tizen/hw/tizen-codec.h index d39afae..43c106b 100644 --- a/tizen/hw/tizen-codec.h +++ b/tizen/hw/tizen-codec.h @@ -9,13 +9,7 @@ #include #include -#if 0 -#include -#include -#include -#include "decint.h" -#endif - +#define CODEC_THREAD /* * Codec Device Structures */ @@ -57,12 +51,27 @@ typedef struct _SVCodecState { } SVCodecState; /* + * Codec Device APIs + */ + +int pci_codec_init (PCIBus *bus); +static int codec_operate(uint32_t value, SVCodecState *opaque); + + +/* * Codec Helper APIs */ +void codec_set_context (AVCodecContext *dstctx, + AVCodecContext *srcctx); +#ifndef CODEC_THREAD +static int codec_copy_info (SVCodecState *s); static int codec_thread_init (void *opaque); static void* codec_worker_thread (void *opaque); - +static void wake_codec_wrkthread(SVCodecState *s); +static void sleep_codec_wrkthread(SVCodecState *s); +static void codec_thread_destroy(void *opaque); +#endif /* * FFMPEG APIs @@ -105,27 +114,6 @@ int qemu_av_parser_parse (void); void qemu_av_parser_close (void); int qemu_avcodec_get_buffer (AVCodecContext *context, AVFrame *picture); -#if 0 -/* - * THEORA APIs - */ - -int qemu_th_decode_ctl (void); - -th_dec_ctx* qemu_th_decode_alloc (void); - -int qemu_th_decode_headerin (void); - -int qemu_th_decode_packetin (void); -int qemu_th_decode_ycbcr_out (void); +void qemu_avcodec_release_buffer (AVCodecContext *context, AVFrame *picture); -void qemu_th_info_clear (void); - -void qemu_th_comment_clear (void); - -void qemu_th_setup_free (void); - -void qemu_th_decode_free (void); - -#endif