How do I set uri of the playbin2 (win32), when path contains cyrillic letters?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How do I set uri of the playbin2 (win32), when path contains cyrillic letters?

wl2776
Administrator
For example, my filename is "h:\\some\\path\\with\\cyrillic letters\\some_movie.mpg"
Cyrillic letters are in CP 1251 encoding.

What should be correct uri to set in playbin2?
If I set
g_object_set(G_OBJECT(m_player),"uri",filenane,NULL);
then I get the error about non-implemented protocol "h" (It assumes that the drive letter is a protocol).

If I use
gchar *uri=g_strdup_printf("file:///%s",filename);
then I get the error messages:

Error: Could not open file "h:\AVIK\video\ошибки_склейки\400063_Matrox.mpg" for reading.
Debug deails: ..\Source\gstreamer\plugins\elements\gstfilesrc.c(1057): gst_file_src_start (): /GstPlayBin2:playbin0/GstURIDecodeBin:uridecodebin0/GstFileSrc:source:
system error: Invalid argument
Error: Could not open file "h:\AVIK\video\ошибки_склейки\400063_Matrox.mpg" for reading.
Debug deails: ..\Source\gstreamer\plugins\elements\gstfilesrc.c(1057): gst_file_src_start (): /GstPlayBin2:playbin0/GstURIDecodeBin:uridecodebin0/GstFileSrc:source:
system error: Invalid argument

g_filename_to_utf8() returns null on this filename.

g_filename_to_uri() returns escaped string, where the spaces are replaced with underscores.

I also tried
g_uri_unescape_string(escaped_uri,
G_URI_RESERVED_CHARS_GENERIC_DELIMITERS
G_URI_RESERVED_CHARS_ALLOWED_IN_PATH
"АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЬЫЪЭЮЯ"
"абвгдеёжзийклмнопрстуфхцчшщьыъэюя")

(the tail is the Cyrillic alphabet) but it also returns null.
Reply | Threaded
Open this post in threaded view
|

Re: How do I set uri of the playbin2 (win32), when path contains cyrillic letters?

wl2776
Administrator
wl2776 wrote
For example, my filename is "h:\\some\\path\\with\\cyrillic letters\\some_movie.mpg"
Cyrillic letters are in CP 1251 encoding.
What should be correct uri to set in playbin2?
I've done it. The code is

gchar *uri=g_filename_to_uri(g_convert(filename,-1,"UTF-8","CP1251",NULL,NULL,NULL),NULL,NULL);
if(uri){
  g_object_set(G_OBJECT(m_player),"uri",uri,NULL);
  g_free(uri);
}