Handle RTMP redirect

This patch allows RtmpDump to follow RTMP URL redirects. Before this you could
run rtmpdump --verbose and see the redirect URL

DEBUG: Property: <Name:      redirect, STRING:     rtmp://46.19.140.146:190/vod>

This patch simply automates the following process. Taken from KSV patch file
http://github.com/downloads/K-S-V/Scripts/rtmpdump-2.4.zip
Tested on
http://datastreaming.altervista.org/LA7.html
Check bandwidth response

With RtmpSrv, some servers will cause RtmpSrv to stop at this step

  WARNING: Trying different position for client digest!

With these servers the bandwidth needs to be checked from client to server.

Taken from KSV patch file
http://github.com/downloads/K-S-V/Scripts/rtmpdump-2.4.zip
Tested with
http://kanalia.eu/player.php?id=91
Related link
http://wowza.com/forums/content.php?252
ConnectPacket

Some servers were causing RtmpDump to stop at this step

  DEBUG: Invoking connect
  INFO: Connected...
  ERROR: RTMP_ReadPacket, failed to read RTMP packet header
  DEBUG: Closing connection.

Ref
http://github.com/downloads/K-S-V/Scripts/rtmpdump-2.4.zip
http://lists.mplayerhq.hu/pipermail/rtmpdump/2011-December/001756.html
Problem server
http://tvpublica.com.ar/vivo
Other tested servers
http://canaldosconcursos.com.br/video_demo.php?id_cursos=3130
http://tape.tv
http://viki.com/channels/5453-killer-k/videos/51483
http://zonytvcom.info/colorstv.php
StripParams

The querystring for the "-a" parameter was also being used with the "-r"
parameter. This is not necessary. Cannot use with "-W" as some servers require
the querystring. Function was moved to librtmp to allow use across the project.

Taken from KSV patch file
http://github.com/downloads/K-S-V/Scripts/rtmpdump-2.4.zip
Tested with
http://history.com/shows/the-universe/videos#the-universe-spaceship-earth
http://myspace.com/music/player?sid=87831010
http://teledunet.com
RtmpSrv command line options

-c, --cert cert
-h, --help
-i, --printonly
-k, --key key
-p, --port port
-v, --version
-z, --debug

I chose to reuse the internal global variable "RTMP_ctrlC" for "--printonly" to
avoid rewriting several function calls.
Better URL decoding support

Currently RtmpDump has limited URL decoding support. If you use Bastien’s patch
as shown here
http://lists.mplayerhq.hu/pipermail/rtmpdump/2012-September/002093.html
You can pass encoded characters like this

  rtmpdump -o a.flv -i "rtmp://server.com/app playpath=foobar\0a"

Where "\0a" will be decoded as a newline.

Also the Playpath can be decoded using an unpatched RtmpDump, as long as it is
part of the "-r" parameter and properly parsed. Example

  rtmpdump -o a.flv -r rtmp://server.com/app/foobar%0a

Where "%0a" will be decoded as a newline. This presents two problems. One, many
times RtmpDump is unable to correctly parse the Playpath, mixing it with the
"app". Two, if you explicitly state the Playpath with "-y", you lose the URL
decoding support. I have simply moved the URL decoding function that Howard
wrote to parseurl.c and declared it in rtmp.h, so that it can be used across the
project. This patch also address concerns here
http://lists.mplayerhq.hu/pipermail/rtmpdump/2012-October/002112.html
RtmpSuck print UsherToken

RtmpSuck already supports streams with UsherToken. This patch merely prints the
UsherToken if found, for those who might want to invoke RtmpDump.

Taken from KSV patch file
http://github.com/downloads/K-S-V/Scripts/rtmpdump-2.4.zip
Tested with
http://de.twitch.tv
Fix rtmpdump.c compiler warning

rtmpdump.c: In function `GetLastKeyframe':
rtmpdump.c:297:7: warning: unknown conversion type character `l' in format
rtmpdump.c:297:7: warning: too many arguments for format

http://stackoverflow.com/q/586928/how-should-i-print-types-like-off-t-and-size-t
Fix thread.c compiler warning

thread.c: In function `ThreadCreate':
thread.c:35:11: warning: comparison between pointer and integer

http://stackoverflow.com/q/3905538/testing-for-an-invalid-windows-handle-should
Allow AMF_NULL

If encountering AMF_NULL, print null instead of INVALID TYPE

Test page
http://www.slavishow.com/виктор-калев-в-образа-на-силвия-кацаро