Refactoring common codec interface