allwinner-zh / media-codec

Video and audio deconde/encode libraries.
Other
175 stars 124 forks source link

Vencoder demo does not work - segfault / missing code #9

Open misko opened 9 years ago

misko commented 9 years ago

Hi, VideoTest.c does not work because of missing code. It will segfault on VideoEncCreate, because gVEncoderList.list (venc_device.c) has not been initialized. More specificially it segfaults on (posVEncNode) in the following (venc_device.c)

    CdxListForEachEntry(posVEncNode, &gVEncoderList.list, node)
    {   
        if (posVEncNode->type == type)
        {   
            logi("Create encoder '%x:%s'", posVEncNode->type, posVEncNode->desc);
            vencoder_device_handle = posVEncNode->device;
            return vencoder_device_handle;
        }
    }

To initialize this list something needs to call VEncoderRegister , but nothing in this code base calls this function. In the case of VideoTest.c something needs to call VEncoderRegister with a VENC_DEVICE for H264 providing the functions for setting/getting/encoding/init/uninit/etc , I did not see this in the code base either. I think this might be unfortunately missing, making this code not very usable at the moment.

To reproduce the error you can compile and run the following (linked against library from this repo),

#include "vencoder.h"
int main () {
  VideoEncoder *pVideoEnc = VideoEncCreate (VENC_CODEC_H264);
  return 0;
}

I am trying to make a nice gstreamer plugin.... any help would be appreciated.

zhanglanlazy commented 5 years ago

how do you solve it ? I have the same question 。change the gcc compile version?