Skip to content

Commit

Permalink
demux/subtitles: capture language attribute from SSA/ASS files
Browse files Browse the repository at this point in the history
... for language identification.

this info property has been supported by libass since v0.10.0. it is currently
a 2-char iso-639-1 code.

libass commit adding support:
libass/libass@c979365

discussion about enhancing the attribute to support 3-char iso-639-2 codes,
possibly bcp-47: libass/libass#404
  • Loading branch information
jnqnfe authored and jbkempf committed Jun 18, 2021
1 parent 17b2c06 commit 49c7098
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion modules/demux/subtitle.c
Original file line number Diff line number Diff line change
Expand Up @@ -1239,11 +1239,19 @@ static int ParseSSA( vlc_object_t *p_obj, subs_properties_t *p_props,
* Dialogue: Layer#,0:02:40.65,0:02:41.79,Wolf main,Cher,0000,0000,0000,,Et les enregistrements de ses ondes delta ?
*/

/* The output text is - at least, not removing numbers - 18 chars shorter than the input text. */
/* The output text is always shorter than the input text. */
psz_text = malloc( strlen(s) );
if( !psz_text )
return VLC_ENOMEM;

/* Try to capture the language property */
if( sscanf( s, "Language: %[^\r\n]", psz_text ) == 1 )
{
free( p_props->psz_lang ); /* just in case of multiple instances */
p_props->psz_lang = psz_text;
psz_text = NULL;
}
else
if( sscanf( s,
"Dialogue: %15[^,],%d:%d:%d.%d,%d:%d:%d.%d,%[^\r\n]",
temp,
Expand Down

0 comments on commit 49c7098

Please sign in to comment.