Problems with libvlc_video_set_callbacks() When using vlc_3.0
Posted: 28 Feb 2018 08:33
First, I describe my application scenario:
1, my video input source is from the network, using the RTSP protocol;
2, I need to get the data of each frame and use it for custom rendering.
3. Before drawing, I need to get the video resolution and frame rate to create a suitable buffer.
4, I use functions libvlc_media_parse_with_options (), libvlc_media_tracks_get (), libvlc_video_set_callbacks () and libvlc_video_set_format_callbacks ().
In the process of programming, I met the following questions:
1, I need to get the video resolution and frame rate, so I use libvlc_media_parse_with_options () function and listen to libvlc_MediaParsedChanged event, then use libvlc_media_get_parsed_status () function to obtain the status of the parse, but the return value is always libvlc_media_parsed_status_skipped. Why?
2, I found that the libvlc_video_set_format_callbacks() function always callback three times. The first time, Chroma is "DX11", resolution is 1280 x 720, the second time Chroma is "DXA9", resolution is 1280 x 720, the third time Chroma is "I420", resolution is 1280 * 738. But the functions in vlc_2.8 only callback one time. Why? How should I use this callback function?
3, I found that there is resolution information in set format callback function, but there is no frame frequency information. Therefore, I use libvlc_media_tracks_get () function to retrieve video information in callback function, but all the parameters are 0. How do I get the resolution and frame rate correctly?
Thanks in advance for help or any code snippet.
1, my video input source is from the network, using the RTSP protocol;
2, I need to get the data of each frame and use it for custom rendering.
3. Before drawing, I need to get the video resolution and frame rate to create a suitable buffer.
4, I use functions libvlc_media_parse_with_options (), libvlc_media_tracks_get (), libvlc_video_set_callbacks () and libvlc_video_set_format_callbacks ().
In the process of programming, I met the following questions:
1, I need to get the video resolution and frame rate, so I use libvlc_media_parse_with_options () function and listen to libvlc_MediaParsedChanged event, then use libvlc_media_get_parsed_status () function to obtain the status of the parse, but the return value is always libvlc_media_parsed_status_skipped. Why?
2, I found that the libvlc_video_set_format_callbacks() function always callback three times. The first time, Chroma is "DX11", resolution is 1280 x 720, the second time Chroma is "DXA9", resolution is 1280 x 720, the third time Chroma is "I420", resolution is 1280 * 738. But the functions in vlc_2.8 only callback one time. Why? How should I use this callback function?
3, I found that there is resolution information in set format callback function, but there is no frame frequency information. Therefore, I use libvlc_media_tracks_get () function to retrieve video information in callback function, but all the parameters are 0. How do I get the resolution and frame rate correctly?
Thanks in advance for help or any code snippet.