mplayer: fix idle mode regressions

Commit 89a17bcda6c16 simplified the idle loop to run any commands
mplayer receives, not just playlist related commands. Unfortunately, it
turns out many slave commands always assume the presence of a demuxer.
MPContext->demuxer is assumed not to be NULL. This made the player
crash when receiving slave commands like pause/unpause, chapter
control, subtitle selection.

We want mplayer being able to handle this. Any slave command or
property, as long as it's backed by a persistent setting, should be run
successfully, even if no file is being played. If the slave command
doesn't make sense in this state, it shouldn't crash the player.

Insert some NULL checks when accessing demuxers. If sh_video or
sh_audio are not NULL, assume demuxer can't be NULL.

(There actually aren't that many properties which need to be changed. If
it gets too complicated, we could employ alternative mechanisms instead,
such as explicitly marking safe properties with a flag.)
mplayer: rearrange misleading code

The print_timeline() function actually had contained some code that
changed the MPContext state. Since you wouldn't expect that from a
function named print, move that code out of the function. The
misleading code structure was introduced in commit 6f564fe82b.
playlist: rename params_count field to num_params for consistency

Other (newer) parts of mplayer use this convention, so don't introduce
new conventions.
mplayer: fix invalid memory access in print_stream()

This is a regression introduced by commit 9c02ae7e95108.
command, mplayer: free return value of demuxer_stream_lang()
mplayer: never exit mplayer from within the play loop

The only place exit_player() should be called is the main() function.
exit_player() should be the only function allowed to call exit(). This
makes it easier to guarantee proper deinitialization, and allows using
the --leak-report flag without showing false positives.

The quit slave command now sets a flag only. It uses the same mechanism
that's normally used to advance to the next file on the playlist, so the
rest of the playback path should be able to react to the quit command
quickly enough. That is, the player should react just as fast to quit
requests in practice as before this commit.

In reinit_audio_chain(), the player was actually exited if
init_audio_filters() failed. Reuse the normal error handling path to
handle this condition.
mplayer: free return value of chapter_name()
mplayer: make OSD stack a member of MPContext

This also requires that the OSD stack related functions carry a pointer
to MPContext.

Free the OSD stack items (mp_osd_msg) at exit by making MPContext the
talloc parent. (E.g. when exiting while something is still displayed on
the OSD.)
options: revert passing around talloc contexts

This reverts commit 48f0692ab9 "options: make option struct the talloc parent of options".

This made things actually more complicated. It introduced a new
parameter to the option parse and copy functions, which was used
inconsistently. Some code passed a parent, some not. Morever, you have
to call m_option_free() anyway, because not all options actually
respect the talloc parent. There is also the question whether passing
NULL as parent is supposed to work, or if you still have to implement
m_config_free().

On the other hand, this simplifies nothing. I assume the intention was
being able to free all option values with a single talloc_free() call,
but the same goal can be reached by simply freeing the m_config struct.
(The m_config talloc destructor will free each option values.)

Get rid of the talloc parent context parameter. This essentially
reverts commit 48f0692ab9 ("options: make option struct the talloc parent of options").

In video_out.c, make the VO priv struct the talloc parent for the
m_config object, so that destroying the VO will free the options.

The ability to free the m_config struct and all its managed options was
introduced in commit 89a17bcda6c.
m_config: implement m_config_new in terms of m_config_simple

Also change m_config_simple() such that you need to register options
using m_config_register_options().
m_options: get rid of CONF_NOSAVE

This was already treated like CONF_GLOBAL.

Profiles can actually be file-local, as long as the profile sets file
local options only. Allow them to do so.
m_config: always reject setting global options in per-file mode

Now the command line parser sets the m_config object into file local
mode, so that m_config can check for this condition. Makes trying to
set global options from a profile fail.

Note: global options can be considered read-only by m_config, so maybe
      there should be an additional check for this. Reusing the file-
      local check is more practical for now, though.