From bad633e020fb07ce06fc2df6369d87334a93a458 Mon Sep 17 00:00:00 2001 From: "kt920.kim" Date: Thu, 8 Dec 2011 19:20:52 +0900 Subject: [PATCH] [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] --- .gitignore | 31 ++++ configure | 3 +- qemu_configure.sh | 5 +- tizen/distrib/ffmpeg/lib/libavdevice.a | Bin 348200 -> 348164 bytes tizen/distrib/ffmpeg/lib/libavfilter.a | Bin 307036 -> 307000 bytes tizen/distrib/ffmpeg/lib/libavutil.a | Bin 298114 -> 298078 bytes tizen/hw/tizen-codec.c | 294 +++++---------------------------- tizen/hw/tizen-codec.h | 48 ++---- 8 files changed, 94 insertions(+), 287 deletions(-) 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 3c8a144db2250b0dd74602aa7973d35aee13429c..d27ba03f087f5c274b4ac34744a44832b75c1f1b 100644 GIT binary patch delta 367 zcmZ3nK(u9n=mc3-V{>Cu%ZW<9ybKJ?9W`Lg;{0J_O(-K!%Fx_mx?CKi_~y5a2j+qK zmJt5Q1p#{@{Ov&b_H9UV+YgE`>8wNuh_RX)o0=(1{>Z4#w18)_6qDTckbO)UY||ed zVVbtR>?qSARz{KOmZzDHGpbByJj3MAIAwa^876H;<>`sB%+j0;P>?@;;Ta}%#yQhZ zf~aHDKZ2+w($$LO*K=Y0#SH*Q?sN12 delta 422 zcmZo!Ai83K=mc3-LrXJLvx!Q+yebUL9Sgvi#YJReO(-L)p}D1j$#l6mM)A#W84t`u z=AT>;uouGL4wP@-h9tNBpa_%BN`!zItEsW2k;3GUjOt8BcqU6R$!!nW$CSY)larZL zl98HUl&GMqo0^xHl#{9p6e`OvO3EyrzUc_lg6$zknGUcrT1*!`&2*g6WBT3GO#X~J zrt6+z(q?p@E~v{WJUt+mnS+x73MNmlJ;S8VcwqWc5cO*MSrBz%`d1KDG+p*Akh(D4 z6+}&%o(rT{OSu^sw5NZZ#3Vd@%~>V^#s$;&f`k_Ug95W)En|{k q+&<|%Q!_InI3%_kU1o~kiVzUrzP5uoVmCrStX;u{WxIk4&^iE_h=c_I diff --git a/tizen/distrib/ffmpeg/lib/libavfilter.a b/tizen/distrib/ffmpeg/lib/libavfilter.a index c846f7de4d440c218f3f47b65537d47df314556a..fc14f3867ae029d5ae4e44e99c2070132467df04 100644 GIT binary patch delta 710 zcmca}PiV(Ip$W3A#^%PRmJ^j)>rEIKc3@&g_6ZC`WB(HjjJR;;5eCK|Z{V28dTyPnZv*m1jKa{OU5z!*5$aIQLI$mB>M zxo2|YTy<83c#xfm4;hs?pQJD_2(U0P$WGtr$|BGDC4+&%0c_r8fq5m2OkWr_x6OYp zffOX0J9aqwL-^Z)L1gR!Vp|wY2eQSt%LXt$utW%mZI|d`UZX zQwfq5iS2cTOwpbY72EIaVv2TxvhDsd@oOP;ifzwOXU+{o2#9b0Siw98$!xLhE4DNL bO+;34P?F_|1&Tlri-ZnDU^_4Y)ENK(l91J$ delta 718 zcmdmSPw37)p$W3AhL&cgW)qcK>mwK#c3@&g_ALxVWB)e{jJR;;3kJrY0&vV^zJ~#f z3w;=vb{%10k^>QcRT!AnEf|<94lpopuV7%2oWQ^m1jKbmCSQ;h+Z@Gsnw8bi+|s~g zvfmD|%?|7f4G~;cVWmSaH7&n0F?wuPv`JuOoUpmccAcI~PG(X`MrwXh zqJpk&YF=VePO2_Ys4TxIDYJO8TF!#aCvvXnFh)$CJM%b`MBe1IS$>QwCU2dk&A4Im z!&%C#H6{!UoYMvE7=h;prEiGYK#r zn0yu}_{^Pw!5$^Vu!FgbRvI;%@O(7x%6noP<}9I2Dn z%~fNS$Yfw}02?xW!9&J|$vN}BFi9|OPMZH*0uoG{{dR==BSLKZ0d_`N4GvrV_>ZD$rvLXw*!$@0_!nIFU=se{D7P{)#C001@t<5&Oy diff --git a/tizen/distrib/ffmpeg/lib/libavutil.a b/tizen/distrib/ffmpeg/lib/libavutil.a index 2885e4514caf086de6f784ae5b1377cb5f61ba7b..f6d6ef3586e1c44c6415e9a54c452fcf85b2c20a 100644 GIT binary patch delta 524 zcmZpgDRgg!&;(glV{>Cu%Z*Bb>>!r0$z+E+;+y-~dH5mR%?rfbLm|vbTO>BKX>`+oyCh z|1XE~LB_3TW;s#}=Zi6$8XHcp4Q141YT%hJP{1s={Z=_k1l#n8I+khM-_)^eVr6wy%L8ONj^vFZETSOgebrk@8%giZerqV%TAw*%!PxhFS7iA|4d2P%k}o(~ja voHBhnh*~gxKak?g5MW?%U}RvBm@esUagLH0k+XPzR>0`l5q`#X}` zr*t#_FNfR1+RKUK%Fft5)>XnIWx%P~#`AqIv5CI$xa$@&rU z)3aJxG&m=SFfed10EMRW8#2qY+ORP&xK7{S%A(BF$UgmoA+y-@U#%9Fuy)rq5~v%CDHd8YEFQ{W3@*hi`tlR(q 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 -- 2.7.4