command: fix wrong condition & remove redundant stream type checking

This commit is contained in:
xylosper 2014-03-13 10:55:22 +09:00 committed by wm4
parent 2f72eecd89
commit d391e2d204
1 changed files with 2 additions and 14 deletions

View File

@ -182,19 +182,6 @@ static int mp_property_filename(m_option_t *prop, int action, void *arg,
return r; return r;
} }
static int media_title_from_stream(struct stream *stream, char **name)
{
if (!stream)
return false;
switch (stream->type) {
case STREAMTYPE_DVD:
case STREAMTYPE_BLURAY:
return stream_control(stream, STREAM_CTRL_GET_DISC_NAME, name);
default:
return false;
}
}
static int mp_property_media_title(m_option_t *prop, int action, void *arg, static int mp_property_media_title(m_option_t *prop, int action, void *arg,
MPContext *mpctx) MPContext *mpctx)
{ {
@ -207,7 +194,8 @@ static int mp_property_media_title(m_option_t *prop, int action, void *arg,
name = demux_info_get(mpctx->master_demuxer, "title"); name = demux_info_get(mpctx->master_demuxer, "title");
if (name && name[0]) if (name && name[0])
return m_property_strdup_ro(prop, action, arg, name); return m_property_strdup_ro(prop, action, arg, name);
if (media_title_from_stream(mpctx->master_demuxer->stream, &name) struct stream *stream = mpctx->master_demuxer->stream;
if (stream_control(stream, STREAM_CTRL_GET_DISC_NAME, &name) > 0
&& name) { && name) {
int r = m_property_strdup_ro(prop, action, arg, name); int r = m_property_strdup_ro(prop, action, arg, name);
talloc_free(name); talloc_free(name);