summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/man/en/options.rst10
-rw-r--r--core/cfg-mplayer.h3
-rw-r--r--core/defaultopts.c1
-rw-r--r--core/mp_core.h1
-rw-r--r--core/mplayer.c17
-rw-r--r--core/options.h1
-rw-r--r--demux/demux_lavf.c2
-rw-r--r--demux/stheader.h3
8 files changed, 32 insertions, 6 deletions
diff --git a/DOCS/man/en/options.rst b/DOCS/man/en/options.rst
index 253bea472b..1d8798f260 100644
--- a/DOCS/man/en/options.rst
+++ b/DOCS/man/en/options.rst
@@ -186,6 +186,16 @@
name to force it, this will skip some checks! Give the demuxer name as
printed by ``--audio-demuxer=help``. ``--audio-demuxer=audio`` forces MP3.
+--audio-display=<no|attachment>
+ Setting this option to ``attachment`` (default) will display image
+ attachments when playing audio files. It will display the first image
+ found, and additional images are available as video streams.
+
+ Setting this option to ``no`` disables display of video entirely when
+ playing audio files.
+
+ This option has no influence on files with normal video tracks.
+
--audiofile=<filename>
Play audio from an external file (WAV, MP3 or Ogg Vorbis) while viewing a
movie.
diff --git a/core/cfg-mplayer.h b/core/cfg-mplayer.h
index 6534672223..762c13a2bb 100644
--- a/core/cfg-mplayer.h
+++ b/core/cfg-mplayer.h
@@ -394,6 +394,9 @@ const m_option_t common_opts[] = {
OPT_STRINGLIST("alang", audio_lang, 0),
OPT_STRINGLIST("slang", sub_lang, 0),
+ OPT_CHOICE("audio-display", audio_display, 0,
+ ({"no", 0}, {"attachment", 1})),
+
OPT_STRING("quvi-format", quvi_format, 0),
{ "rawaudio", (void *)&demux_rawaudio_opts, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
diff --git a/core/defaultopts.c b/core/defaultopts.c
index 9f746b3dc1..4338e10b0a 100644
--- a/core/defaultopts.c
+++ b/core/defaultopts.c
@@ -44,6 +44,7 @@ void set_default_mplayer_options(struct MPOpts *opts)
.audio_id = -1,
.video_id = -1,
.sub_id = -1,
+ .audio_display = 1,
.sub_visibility = 1,
.extension_parsing = 1,
.audio_output_channels = 2,
diff --git a/core/mp_core.h b/core/mp_core.h
index 92803d2dd0..5a7926dee9 100644
--- a/core/mp_core.h
+++ b/core/mp_core.h
@@ -89,6 +89,7 @@ struct track {
char *title;
bool default_track;
+ bool attached_picture;
char *lang;
// If this track is from an external file (e.g. subtitle file).
diff --git a/core/mplayer.c b/core/mplayer.c
index 99fd4b46ed..5dc35479ba 100644
--- a/core/mplayer.c
+++ b/core/mplayer.c
@@ -320,6 +320,8 @@ static void print_stream(struct MPContext *mpctx, struct track *t, int id)
mp_msg(MSGT_CPLAYER, MSGL_INFO, " --%s=%s", langopt, t->lang);
if (t->default_track)
mp_msg(MSGT_CPLAYER, MSGL_INFO, " (*)");
+ if (t->attached_picture)
+ mp_msg(MSGT_CPLAYER, MSGL_INFO, " [P]");
if (t->title)
mp_msg(MSGT_CPLAYER, MSGL_INFO, " '%s'", t->title);
mp_msg(MSGT_CPLAYER, MSGL_INFO, " (");
@@ -914,6 +916,7 @@ static struct track *add_stream_track(struct MPContext *mpctx,
.demuxer_id = stream->demuxer_id,
.title = stream->title,
.default_track = stream->default_track,
+ .attached_picture = stream->attached_picture,
.lang = stream->common_header->lang,
.under_timeline = under_timeline,
.demuxer = stream->demuxer,
@@ -3592,14 +3595,16 @@ static bool compare_track(struct track *t1, struct track *t2, char **langs)
return l1 > l2;
if (t1->default_track != t2->default_track)
return t1->default_track;
+ if (t1->attached_picture != t2->attached_picture)
+ return !t1->attached_picture;
return t1->user_tid <= t2->user_tid;
}
static struct track *select_track(struct MPContext *mpctx,
- enum stream_type type, int tid, char **langs,
- bool select_fallback)
+ enum stream_type type, int tid, char **langs)
{
if (tid == -2)
return NULL;
+ bool select_fallback = type == STREAM_VIDEO || type == STREAM_AUDIO;
struct track *pick = NULL;
for (int n = 0; n < mpctx->num_tracks; n++) {
struct track *track = mpctx->tracks[n];
@@ -3613,6 +3618,8 @@ static struct track *select_track(struct MPContext *mpctx,
if (pick && !select_fallback && !pick->is_external
&& !match_lang(langs, pick->lang) && !pick->default_track)
pick = NULL;
+ if (pick && pick->attached_picture && !mpctx->opts.audio_display)
+ pick = NULL;
return pick;
}
@@ -3990,13 +3997,13 @@ goto_enable_cache: ;
check_previous_track_selection(mpctx);
mpctx->current_track[STREAM_VIDEO] =
- select_track(mpctx, STREAM_VIDEO, mpctx->opts.video_id, NULL, true);
+ select_track(mpctx, STREAM_VIDEO, mpctx->opts.video_id, NULL);
mpctx->current_track[STREAM_AUDIO] =
select_track(mpctx, STREAM_AUDIO, mpctx->opts.audio_id,
- mpctx->opts.audio_lang, true);
+ mpctx->opts.audio_lang);
mpctx->current_track[STREAM_SUB] =
select_track(mpctx, STREAM_SUB, mpctx->opts.sub_id,
- mpctx->opts.sub_lang, false);
+ mpctx->opts.sub_lang);
demux_info_print(mpctx->master_demuxer);
print_file_properties(mpctx, mpctx->filename);
diff --git a/core/options.h b/core/options.h
index f6e2a169f0..da4449cb11 100644
--- a/core/options.h
+++ b/core/options.h
@@ -85,6 +85,7 @@ typedef struct MPOpts {
int sub_id;
char **audio_lang;
char **sub_lang;
+ int audio_display;
int sub_visibility;
char *quvi_format;
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c
index b3ae1d6315..7c73ac6085 100644
--- a/demux/demux_lavf.c
+++ b/demux/demux_lavf.c
@@ -438,6 +438,8 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i)
priv->vstreams[priv->video_streams] = i;
sh_video->libav_codec_id = codec->codec_id;
sh_video->gsh->lavf_codec_tag = lavf_codec_tag;
+ if (st->disposition & AV_DISPOSITION_ATTACHED_PIC)
+ sh_video->gsh->attached_picture = true;
bih = calloc(sizeof(*bih) + codec->extradata_size, 1);
if (codec->codec_id == CODEC_ID_RAWVIDEO) {
diff --git a/demux/stheader.h b/demux/stheader.h
index b5f11c0ecc..efcec02d7b 100644
--- a/demux/stheader.h
+++ b/demux/stheader.h
@@ -58,7 +58,8 @@ struct sh_stream {
int lavf_codec_tag;
char *title;
- bool default_track;
+ bool default_track; // container default track flag
+ bool attached_picture; // stream is a picture (such as album art)
// shouldn't exist type of stuff
struct MPOpts *opts;