Moved checks early before object is built

Ignore-this: d0a54d68d8a511427faaef2cd8b430df

darcs-hash:20121012100800-b22ec-50fdf5d3c7e32107eea325d5f95ad0e68b520cbc
Made MediaCodec immutable and defined the __hash__ method for it

Ignore-this: d291a594fe3a28950e7d4a41a4492fac

darcs-hash:20121012114638-b22ec-e5c00f073d2ecea8b866d45731bb74adfd2be2b4