Fixed recognition of multipart files and VIDEO_TS structures.

This is a pretty extensive change. Please review it and comment if it is acceptable.

I moved some things around and changed them in an atempt to clarify the agent structure and log messages. I also tried to make it more easy to add additional file recognition strings and remove some redundancy. Some is still left though.