youtube-video-download.user.js
// decodeType(type) - Decode the mime type of the video
Decode the mime type of the video
Decode the mime type of the video
function decodeType(type)
 {
  var m = type.match(/^[^ ;]*/)[0],
      ret = { container: "Unknown" };
  if (m == "video/mp4")
  {
   ret.container = "MP4";
   ret.vcodec = "H.264";
   ret.acodec = "AAC";
   var m = type.match(/avc1\.(....)(..)/)
   if (m)
   {
    ret.level = parseInt(m[2], 16) / 10;
    if (m[1] == "58A0")
     ret.vprofile = "Extended";
    else if (m[1] == "6400")
     ret.vprofile = "High";
    else if (m[1] == "4D40")
     ret.vprofile = "Main";
    else if (m[1] == "42E0")
     ret.vprofile = "Baseline";
    else if (m[1] == "4200")
     ret.vprofile = "Baseline";
   }
  }
  else if (m == "video/webm")
  {
   ret.container = "WebM";
   ret.vcodec = "VP8";
   ret.acodec = "Vorbis";
  }
  else if (m == "video/x-flv")
  {
   ret.container = "FLV";
  }
  else if (m == "video/3gpp")
  {
   ret.container = "3GPP";
   ret.vcodec = "MPEG-4";
   ret.acodec = "AAC";
  }
  return ret;
 }
function decodeType ( type ) { var m = type . match ( / ^[^ ;]* / ) [ 0 ] , ret = { container : "Unknown" } ; if ( m == "video/mp4" ) { ret . container = "MP4" ; ret . vcodec = "H.264" ; ret . acodec = "AAC" ; var m = type . match ( / avc1\.(....)(..) / ) if ( m ) { ret . level = parseInt ( m [ 2 ] , 16 ) / 10 ; if ( m [ 1 ] == "58A0" ) ret . vprofile = "Extended" ; else if ( m [ 1 ] == "6400" ) ret . vprofile = "High" ; else if ( m [ 1 ] == "4D40" ) ret . vprofile = "Main" ; else if ( m [ 1 ] == "42E0" ) ret . vprofile = "Baseline" ; else if ( m [ 1 ] == "4200" ) ret . vprofile = "Baseline" ; } } else if ( m == "video/webm" ) { ret . container = "WebM" ; ret . vcodec = "VP8" ; ret . acodec = "Vorbis" ; } else if ( m == "video/x-flv" ) { ret . container = "FLV" ; } else if ( m == "video/3gpp" ) { ret . container = "3GPP" ; ret . vcodec = "MPEG-4" ; ret . acodec = "AAC" ; } return ret ; }
decodeType(type) - Decode the mime type of the video
decodeType ( type ) - Decode the mime type of the video