media: Fix aliasing violations

Change-Id: Ia4daef8f8f7cc752438820a814b05e43a06187bd
Fix build in ISO C++11 mode

Change-Id: If1df25e39a00f5141247ed044bda3a14cd16c3bd
Fix a cast

Change-Id: I8c9b9ec68e9bb962afbd44809774de1192591a85