rewrite MediaDefs.cpp