我现在需要在android2.1中实现一个功能,用Camera来录像,但是这个录像文件在时间上并不是连续的,比如说打开录像文件以后播放的是1点到2点的录像,然后4点到5点的录像,而吧中间2点到4点的录像去掉,应该怎么实现呢?

解决方案 »

  1.   

    mediarecoreder和opencore本身是有录像暂停的接口的,只是没有对应用层开放,你开放下就可以了。
      

  2.   

    opencore本身支持编码暂停,但是在engine以上层没有pause/resume接口,需要自己增加写代码就可一了如果是2.3建议使用stagefright,不许要该任何代码
      

  3.   

    恩。是这样的,我一直添加到authordriver.cpp中,把pause/resumne接口打开了,调用方法跟start/stop一样,void AuthorDriver::handlePause(author_command *ac)
    {
             int error = 0;
        OSCL_TRY(error, mAuthor->Pause(ac));
        OSCL_FIRST_CATCH_ANY(error, commandFailed(ac));
    }void AuthorDriver::handleResume(author_command *ac)
    {
              int error = 0;
        OSCL_TRY(error, mAuthor->Resume(ac));
        OSCL_FIRST_CATCH_ANY(error, commandFailed(ac));
    }
    这样上层调用以后,如果使用了这2个操作以后会出现以下bug:
    I/DEBUG   ( 1917): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    I/DEBUG   ( 1917): Build fingerprint: 'generic/utc100/utc100/:2.1-update1/ERE27/eng.root.20110402.093503:eng/test-keys'
    I/DEBUG   ( 1917): pid: 1919, tid: 2086  >>> /system/bin/mediaserver <<<
    I/DEBUG   ( 1917): signal 11 (SIGSEGV), fault addr deadbaad
    I/DEBUG   ( 1917):  r0 00000000  r1 afe1331d  r2 00000027  r3 00000000
    I/DEBUG   ( 1917):  r4 00000000  r5 deadbaad  r6 00002ed8  r7 00050168
    I/DEBUG   ( 1917):  r8 00100000  r9 a9d1b8e5  10 40c60000  fp 00053e60
    I/DEBUG   ( 1917):  ip ffffffff  sp 40d5fe10  lr afe142dd  pc afe10c48  cpsr 40000030
    I/DEBUG   ( 1917):          #00  pc 00010c48  /system/lib/libc.so
    I/DEBUG   ( 1917):          #01  pc 0000092a  /system/lib/libstdc++.so
    I/DEBUG   ( 1917):          #02  pc 0000092a  /system/lib/libstdc++.so
    I/DEBUG   ( 1917):          #03  pc 00069c50  /system/lib/libopencore_common.so
    I/DEBUG   ( 1917):          #04  pc 0006abb0  /system/lib/libopencore_common.so
    I/DEBUG   ( 1917):          #05  pc 0006b766  /system/lib/libopencore_common.so
    I/DEBUG   ( 1917):          #06  pc 00031e1c  /system/lib/libopencore_author.so
    I/DEBUG   ( 1917):          #07  pc 0002dbe6  /system/lib/libopencore_author.so
    I/DEBUG   ( 1917):          #08  pc 00034678  /system/lib/libopencore_author.so
    I/DEBUG   ( 1917):          #09  pc 0001b94a  /system/lib/libutils.so
    I/DEBUG   ( 1917):          #10  pc 00010000  /system/lib/libc.so
    I/DEBUG   ( 1917):   ---------fimc_release()
    binder: release 1919:1931 transaction 3570 in, still active
    binder: send failed reply for transaction 3570 to 2049:2049
           #11  pc 0000fad4  /system/lib/libc.so
    I/DEBUG   ( 1917): 
    I/DEBUG   ( 1917): code around pc:
    I/DEBUG   ( 1917): afe10c38 4e17d003 51a02001 4d164798 24002227 
    I/DEBUG   ( 1917): afe10c48 f7fb702a 2106ee6a ef1ef7fc 05592380 
    I/DEBUG   ( 1917): afe10c58 6091aa01 1c116054 94012006 eb0cf7fc 
    I/DEBUG   ( 1917): 
    I/DEBUG   ( 1917): code around lr:
    I/DEBUG   ( 1917): afe142cc 220ce008 2b005eab 1c28d003 47889901 
    I/DEBUG   ( 1917): afe142dc 35544306 d5f43f01 2c006824 b
    请问是什么原因呢,急!!!!!!!!!!
      

  4.   

    我一直添加到authordriver.cpp中,把pause/resumne接口打开了,调用方法跟start/stop一样,void AuthorDriver::handlePause(author_command *ac)
    {
      int error = 0;
      OSCL_TRY(error, mAuthor->Pause(ac));
      OSCL_FIRST_CATCH_ANY(error, commandFailed(ac));
    }void AuthorDriver::handleResume(author_command *ac)
    {
      int error = 0;
      OSCL_TRY(error, mAuthor->Resume(ac));
      OSCL_FIRST_CATCH_ANY(error, commandFailed(ac));
    }
    这样上层调用以后,如果使用了这2个操作以后会出现以下bug:
    I/DEBUG ( 1917): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    I/DEBUG ( 1917): Build fingerprint: 'generic/utc100/utc100/:2.1-update1/ERE27/eng.root.20110402.093503:eng/test-keys'
    I/DEBUG ( 1917): pid: 1919, tid: 2086 >>> /system/bin/mediaserver <<<
    I/DEBUG ( 1917): signal 11 (SIGSEGV), fault addr deadbaad
    I/DEBUG ( 1917): r0 00000000 r1 afe1331d r2 00000027 r3 00000000
    I/DEBUG ( 1917): r4 00000000 r5 deadbaad r6 00002ed8 r7 00050168
    I/DEBUG ( 1917): r8 00100000 r9 a9d1b8e5 10 40c60000 fp 00053e60
    I/DEBUG ( 1917): ip ffffffff sp 40d5fe10 lr afe142dd pc afe10c48 cpsr 40000030
    I/DEBUG ( 1917): #00 pc 00010c48 /system/lib/libc.so
    I/DEBUG ( 1917): #01 pc 0000092a /system/lib/libstdc++.so
    I/DEBUG ( 1917): #02 pc 0000092a /system/lib/libstdc++.so
    I/DEBUG ( 1917): #03 pc 00069c50 /system/lib/libopencore_common.so
    I/DEBUG ( 1917): #04 pc 0006abb0 /system/lib/libopencore_common.so
    I/DEBUG ( 1917): #05 pc 0006b766 /system/lib/libopencore_common.so
    I/DEBUG ( 1917): #06 pc 00031e1c /system/lib/libopencore_author.so
    I/DEBUG ( 1917): #07 pc 0002dbe6 /system/lib/libopencore_author.so
    I/DEBUG ( 1917): #08 pc 00034678 /system/lib/libopencore_author.so
    I/DEBUG ( 1917): #09 pc 0001b94a /system/lib/libutils.so
    I/DEBUG ( 1917): #10 pc 00010000 /system/lib/libc.so
    I/DEBUG ( 1917): ---------fimc_release()
    binder: release 1919:1931 transaction 3570 in, still active
    binder: send failed reply for transaction 3570 to 2049:2049
      #11 pc 0000fad4 /system/lib/libc.so
    I/DEBUG ( 1917):  
    I/DEBUG ( 1917): code around pc:
    I/DEBUG ( 1917): afe10c38 4e17d003 51a02001 4d164798 24002227  
    I/DEBUG ( 1917): afe10c48 f7fb702a 2106ee6a ef1ef7fc 05592380  
    I/DEBUG ( 1917): afe10c58 6091aa01 1c116054 94012006 eb0cf7fc  
    I/DEBUG ( 1917):  
    I/DEBUG ( 1917): code around lr:
    I/DEBUG ( 1917): afe142cc 220ce008 2b005eab 1c28d003 47889901  
    I/DEBUG ( 1917): afe142dc 35544306 d5f43f01 2c006824 b
    请问是什么原因呢,急!!!!!!!!!!
      

  5.   

    这个不但要改libopencore_author.so中该代码,还要在framework.jar,libmedia.so,libmedia_jni.so,libmediaplayerservice.so中家代码,你以前做过,不是很难,:-)
      

  6.   

    pc 00069c50 /system/lib/libopencore_common.so你可以自己把libopencore_common.so反汇编以下,看看是崩在什么地方,那个函数。
      

  7.   


    这个我知道,所有的so都加过了,我在界面调用的时候Pause确实暂停了,文件大小不改变,然后退出正常。但是如果我暂停以后再resume以后,也确实恢复了,文件大小在继续增加,但是 如果这个时候退出的话系统就会死掉。resume以后那个录制的时间并没有变化,一直显示暂停的时间,是不是这个录制时间的原因导致的呢?
      

  8.   

    我在界面调用的时候Pause确实暂停了,文件大小不改变,然后退出正常。但是如果我暂停以后再resume以后,也确实恢复了,文件大小在继续增加,但是 如果这个时候退出的话系统就会死掉。resume以后那个录制的时间并没有变化,一直显示暂停的时间,是不是这个录制时间的原因导致的呢?
      

  9.   

    这个是OPENCORE的一个BUG,
    关于OPENCORE的这个BUG,网上可以参考下面的帖子:http://code.google.com/u/@VBlfQ11XBRJEXQB%2F/updates
    http://code.google.com/p/android/issues/detail?id=6515