added EncodeFromSource