A prison officer who was filmed having sex with an inmate has pleaded guilty to misconduct in a public office.