None of the above worked but I used the following code to parse the url and get the parameter value in the transformation.
<%# getFileType(GetAbsoluteUrl(Eval("Media",true).ToString()))%>
<script runat="server" >
protected string getFileType(string URL)
{
Uri myUri = new Uri(URL);
if(HttpUtility.ParseQueryString(myUri.Query).Get("amp;ext")==".jpg"){
return "image";
}
return "video";
}
</script>