[Bug 625113] subparse: add support for external SSA/ASS subtitles

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Sat Jun 11 12:01:00 UTC 2016


https://bugzilla.gnome.org/show_bug.cgi?id=625113

christophe vr <christophevr at telenet.be> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |christophevr at telenet.be

--- Comment #29 from christophe vr <christophevr at telenet.be> ---
@Tim-Philipp Müller
Hello, I just saw that you're bussy whit the issue ssa/ass codecs.
Yes the ass tag do unfortunately allow the chars such as \N (which they call
hard line return) and ... blabla bla .
The main problem is that also handbrake now reencode the imported srt
passtrough subs into a ssa/ass with those bloody \N and horrific other signs.
It's a nightmare yes but unfortunatelly an allowed "improved ?? codec"

Ok into the plugins-base-subparse the \N for example is set as ' \n' hex 200A .

A least it will not give an error. But the resulting subtitle in a pango page
will have :
1) a white space by each line end (before the 0A 20 is set).
2) It will also add an extra blank line. The result in a pango-page is that the
final subtitle is one line to high, which is pretty ennoying.

Ok we are working with stb , and so do need our own factory make
subtitle-plugin
to be found on :

https://github.com/OpenPLi/gst-plugin-subsink/tree/master

In our application we are using the rendered buffer.

But due to the fact that at each line a white space is added the subtitle
centration is not 100 % ok anymore. And the buffer does also still containes a
trailing edge \n. I saw the in gstssaparse the lines

gst_ssa_parse_remove_override_codes (GstSsaParse * parse, gchar * txt)
{
  gchar *t, *end;
  gboolean removed_any = FALSE;

  while ((t = strchr (txt, '{'))) {
    end = strchr (txt, '}');
    if (end == NULL) {
      GST_WARNING_OBJECT (parse, "Missing { for style override code");
      return removed_any;
    }
    /* move terminating NUL character forward as well */
    memmove (t, end + 1, strlen (end + 1) + 1);
    removed_any = TRUE;
  }

  /* these may occur outside of curly brackets. We don't handle the different
   * wrapping modes yet, so just remove these markers from the text for now */
  while ((t = strstr (txt, "\\n"))) {
    t[0] = ' ';
    t[1] = '\n';
  }
  while ((t = strstr (txt, "\\N"))) {
    t[0] = ' ';
    t[1] = '\n';
  }
  while ((t = strstr (txt, "\\h"))) {
    t[0] = ' ';
    t[1] = ' ';
  }

  return removed_any;
}

Is there maybe a change that this can be adpated so that \N  into the sub
somewhere is just replaced by \n and the trailing edge \N just removed ?

Since now ok in our application e2 gstreamer player which is in c++ .

We can do (and already did) see patch

https://github.com/OpenPLi/enigma2/commit/a447103455f38760a9ebad84d11bd6b7ae129ce1

But we still will keep the whitespaces 0x20 char by each line. Witch is
annoying for text centration.

Ok we could make in c++

for (std::size_t index = line.find(" \n"); index != std::string::npos; index =
line.find(" \n"))
{
    if (index + 2 == line.length())
        line.erase(index); // remove white space and newline.
    else
        line.erase(index, 1); // remove whitespace only.
}

That works but , it would be fine if the txt string should be made ok at base
ssaparse fase.

When actually the ssa is decoded and recoded as txt string.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list