Based on the discussion in this thread: https://forum.videolan.org/viewtopic.ph ... d9a0f7a9e4
I have applied that patch: http://comments.gmane.org/gmane.comp.vi ... evel/81357 and added to libvlcjni.c:
libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
libvlc_set_video_filter(mp, "croppadd", true);
I have therefore support of the croppadd video filter in Android VLC.
I'm playing a 1024x1024 movie. In the resource file, the Android VLC surface is defined with "wrap_content" for both height and width. Therefore, I have a 1024x1024 surface and the movie is correctly played. When I apply the croppadd filter while playing, VLC correctly crops to 512x512 as shown in the log below. Nevertheless, it adds another filter to compensate the format change. So the movie is cropped to 512x512, scaled to 1024x0124, and then it appears scaled in the unchanged 1024x1024 surface.
10-18 11:11:24.794: D/VLC(11786): main video output: Adding 'croppadd' as interactive
10-18 11:11:24.794: D/VLC(11786): main filter: looking for video filter2 module matching "croppadd": 33 candidates
10-18 11:11:24.794: D/VLC(11786): croppadd filter: Crop: Top: 0, Bottom: 512, Left: 0, Right: 512
10-18 11:11:24.794: D/VLC(11786): croppadd filter: Padd: Top: 0, Bottom: 0, Left: 0, Right: 0
10-18 11:11:24.794: D/VLC(11786): croppadd filter: 1024x1024 -> 512x512
10-18 11:11:24.794: D/VLC(11786): main filter: using video filter2 module "croppadd"
10-18 11:11:24.794: D/VLC(11786): main video output: Filter 'croppadd' (0x75775984) appended to chain
10-18 11:11:24.794: D/VLC(11786): main video output: Adding a filter to compensate for format changes
10-18 11:11:24.794: D/VLC(11786): main filter: looking for video filter2 module matching "any": 33 candidates
10-18 11:11:24.804: D/VLC(11786): swscale filter: 512x512 chroma: NV12 -> 1024x1024 chroma: NV12 with scaling using Bicubic (good quality)
10-18 11:11:24.804: D/VLC(11786): main filter: using video filter2 module "swscale"
10-18 11:11:24.804: D/VLC(11786): main video output: Filter 'Swscale' (0x757435dc) appended to chain
I would like to avoid this step and have the surface changed to 512x512 so there is no VLC scaling. I have tried to update the surface size from the top java level when the filter is applied but VLC resizes it immediately back to 1024x1024.
Alternatively, I would love to apply the filter before the movie starts so that VLC understands that I want a 512x512 output not scaled, but VLC crashes if the filter is applied before the movie starts (I'm not sure why).
How can I figure out a quick and dirty solution?