What is the history of BDSM?

BDSM as a practice is widely perceived as having arisen during the nineteenth century, primarily as a response to the official repression of sexuality and the sex drive. With such an obsessive focus on sex, it was only natural that as people considered their own sexual impulses, the need to act on those impulses arose. However since flagellation as a sexual practice was widespread in the Eighteenth century, with depictions of it in the novel Fanny Hill as well as the writings of the Marquis De Sade, it is arguable that the practice really existed prior to the 1800s. Indeed elements of its psychological components have probably always been around, but only with the increase in mass media during the modern age such as the widespread printing of books, did knowledge of the practice go beyond being limited to an individual's private sphere. Certainly though the development of cameras and later film, as well as specialist magazines slowly allowed BDSM to emerge from the shadows as practitioners got to know one another and form groups and societies in what can be seen as BDSM's coming of age.