add encoder error code and refactor WelsWriteNal

reviewed at https://rbcommons.com/s/OpenH264/r/40