struct , initial value when declare it. @ 071's blog :: 隨意窩 Xuite日誌
    1. 沒有新回應!
  • 201905131800struct , initial value when declare it.

    typedef struct _av_data {
    unsigned int type;
    unsigned int serial;

    unsigned int pts; /* frame PTS generate by encoder */
    unsigned int ts; /* monotonic clock raw */

    unsigned int size;
    unsigned char* ptr; /* pointer for data ouput */
    } AV_DATA;

    // **************  c source code

    AV_DATA av_data = {
    .type = AUDIO_FRAME_TYPE_PCM,
    .pts = pts,
    .ts = now.tv_sec,
    .size = pcm_size,
    .ptr = (uint8_t*) pcm,
    };

    // **************  c++ source code

    AV_DATA frame = {
    type : VIDEO_FRAME_TYPE_MJPEG,
    serial : 0,
    pts : uiPTS,
    ts : now.tv_sec,
    size : _snapshotImageSize,
    ptr : (unsigned char*) _snapshotImage,
    };

    // 二者之間的差異, 除了表示方法的差異外; c++ 必須要struct每個成員都給初始值, 且要按順序排列.

     

    How to conver PCM to aac|日誌首頁|python3.7.3 install上一篇How to conver PCM to aac下一篇python3.7.3 install
    回應