简体   繁体   中英

using libvlc_video_set_format_callbacks to transcode videos frame by frame

I am trying to write a small program in C++ that transcodes a video frame by frame, and I am using the functions libvlc_video_set_callbacks and libvlc_video_set_format_callbacks to achieve this.

The first function works fine, but I am not sure how to implement libvlc_video_set_format_callbacks.

I tried it this way to start with but it gives me an argument error for 'setup':

int setup(void* pUserData, char *chroma, unsigned int *width, unsigned int *height, unsigned int *pitches, unsigned int *lines)
    {
        (void) pUserData;
        return 1;
    }

libvlc_video_set_format_callbacks(mp, setup, cleanup);

Next thing is that I don't really know how to set the right video format properties.

Can you please help me with this setup-function or at least point me to an example that shows how to implement it, as I didn't find one? As you can imagine, I am not a very experienced programmer so please be patient with me ;) Thanks in advance

liblv_video_set_format_callbacks second argument is of type libvlc_video_format_cb , which is the following typedef:

typedef unsigned(* libvlc_video_format_cb)(void **opaque, char *chroma, unsigned *width, unsigned *height, unsigned *pitches, unsigned *lines);

We can see two differences with your setup function:

  • The type of the first argument should be void** . Yours is void* .
  • The return type should be unsigned . Yours is int .

I don't know either about video format properties. Thus, I will not able to give you any pointers for that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM