Page 1 of 1

smem doesn't work with vcodec=I420

Posted: 06 Mar 2011 18:49
by xylosper
I'm testing some idea with smem, and noticed a weired thing.
See the next code.

Code: Select all

#include <vlc/vlc.h> #include <stdio.h> #include <unistd.h> #include <stdlib.h> typedef unsigned int uint; void cbVideoPrerender(void *p_video_data, uint8_t **pp_pixel_buffer, int size) { printf("video-prerender-callback function works.\n"); fflush(stdout); // Locking *pp_pixel_buffer = (uint8_t*)malloc(size); } void cbVideoPostrender(void *p_video_data, uint8_t *p_pixel_buffer , int width, int height, int pixel_pitch, int size, int64_t pts) { // Unlocking } void cbAudioPrerender(void *p_audio_data, uint8_t** pp_pcm_buffer , uint size) { // Locking *pp_pcm_buffer = (uint8_t*)malloc(size); } void cbAudioPostrender(void* p_audio_data, uint8_t* p_pcm_buffer , uint channels, uint rate, uint nb_samples, uint bits_per_sample, uint size, int64_t pts) { // Unlocking } int main(int argc, char **argv) { if (argc < 2) { printf("Usage: test-smem <file>\n"); return -1; } char smem_options[1000]; sprintf(smem_options , "#transcode{vcodec=I444,acodec=s16l}:smem{" "video-prerender-callback=%lld," "video-postrender-callback=%lld," "audio-prerender-callback=%lld," "audio-postrender-callback=%lld}," , (long long int)(intptr_t)(void*)&cbVideoPrerender , (long long int)(intptr_t)(void*)&cbVideoPostrender , (long long int)(intptr_t)(void*)&cbAudioPrerender , (long long int)(intptr_t)(void*)&cbAudioPostrender); const char *const vlc_args[] = { "-I", "dummy", "--ignore-config", "--extraintf=logger", "--verbose=2", "--sout", smem_options // Stream to memory }; libvlc_instance_t *vlc = libvlc_new(sizeof(vlc_args) / sizeof(vlc_args[0]), vlc_args); libvlc_media_player_t *mp = libvlc_media_player_new(vlc); libvlc_media_t *m = libvlc_media_new_path(vlc, argv[1]); libvlc_media_player_set_media(mp, m); libvlc_media_release(m); libvlc_media_player_play(mp); sleep(5); libvlc_media_player_stop (mp); libvlc_media_player_release (mp); libvlc_release (vlc); return 0; }
I tested this code in my MacBook Pro(OSX Snow Leopard).
The above code prints out ""video-prerender-callback function works." in some lines.
However, when I changed the vcodec=I444 to vcodec=I420, it does not output my debugging message in the callback function 'cbVideoPrerender'.
I checked the debugging message from vlc with verbose option, but there's no notable error.
AFAIK, both of I444 and I420 are raw video format. and smem should work with them.
Why is not the callback function called with I420, and how can I make it work?



FYI, I checked the source code of smem.c, and I found like

Code: Select all

switch( p_fmt->i_codec ) { case VLC_CODEC_RGB32: case VLC_CODEC_RGBA: i_bits_per_pixel = 32; break; case VLC_CODEC_I444: case VLC_CODEC_RGB24: i_bits_per_pixel = 24; break; case VLC_CODEC_RGB16: case VLC_CODEC_RGB15: case VLC_CODEC_RGB8: case VLC_CODEC_I422: i_bits_per_pixel = 16; break; case VLC_CODEC_YV12: case VLC_CODEC_I420: i_bits_per_pixel = 12; break; case VLC_CODEC_RGBP: i_bits_per_pixel = 8; break; default: msg_Err( p_stream, "Smem does only support raw video format" ); return NULL; }
so, I think I420 is definitely compitible format.

Re: smem doesn't work with vcodec=I420

Posted: 07 Mar 2011 18:42
by RĂ©mi Denis-Courmont
I'm not sure smem supports planar video chromas.

Re: smem doesn't work with vcodec=I420

Posted: 13 Mar 2011 11:57
by Jean-Baptiste Kempf
I am afraid you need to add verbose debug in the code to see where it fails.

Re: smem doesn't work with vcodec=I420

Posted: 16 Mar 2011 22:25
by wetneb
What would you use in this case ? GDB ?

Re: smem doesn't work with vcodec=I420

Posted: 17 Mar 2011 09:16
by Jean-Baptiste Kempf
Or just printfs

Re: smem doesn't work with vcodec=I420

Posted: 20 Mar 2011 16:48
by xylosper
Thanks for your replys.
I just gave up to using smem.