Add ffplay subtitle stream selection command-line parameter
Patch by Björn Axelsson ( gecko A acc D umu D se ) Originally committed as revision 17089 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
f54b31b9ef
commit
16a59a7bb6
14
ffplay.c
14
ffplay.c
@ -191,6 +191,7 @@ static int audio_disable;
|
|||||||
static int video_disable;
|
static int video_disable;
|
||||||
static int wanted_audio_stream= 0;
|
static int wanted_audio_stream= 0;
|
||||||
static int wanted_video_stream= 0;
|
static int wanted_video_stream= 0;
|
||||||
|
static int wanted_subtitle_stream= -1;
|
||||||
static int seek_by_bytes;
|
static int seek_by_bytes;
|
||||||
static int display_disable;
|
static int display_disable;
|
||||||
static int show_status;
|
static int show_status;
|
||||||
@ -1917,12 +1918,13 @@ static int decode_thread(void *arg)
|
|||||||
{
|
{
|
||||||
VideoState *is = arg;
|
VideoState *is = arg;
|
||||||
AVFormatContext *ic;
|
AVFormatContext *ic;
|
||||||
int err, i, ret, video_index, audio_index;
|
int err, i, ret, video_index, audio_index, subtitle_index;
|
||||||
AVPacket pkt1, *pkt = &pkt1;
|
AVPacket pkt1, *pkt = &pkt1;
|
||||||
AVFormatParameters params, *ap = ¶ms;
|
AVFormatParameters params, *ap = ¶ms;
|
||||||
|
|
||||||
video_index = -1;
|
video_index = -1;
|
||||||
audio_index = -1;
|
audio_index = -1;
|
||||||
|
subtitle_index = -1;
|
||||||
is->video_stream = -1;
|
is->video_stream = -1;
|
||||||
is->audio_stream = -1;
|
is->audio_stream = -1;
|
||||||
is->subtitle_stream = -1;
|
is->subtitle_stream = -1;
|
||||||
@ -1984,6 +1986,11 @@ static int decode_thread(void *arg)
|
|||||||
if ((video_index < 0 || wanted_video_stream-- > 0) && !video_disable)
|
if ((video_index < 0 || wanted_video_stream-- > 0) && !video_disable)
|
||||||
video_index = i;
|
video_index = i;
|
||||||
break;
|
break;
|
||||||
|
case CODEC_TYPE_SUBTITLE:
|
||||||
|
if (wanted_subtitle_stream >= 0 && !video_disable &&
|
||||||
|
(subtitle_index < 0 || wanted_subtitle_stream-- > 0))
|
||||||
|
subtitle_index = i;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2005,6 +2012,10 @@ static int decode_thread(void *arg)
|
|||||||
is->show_audio = 1;
|
is->show_audio = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (subtitle_index >= 0) {
|
||||||
|
stream_component_open(is, subtitle_index);
|
||||||
|
}
|
||||||
|
|
||||||
if (is->video_stream < 0 && is->audio_stream < 0) {
|
if (is->video_stream < 0 && is->audio_stream < 0) {
|
||||||
fprintf(stderr, "%s: could not open codecs\n", is->filename);
|
fprintf(stderr, "%s: could not open codecs\n", is->filename);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
@ -2486,6 +2497,7 @@ static const OptionDef options[] = {
|
|||||||
{ "vn", OPT_BOOL, {(void*)&video_disable}, "disable video" },
|
{ "vn", OPT_BOOL, {(void*)&video_disable}, "disable video" },
|
||||||
{ "ast", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&wanted_audio_stream}, "", "" },
|
{ "ast", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&wanted_audio_stream}, "", "" },
|
||||||
{ "vst", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&wanted_video_stream}, "", "" },
|
{ "vst", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&wanted_video_stream}, "", "" },
|
||||||
|
{ "sst", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&wanted_subtitle_stream}, "", "" },
|
||||||
{ "ss", HAS_ARG | OPT_FUNC2, {(void*)&opt_seek}, "seek to a given position in seconds", "pos" },
|
{ "ss", HAS_ARG | OPT_FUNC2, {(void*)&opt_seek}, "seek to a given position in seconds", "pos" },
|
||||||
{ "bytes", OPT_BOOL, {(void*)&seek_by_bytes}, "seek by bytes" },
|
{ "bytes", OPT_BOOL, {(void*)&seek_by_bytes}, "seek by bytes" },
|
||||||
{ "nodisp", OPT_BOOL, {(void*)&display_disable}, "disable graphical display" },
|
{ "nodisp", OPT_BOOL, {(void*)&display_disable}, "disable graphical display" },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user