osxbundle: don't use sed but pure python

GNU sed and BSD sed don't share the same options for editing files in-place,
so a workaround is needed.

The most simple way is to use a pure python implementation of applying the
changes.
dvd: add an extra chapter at position 0

This way, chapter 0 will always point to the start of the title.

At least this is the intention; it's likely that DVDs as well as
libdvdnav do random things that lead to random results.
dvd: drop last chapter

Apparently, libdvdnav always reports a last chapter that points to the
exact end of the title. This is useless for us.

Again, same possible caveats as with the previous commit.
stream_cdda: don't return number of tracks as number of titles

Apparently, we treat different tracks as titles, so returning the number
of titles (which is user-visible as "disc-titles" property) is
completely misguided.
command, dvd: add property which returns list of DVD titles

This was requested.

It seems libdvdread can't get the duration for titlesets other than the
currently opened title. The data structures contain dangling pointers
for these, and MPlayer works this around by opening every title
separately for the purpose of dumping the title list.
mp_image: check for malloc failure

Or rather, the only reason av_buffer_create() can fail is a malloc
failure.
vd_lavc: fix error handling path

The ctx->pic check must uninitialize the decoder.