New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
International character support - check if the URI conversions are still needed #1142
Comments
Given these three test filenames:
And the following example code: package test;
import uk.co.caprica.vlcj.binding.LibVlc;
import uk.co.caprica.vlcj.binding.internal.*;
import uk.co.caprica.vlcj.factory.MediaPlayerFactory;
import uk.co.caprica.vlcj.media.MediaParsedStatus;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicReference;
public class Main {
private static libvlc_instance_t instance;
public static void main(String[] args) throws Exception {
new MediaPlayerFactory(); // Only for discovery
instance = LibVlc.libvlc_new(0, null);
parse("hello.mp3");
parse("サンプル.mp3");
parse("привет.mp3");
parse("nothing.mp3");
LibVlc.libvlc_release(instance);
}
private static void parse(String mrl) throws Exception {
libvlc_media_t media = LibVlc.libvlc_media_new_path(instance, mrl);
CountDownLatch latch = new CountDownLatch(1);
AtomicReference<MediaParsedStatus> parseResult = new AtomicReference<>();
libvlc_callback_t cb = (event, pointer) -> {
int newStatus = ((media_parsed_changed) event.u.getTypedValue(media_parsed_changed.class)).new_status;
parseResult.set(MediaParsedStatus.mediaParsedStatus(newStatus));
latch.countDown();
};
libvlc_event_manager_t eventManager = LibVlc.libvlc_media_event_manager(media);
LibVlc.libvlc_event_attach(eventManager, libvlc_event_e.libvlc_MediaParsedChanged.intValue(), cb, null);
LibVlc.libvlc_media_parse_with_options(media, 0, 0);
latch.await();
System.out.printf("PARSE RESULT FOR '%s' is %s%n", mrl, parseResult.get());
LibVlc.libvlc_event_detach(eventManager, libvlc_event_e.libvlc_MediaParsedChanged.intValue(), cb, null);
LibVlc.libvlc_media_release(media);
}
} Create/copy/rename an mp3 file for each of those names, and run the given code. With JDK 11 on Windows 10+ this just works without any special handling. |
That deals with local files, URL's still need to be checked - but really UNICODE in URL's should not be a concern of vlcj or LibVLC should it? |
Tested URLs and it all seems to work. |
Summary:
It all appears to work. Still need to test on macOS. |
It would appear, so far at least, that the special Unicode handling should be removed from vlcj. |
The sample code is out-of-date with respect to native API changes around media. |
This was required with early versions of vlcj e.g. when Windows XP was current.
Now, Windows 10 is a reasonable baseline and UTF-8 should be handled everywhere (?).
Check whether the URI conversions for MRL's is still required or not.
This has always just worked in Linux.
The text was updated successfully, but these errors were encountered: