1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-12 09:59:44 +00:00

demuxer.c: add new_sh_sub_sid_lang

Allocates a new sh_sub and specifies language at the same time. I
don't think this is a particularly good API but add it for easier
compatibility with some svn changes.
This commit is contained in:
Uoti Urpala 2010-10-29 19:23:17 +03:00
parent 5b14a1b44f
commit 7d17b5e254
2 changed files with 13 additions and 0 deletions

View File

@ -271,6 +271,17 @@ sh_sub_t *new_sh_sub_sid(demuxer_t *demuxer, int id, int sid)
return demuxer->s_streams[id];
}
struct sh_sub *new_sh_sub_sid_lang(struct demuxer *demuxer, int id, int sid,
const char *lang)
{
struct sh_sub *sh = new_sh_sub_sid(demuxer, id, sid);
if (lang && lang[0] && strcmp(lang, "und")) {
sh->lang = strdup(lang);
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_SID_%d_LANG=%s\n", sid, lang);
}
return sh;
}
static void free_sh_sub(sh_sub_t *sh)
{
mp_msg(MSGT_DEMUXER, MSGL_DBG2, "DEMUXER: freeing sh_sub at %p\n", sh);

View File

@ -146,6 +146,8 @@ sh_audio_t* new_sh_audio_aid(struct demuxer *demuxer,int id,int aid);
sh_video_t* new_sh_video_vid(struct demuxer *demuxer,int id,int vid);
#define new_sh_sub(d, i) new_sh_sub_sid(d, i, i)
sh_sub_t *new_sh_sub_sid(struct demuxer *demuxer, int id, int sid);
struct sh_sub *new_sh_sub_sid_lang(struct demuxer *demuxer, int id, int sid,
const char *lang);
void free_sh_audio(struct demuxer *demuxer, int id);
void free_sh_video(sh_video_t *sh);