player: load external subs for uncompressed rar archives

Uncompressed rar archives can be transparently opened, but the filename
the player doesn't have the direct filename (but something starting
with rar://... instead). This will lead to external subtitles not
being loaded.

This doesn't handle multi-volume rar files, but in that cases just use
the --autosub-match=fuzzy option.

Fixes #397 on github.
This commit is contained in:
wm4
2013-12-06 23:00:19 +01:00
parent a53abbf4a6
commit 8f3d0b5e53
3 changed files with 23 additions and 3 deletions

View File

@@ -75,6 +75,17 @@ static void rar_entry_close(stream_t *s)
RarFileDelete(rar_file);
}
static int rar_entry_control(stream_t *s, int cmd, void *arg)
{
rar_file_t *rar_file = s->priv;
switch (cmd) {
case STREAM_CTRL_GET_BASE_FILENAME:
*(char **)arg = talloc_strdup(NULL, rar_file->s->url);
return STREAM_OK;
}
return STREAM_UNSUPPORTED;
}
static int rar_entry_open(stream_t *stream, int mode)
{
if (!strchr(stream->path, '|'))
@@ -123,6 +134,7 @@ static int rar_entry_open(stream_t *stream, int mode)
stream->fill_buffer = rar_entry_fill_buffer;
stream->seek = rar_entry_seek;
stream->close = rar_entry_close;
stream->control = rar_entry_control;
return STREAM_OK;
}