vo_xv: don't require frame stepping to remove OSD or subs

In order to improve performance, vo_xv didn't create a backup of the
video frame before drawing OSD and subtitles during normal playback. It
required the frontend to do frame stepping if it wanted to redraw the
OSD, but no backup of the video frame was available. (Consider the
following use case: enable the OSD permanently with --osd-level=3, then
pause during playback and do something that shows an OSD message. The
player will advance the video by one frame at the time the new OSD
message is first drawn.)

This also meant that taking a screenshot during playback with vo_xv
would include OSD and subtitles in the resulting image.

Fix this by always creating a backup before drawing OSD or subtitles.
In order to avoid having to create a full copy of the whole image frame,
introduce a complex scheme that tries to backup only the changed
regions.

It's unclear whether the additional complexity in draw_bmp.c for
backing up only the changed areas of the frame is worth it. Possibly
a simpler implementation would suffice, such as tracking only Y ranges
of changed image data, or even just copying the full frame.

vo_xv's get_screenshot() now always creates a copy in order not to
modify the currently displayed frame.
vo_x11: add screenshot support

Although vo_x11 shouldn't be used, it's a good thing to have screenshot
support in absolutely all interactive VOs. (Except vo_caca, but that is
literally a joke.)
vo_x11: don't require framestepping to update OSD

The OSD couldn't be updated at all without frame stepping. This made the
VO unusable (In fact, vo_x11 should never be used, but it's provided as
fail-safe fallback). Implement VOCTRL_REDRAW_FRAME to deal with this.

Unfortunately, this exposes issues with draw_bmp's subtitle rendering:
areas that are not covered by subtitles at all are changed as well. The
"backup" mechanism provided by draw_bmp doesn't copy these areas, which
turns up as quite visible artifacts. (These are included when taking
screenshots too.)
video: fix bogus uses of mp_image.w/width

mp_image has this confusing distinction between the w/h and width/height
fields. w/h are the actual width and height, while width/height have a
very special meaning inside the video filter code: it's the actually
allocated width, which is also used for stride padding.

Screenshot related code abused the w/h fields to store the aspect
corrected size. Some code confused the role of w/h and width/height.

Fix these issues. For aspect corrected size, display_w/h are used, while
width/height should never be used outside vf.c internals and related
code.

This also fixes an actual bug when taking screenshots of anamorphic
video with vf_screenshot, as well as using vo_image with such videos.
screenshot: add subs even with vf_screenshot

Until now, screenshots with the video filter didn't add subs (unclear
whether that was an oversight or feature). Fix this and make behavior
when taking screenshots with vf_screenshot more consistent with VO
screenshots.

The change in vf_screenshot is needed, because add_subs() checks this
flag to decide whether it's allowed to mutate the image.

This commit has another user visible side effect. When taking a
screenshot each frame (using the "each-frame" mode of the screenshot
command), a normal screenshot command will stop the each-frame mode.
subreader: do not skip the first char of ASS fields.

Without this change, fields that can be sometimes empty and
sometimes not, such as the Effect field, are counted in an
inconsistent way. Since the number of fields is used to find
where the text starts, it leads to internal field arriving
on the video.

Bug reported anonymously on the users mailing list.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35426 b3059339-0415-0410-9bf9-f77b7e298cf2
stream_ftp: support longer filenames

This change was split into 8 patches. Squash them together, as they
affect stream_ftp.c only.

stream ftp: readline: Fix off-by-one error

Even if max bytes are available read at most max - 1 bytes.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35427 b3059339-0415-0410-9bf9-f77b7e298cf2

Conflicts:
	stream/stream_ftp.c

stream ftp: readline: Always initialize output parameter buf

Only exception if passed parameter max is less than or equal
to zero. That cannot happen with the current code.

Additionally change readresp function to always copy the first
response line if the parameter rsp is non-NULL. This fixes some
error reporting that used uninitialized stack arrays.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35428 b3059339-0415-0410-9bf9-f77b7e298cf2

stream ftp: readline: Always try to read complete lines

If there is not enough space in the provided line buffer just
skip the remaining bytes until reaching EOL.

Usually we are only interested in the first 5 characters and
for everything else the (on-stack) response buffer should still
be big enough.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35429 b3059339-0415-0410-9bf9-f77b7e298cf2

stream ftp: Revise file descriptor usage

* Set unbound descriptor variables to -1
* Always test >= 0 to see if a variable refers to a valid descriptor

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35430 b3059339-0415-0410-9bf9-f77b7e298cf2

stream ftp: Only send QUIT command if connected

Do not attempt to send commands without control connections.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35431 b3059339-0415-0410-9bf9-f77b7e298cf2

stream ftp: Create buffers before opening control connection

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35432 b3059339-0415-0410-9bf9-f77b7e298cf2

stream ftp: Allocate command buffer on-heap

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35433 b3059339-0415-0410-9bf9-f77b7e298cf2

stream ftp: Increase command buffer size

Allow for more longish file names (be it because of length or more
lengthy characters).

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35434 b3059339-0415-0410-9bf9-f77b7e298cf2