encoder: introduce shared encoder API
framer: port to encoder API